Skip to content

Commit ff7ee46

Browse files
committed
Catch possible MESSAGE_IDS_EMPTY errors
1 parent b1e35ef commit ff7ee46

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pyrogram/client/ext/utils.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
from pyrogram.client import types as pyrogram_types
2525
from ...api import types, functions
26-
from ...api.errors import StickersetInvalid
26+
from ...api.errors import StickersetInvalid, MessageIdsEmpty
2727

2828
log = logging.getLogger(__name__)
2929

@@ -633,11 +633,14 @@ def parse_messages(
633633
m.caption.init(m._client, m.caption_entities or [])
634634

635635
if message.reply_to_msg_id and replies:
636-
m.reply_to_message = client.get_messages(
637-
m.chat.id,
638-
reply_to_message_ids=message.id,
639-
replies=replies - 1
640-
)
636+
try:
637+
m.reply_to_message = client.get_messages(
638+
m.chat.id,
639+
reply_to_message_ids=message.id,
640+
replies=replies - 1
641+
)
642+
except MessageIdsEmpty:
643+
m.reply_to_message = None
641644
elif isinstance(message, types.MessageService):
642645
action = message.action
643646

0 commit comments

Comments
 (0)