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( + "