mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
More usable ChatType checker. Allow to use message or chat instances.
This commit is contained in:
parent
ba44ca67fa
commit
47a865aa5f
1 changed files with 4 additions and 2 deletions
|
|
@ -384,9 +384,11 @@ class ChatType(helper.Helper):
|
|||
|
||||
@staticmethod
|
||||
def _check(obj, chat_types) -> bool:
|
||||
if not hasattr(obj, 'chat'):
|
||||
if hasattr(obj, 'chat'):
|
||||
obj = obj.chat
|
||||
if not hasattr(obj, 'type'):
|
||||
return False
|
||||
return obj.chat.type in chat_types
|
||||
return obj.type in chat_types
|
||||
|
||||
@classmethod
|
||||
def is_private(cls, obj) -> bool:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue