Implement _load_entities for all events

Follow-up of c902428af1
This means that now input_chat (and even chat_id) and
similar can be safely used, without needing get_input
This commit is contained in:
Lonami Exo
2019-03-28 10:47:15 +01:00
parent 5554b414e1
commit 39d9531483
7 changed files with 40 additions and 12 deletions

View File

@@ -207,6 +207,13 @@ class NewMessage(EventBuilder):
self.message._finish_init(client, self._entities, None)
self.__dict__['_init'] = True # No new attributes can be set
def _load_entities(self):
m = self.message
m._chat, m._input_chat = self._get_entity_pair(m.chat_id)
m._sender, m._input_sender = self._get_entity_pair(m.sender_id)
return m._input_chat is not None and (
not m.sender_id or m._input_sender is not None)
def __getattr__(self, item):
if item in self.__dict__:
return self.__dict__[item]