diff --git a/pyrogram/client/utils.py b/pyrogram/client/utils.py index 98f605a5..196e795b 100644 --- a/pyrogram/client/utils.py +++ b/pyrogram/client/utils.py @@ -84,6 +84,35 @@ def parse_channel_chat(channel: types.Channel): ) +def parse_thumb(thumb: types.PhotoSize or types.PhotoCachedSize): + if isinstance(thumb, (types.PhotoSize, types.PhotoCachedSize)): + loc = thumb.location + + if isinstance(thumb, types.PhotoSize): + file_size = thumb.size + else: + file_size = len(thumb.bytes) + + if isinstance(loc, types.FileLocation): + return pyrogram.PhotoSize( + file_id=encode( + pack( + "