Build events only once per update

This commit is contained in:
Lonami Exo
2018-07-11 11:22:43 +02:00
parent 81f31e09c8
commit 1d0fd6801d
10 changed files with 74 additions and 49 deletions

View File

@@ -8,7 +8,8 @@ class ChatAction(EventBuilder):
"""
Represents an action in a chat (such as user joined, left, or new pin).
"""
def build(self, update):
@staticmethod
def build(update):
if isinstance(update, types.UpdateChannelPinnedMessage) and update.id == 0:
# Telegram does not always send
# UpdateChannelPinnedMessage for new pins
@@ -78,7 +79,7 @@ class ChatAction(EventBuilder):
return
event._entities = update._entities
return self._filter_event(event)
return event
class Event(EventCommon):
"""