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

@@ -40,7 +40,8 @@ class CallbackQuery(EventBuilder):
else:
raise TypeError('Invalid data type given')
def build(self, update):
@staticmethod
def build(update):
if isinstance(update, (types.UpdateBotCallbackQuery,
types.UpdateInlineBotCallbackQuery)):
event = CallbackQuery.Event(update)
@@ -48,9 +49,9 @@ class CallbackQuery(EventBuilder):
return
event._entities = update._entities
return self._filter_event(event)
return event
def _filter_event(self, event):
def filter(self, event):
if self.chats is not None:
inside = event.query.chat_instance in self.chats
if event.chat_id: