mirror of
https://github.com/PaiGramTeam/GramCore.git
synced 2024-11-21 21:58:04 +00:00
🐛 Fix handler type hint in python-telegram-bot v21.6
This commit is contained in:
parent
e060fcac75
commit
7129322f6d
@ -18,10 +18,10 @@ UT = TypeVar("UT")
|
|||||||
CCT = TypeVar("CCT", bound="CallbackContext[Any, Any, Any, Any]")
|
CCT = TypeVar("CCT", bound="CallbackContext[Any, Any, Any, Any]")
|
||||||
|
|
||||||
|
|
||||||
class AdminHandler(BaseHandler[Update, CCT]):
|
class AdminHandler(BaseHandler[Update, CCT, RT]):
|
||||||
_lock = asyncio.Lock()
|
_lock = asyncio.Lock()
|
||||||
|
|
||||||
def __init__(self, handler: BaseHandler[Update, CCT], application: "Application") -> None:
|
def __init__(self, handler: BaseHandler[Update, CCT, RT], application: "Application") -> None:
|
||||||
self.handler = handler
|
self.handler = handler
|
||||||
self.application = application
|
self.application = application
|
||||||
self.user_service: Optional["UserAdminService"] = None
|
self.user_service: Optional["UserAdminService"] = None
|
||||||
|
@ -17,11 +17,12 @@ if TYPE_CHECKING:
|
|||||||
from telegram import Bot
|
from telegram import Bot
|
||||||
from gram_core.application import Application
|
from gram_core.application import Application
|
||||||
|
|
||||||
|
RT = TypeVar("RT")
|
||||||
UT = TypeVar("UT")
|
UT = TypeVar("UT")
|
||||||
CCT = TypeVar("CCT", bound="CallbackContext[Any, Any, Any, Any]")
|
CCT = TypeVar("CCT", bound="CallbackContext[Any, Any, Any, Any]")
|
||||||
|
|
||||||
|
|
||||||
class GroupHandler(BaseHandler[UT, CCT]):
|
class GroupHandler(BaseHandler[UT, CCT, RT]):
|
||||||
_lock = asyncio.Lock()
|
_lock = asyncio.Lock()
|
||||||
__lock = asyncio.Lock()
|
__lock = asyncio.Lock()
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ class GroupHandler(BaseHandler[UT, CCT]):
|
|||||||
await group_service.remove_update(chat.id)
|
await group_service.remove_update(chat.id)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
async def message_check_callback(self, update: Update, _: ContextTypes.DEFAULT_TYPE):
|
async def message_check_callback(self, update: Update, _: ContextTypes.DEFAULT_TYPE) -> RT:
|
||||||
if update.inline_query is not None:
|
if update.inline_query is not None:
|
||||||
return
|
return
|
||||||
if update.effective_chat:
|
if update.effective_chat:
|
||||||
|
@ -21,11 +21,11 @@ T_PreprocessorsFunc = Callable[
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class HookHandler(BaseHandler[Update, CCT]):
|
class HookHandler(BaseHandler[Update, CCT, RT]):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
handler: BaseHandler[Update, CCT],
|
handler: BaseHandler[Update, CCT, RT],
|
||||||
handler_data: Union["HandlerData", "ConversationData"],
|
handler_data: Union["HandlerData", "ConversationData"],
|
||||||
application: "Application",
|
application: "Application",
|
||||||
) -> None:
|
) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user