fix: respect type hints

This commit is contained in:
Egor 2020-06-22 23:25:25 +05:00
parent 768491d976
commit b9424106a7

View file

@ -706,6 +706,9 @@ class ChatTypeFilter(BoundFilter):
async def check(self, obj: Union[Message, CallbackQuery]):
if isinstance(obj, Message):
obj = obj.chat
if isinstance(obj, CallbackQuery):
elif isinstance(obj, CallbackQuery):
obj = obj.message.chat
else:
raise NotImplementedError
return obj.type in self.chat_type