Add chat_id-like convenience properties to the events

This commit is contained in:
Lonami Exo
2018-04-08 14:22:11 +02:00
parent 259bb6ace1
commit 93b5909be5
4 changed files with 43 additions and 1 deletions

View File

@@ -192,6 +192,14 @@ class EventCommon(abc.ABC):
return self._chat
@property
def chat_id(self):
"""
Returns the marked integer ID of the chat, if any.
"""
if self._chat_peer:
return utils.get_peer_id(self._chat_peer)
def __str__(self):
return TLObject.pretty_format(self.to_dict())