♻ 移除旧的 CallbackContext

This commit is contained in:
洛水居室 2022-07-27 00:06:14 +08:00
parent 998eea1e54
commit e2629469d8
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -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