From 5f8032584bd2067ebbe12b05e20bf7a4f5123388 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 1 Feb 2020 15:32:52 +0100 Subject: [PATCH] Fix _get_response_message for sendMedia(live location) --- telethon/client/messageparse.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/telethon/client/messageparse.py b/telethon/client/messageparse.py index 5de635ea..7bff5c06 100644 --- a/telethon/client/messageparse.py +++ b/telethon/client/messageparse.py @@ -135,8 +135,13 @@ class MessageParseMethods: elif (isinstance(update, types.UpdateEditMessage) and helpers._entity_type(request.peer) != helpers._EntityType.CHANNEL): - if request.id == update.message.id: - update.message._finish_init(self, entities, input_chat) + update.message._finish_init(self, entities, input_chat) + + # Live locations use `sendMedia` but Telegram responds with + # `updateEditMessage`, which means we won't have `id` field. + if hasattr(request, 'random_id'): + id_to_message[update.message.id] = update.message + elif request.id == update.message.id: return update.message elif (isinstance(update, types.UpdateEditChannelMessage)