From 7ba523600e244da0c7840e84553180d5d5b0284a Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 4 Apr 2018 20:21:07 +0200 Subject: [PATCH] Handle Location type --- pyrogram/client/utils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/utils.py b/pyrogram/client/utils.py index 73247722..45d15489 100644 --- a/pyrogram/client/utils.py +++ b/pyrogram/client/utils.py @@ -107,6 +107,7 @@ def parse_message(message: types.Message, users: dict, chats: dict): forward_signature = forward_header.post_author photo = None + location = None media = message.media @@ -149,6 +150,14 @@ def parse_message(message: types.Message, users: dict, chats: dict): photo_sizes.append(photo_size) photo = photo_sizes + elif isinstance(media, types.MessageMediaGeo): + geo_point = media.geo + + if isinstance(geo_point, types.GeoPoint): + location = pyrogram.Location( + longitude=geo_point.long, + latitude=geo_point.lat + ) return pyrogram.Message( message_id=message.id, @@ -166,7 +175,8 @@ def parse_message(message: types.Message, users: dict, chats: dict): forward_signature=forward_signature, forward_date=forward_date, edit_date=message.edit_date, - photo=photo + photo=photo, + location=location )