From ff7ee4678a290e39af5de61a99ebe1a2aea11589 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 4 Nov 2018 17:25:39 +0100 Subject: [PATCH] Catch possible MESSAGE_IDS_EMPTY errors --- pyrogram/client/ext/utils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py index f573c2e9..bc908165 100644 --- a/pyrogram/client/ext/utils.py +++ b/pyrogram/client/ext/utils.py @@ -23,7 +23,7 @@ from weakref import proxy from pyrogram.client import types as pyrogram_types from ...api import types, functions -from ...api.errors import StickersetInvalid +from ...api.errors import StickersetInvalid, MessageIdsEmpty log = logging.getLogger(__name__) @@ -633,11 +633,14 @@ def parse_messages( m.caption.init(m._client, m.caption_entities or []) if message.reply_to_msg_id and replies: - m.reply_to_message = client.get_messages( - m.chat.id, - reply_to_message_ids=message.id, - replies=replies - 1 - ) + try: + m.reply_to_message = client.get_messages( + m.chat.id, + reply_to_message_ids=message.id, + replies=replies - 1 + ) + except MessageIdsEmpty: + m.reply_to_message = None elif isinstance(message, types.MessageService): action = message.action