From fad0e7a26d4084ec252cbe2bafd65fd092a6cbbd Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 5 Apr 2018 11:17:40 +0200 Subject: [PATCH] Add new_chat_photo field --- pyrogram/client/utils.py | 41 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/utils.py b/pyrogram/client/utils.py index f6a3e5c2..60c11978 100644 --- a/pyrogram/client/utils.py +++ b/pyrogram/client/utils.py @@ -404,6 +404,7 @@ def parse_message_service( migrate_from_chat_id = None group_chat_created = None channel_chat_created = None + new_chat_photo = None if isinstance(action, types.MessageActionChatAddUser): new_chat_members = [parse_user(users[i]) for i in action.users] @@ -423,6 +424,44 @@ def parse_message_service( group_chat_created = True elif isinstance(action, types.MessageActionChannelCreate): channel_chat_created = True + elif isinstance(action, types.MessageActionChatEditPhoto): + photo = action.photo + + if isinstance(photo, types.Photo): + sizes = photo.sizes + photo_sizes = [] + + for size in sizes: + if isinstance(size, (types.PhotoSize, types.PhotoCachedSize)): + loc = size.location + + if isinstance(size, types.PhotoSize): + file_size = size.size + else: + file_size = len(size.bytes) + + if isinstance(loc, types.FileLocation): + photo_size = pyrogram.PhotoSize( + file_id=encode( + pack( + "