2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Handle possible MESSAGE_IDS_EMPTY errors in case of pinned messages

This commit is contained in:
Dan 2018-11-07 13:11:33 +01:00
parent 648eb80928
commit f8844d60ab

View File

@ -641,7 +641,7 @@ def parse_messages(
replies=replies - 1 replies=replies - 1
) )
except MessageIdsEmpty: except MessageIdsEmpty:
m.reply_to_message = None pass
elif isinstance(message, types.MessageService): elif isinstance(message, types.MessageService):
action = message.action action = message.action
@ -742,11 +742,14 @@ def parse_messages(
) )
if isinstance(action, types.MessageActionPinMessage): if isinstance(action, types.MessageActionPinMessage):
try:
m.pinned_message = client.get_messages( m.pinned_message = client.get_messages(
m.chat.id, m.chat.id,
reply_to_message_ids=message.id, reply_to_message_ids=message.id,
replies=0 replies=0
) )
except MessageIdsEmpty:
pass
else: else:
m = pyrogram_types.Message(message_id=message.id, client=proxy(client)) m = pyrogram_types.Message(message_id=message.id, client=proxy(client))