Return produced service message with pin_message

Fixes #1394.
This commit is contained in:
Lonami Exo
2020-04-29 10:29:14 +02:00
parent 74bced75b4
commit c43e2a0a3a
4 changed files with 25 additions and 5 deletions

View File

@@ -131,7 +131,14 @@ class MessageParseMethods:
elif isinstance(update, (
types.UpdateNewChannelMessage, types.UpdateNewMessage)):
update.message._finish_init(self, entities, input_chat)
id_to_message[update.message.id] = update.message
# Pinning a message with `updatePinnedMessage` seems to
# always produce a service message we can't map so return
# it directly.
if hasattr(request, 'random_id'):
id_to_message[update.message.id] = update.message
else:
return update.message
elif (isinstance(update, types.UpdateEditMessage)
and helpers._entity_type(request.peer) != helpers._EntityType.CHANNEL):