diff --git a/aiogram/dispatcher/filters/builtin.py b/aiogram/dispatcher/filters/builtin.py index ebd38f08..5bf8670b 100644 --- a/aiogram/dispatcher/filters/builtin.py +++ b/aiogram/dispatcher/filters/builtin.py @@ -728,18 +728,20 @@ class ChatTypeFilter(BoundFilter): self.chat_type: typing.Set[str] = set(chat_type) - async def check(self, obj: Union[Message, CallbackQuery, ChatMemberUpdated]): + async def check(self, obj: Union[Message, CallbackQuery, ChatMemberUpdated, InlineQuery]): if isinstance(obj, Message): - obj = obj.chat + chat_type = obj.chat.type elif isinstance(obj, CallbackQuery): - obj = obj.message.chat + chat_type = obj.message.chat.type elif isinstance(obj, ChatMemberUpdated): - obj = obj.chat + chat_type = obj.chat.type + elif isinstance(obj, InlineQuery): + chat_type = obj.chat_type else: warnings.warn("ChatTypeFilter doesn't support %s as input", type(obj)) return False - return obj.type in self.chat_type + return chat_type in self.chat_type class MediaGroupFilter(BoundFilter): diff --git a/aiogram/types/chat.py b/aiogram/types/chat.py index c18ad88b..933c3737 100644 --- a/aiogram/types/chat.py +++ b/aiogram/types/chat.py @@ -652,6 +652,7 @@ class ChatType(helper.Helper): """ List of chat types + :key: SENDER :key: PRIVATE :key: GROUP :key: SUPER_GROUP @@ -661,6 +662,7 @@ class ChatType(helper.Helper): mode = helper.HelperMode.lowercase + SENDER = helper.Item() # sender PRIVATE = helper.Item() # private GROUP = helper.Item() # group SUPERGROUP = helper.Item() # supergroup