From e2cce1b1e6dfa109ab7f0b34ed5a5f2fce44c692 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:29:46 +0100 Subject: [PATCH] Check empty messages first of all --- pyrogram/types/messages_and_media/message.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 897cf26d..aaab0af0 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -433,6 +433,9 @@ class Message(Object, Update): is_scheduled: bool = False, replies: int = 1 ): + if isinstance(message, raw.types.MessageEmpty): + return Message(message_id=message.id, empty=True, client=client) + user_id = utils.get_raw_peer_id(message.from_id) or utils.get_raw_peer_id(message.peer_id) if user_id not in users: try: @@ -446,9 +449,6 @@ class Message(Object, Update): else: users[r.id] = r - if isinstance(message, raw.types.MessageEmpty): - return Message(message_id=message.id, empty=True, client=client) - if isinstance(message, raw.types.MessageService): action = message.action