mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 07:50:32 +00:00
Add IDFilter support for ChatJoinRequest events (#983)
This commit is contained in:
parent
7214ba2f4b
commit
87a8b50949
1 changed files with 5 additions and 2 deletions
|
|
@ -10,7 +10,7 @@ from babel.support import LazyProxy
|
|||
|
||||
from aiogram import types
|
||||
from aiogram.dispatcher.filters.filters import BoundFilter, Filter
|
||||
from aiogram.types import CallbackQuery, ChatType, InlineQuery, Message, Poll, ChatMemberUpdated, BotCommand
|
||||
from aiogram.types import CallbackQuery, ChatType, InlineQuery, Message, Poll, ChatMemberUpdated, BotCommand, ChatJoinRequest
|
||||
|
||||
ChatIDArgumentType = typing.Union[typing.Iterable[typing.Union[int, str]], str, int]
|
||||
|
||||
|
|
@ -619,7 +619,7 @@ class IDFilter(Filter):
|
|||
|
||||
return result
|
||||
|
||||
async def check(self, obj: Union[Message, CallbackQuery, InlineQuery, ChatMemberUpdated]):
|
||||
async def check(self, obj: Union[Message, CallbackQuery, InlineQuery, ChatMemberUpdated, ChatJoinRequest]):
|
||||
if isinstance(obj, Message):
|
||||
user_id = None
|
||||
if obj.from_user is not None:
|
||||
|
|
@ -637,6 +637,9 @@ class IDFilter(Filter):
|
|||
elif isinstance(obj, ChatMemberUpdated):
|
||||
user_id = obj.from_user.id
|
||||
chat_id = obj.chat.id
|
||||
elif isinstance(obj, ChatJoinRequest):
|
||||
user_id = obj.from_user.id
|
||||
chat_id = obj.chat.id
|
||||
else:
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue