From ab6d60dab296905a32b60eca59f4391d843d059a Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 4 Feb 2022 11:46:57 +0100 Subject: [PATCH] Fix event building --- telethon/_client/updates.py | 3 ++- telethon/_events/messageedited.py | 4 ++-- telethon/_events/newmessage.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/telethon/_client/updates.py b/telethon/_client/updates.py index d8612f6a..61cbf4e7 100644 --- a/telethon/_client/updates.py +++ b/telethon/_client/updates.py @@ -216,7 +216,8 @@ async def _dispatch(self, update): for handler in self._update_handlers: event = event_cache.get(handler._event) if not event: - event_cache[handler._event] = event = handler._event._build(update) + event_cache[handler._event] = event = handler._event._build( + update, [], self._session_state.user_id, {}, self) while True: # filters can be modified at any time, and there can be any amount of them which are not yet resolved diff --git a/telethon/_events/messageedited.py b/telethon/_events/messageedited.py index 38c512ec..373f5fee 100644 --- a/telethon/_events/messageedited.py +++ b/telethon/_events/messageedited.py @@ -41,7 +41,7 @@ class MessageEdited(EventBuilder): print('Message', event.id, 'changed at', event.date) """ @classmethod - def _build(cls, update, others=None, self_id=None, *todo, **todo2): + def _build(cls, update, others, self_id, entities, client): if isinstance(update, (_tl.UpdateEditMessage, _tl.UpdateEditChannelMessage)): - return cls.Event(update.message) + return cls._new(client, update.message, entities, None) diff --git a/telethon/_events/newmessage.py b/telethon/_events/newmessage.py index ee62c655..38b3d8f7 100644 --- a/telethon/_events/newmessage.py +++ b/telethon/_events/newmessage.py @@ -109,4 +109,4 @@ class NewMessage(EventBuilder, _custom.Message): else: return - return cls.Event(_custom.Message._new(client, msg, entities, None)) + return cls._new(client, msg, entities, None)