From e2629469d8559908150e088d091079d8ea61248f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Wed, 27 Jul 2022 00:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=20=E7=A7=BB=E9=99=A4=E6=97=A7?= =?UTF-8?q?=E7=9A=84=20`CallbackContext`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/base.py | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 utils/base.py diff --git a/utils/base.py b/utils/base.py deleted file mode 100644 index a8da0a5..0000000 --- a/utils/base.py +++ /dev/null @@ -1,17 +0,0 @@ -from service import BaseService -from telegram.ext import CallbackContext, ExtBot - - -class PaimonContext(CallbackContext[ExtBot, dict, dict, dict]): - """自定义的PaimoeContext""" - - @property - def service(self) -> BaseService: - """在回调中从 bot_data 获取 service 实例 - - :return: BaseService 实例 - """ - value = self.application.bot_data.get("service") - if value is None: - raise RuntimeError("没有找到与此上下文对象关联的实例化服务") - return value