diff --git a/pyrogram/client/types/user_and_chats/chat_photo.py b/pyrogram/client/types/user_and_chats/chat_photo.py index 70e114af..7378e3ce 100644 --- a/pyrogram/client/types/user_and_chats/chat_photo.py +++ b/pyrogram/client/types/user_and_chats/chat_photo.py @@ -52,20 +52,40 @@ class ChatPhoto(Object): if not isinstance(chat_photo, (types.UserProfilePhoto, types.ChatPhoto)): return None + photo_id = getattr(chat_photo, "photo_id", 0) loc_small = chat_photo.photo_small loc_big = chat_photo.photo_big + peer = client.resolve_peer(peer_id) + + if isinstance(peer, types.InputPeerUser): + peer_id = peer.user_id + peer_access_hash = peer.access_hash + x = 0 + elif isinstance(peer, types.InputPeerChat): + peer_id = -peer.chat_id + peer_access_hash = 0 + x = -1 + else: + peer_id += 1000727379968 + peer_access_hash = peer.access_hash + x = -234 + return ChatPhoto( small_file_id=encode( pack( - "