More usable ChatType checker. Allow to use message or chat instances.

This commit is contained in:
Alex Root Junior 2018-01-27 08:15:34 +02:00
parent ba44ca67fa
commit 47a865aa5f

View file

@ -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: