From 156afd980554ff179ac03372401076ee729aa270 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 4 Apr 2018 20:28:05 +0200 Subject: [PATCH] Handle Contact type --- pyrogram/client/utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/utils.py b/pyrogram/client/utils.py index 45d15489..98f605a5 100644 --- a/pyrogram/client/utils.py +++ b/pyrogram/client/utils.py @@ -108,6 +108,7 @@ def parse_message(message: types.Message, users: dict, chats: dict): photo = None location = None + contact = None media = message.media @@ -158,6 +159,13 @@ def parse_message(message: types.Message, users: dict, chats: dict): longitude=geo_point.long, latitude=geo_point.lat ) + elif isinstance(media, types.MessageMediaContact): + contact = pyrogram.Contact( + phone_number=media.phone_number, + first_name=media.first_name, + last_name=media.last_name, + user_id=media.user_id + ) return pyrogram.Message( message_id=message.id, @@ -176,7 +184,8 @@ def parse_message(message: types.Message, users: dict, chats: dict): forward_date=forward_date, edit_date=message.edit_date, photo=photo, - location=location + location=location, + contact=contact )