mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-22 06:17:54 +00:00
♻ 移除旧的 CallbackContext
This commit is contained in:
parent
998eea1e54
commit
e2629469d8
@ -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
|
|
Loading…
Reference in New Issue
Block a user