From ad9f610a6ad5c316a9684545056aa351a17dc6b1 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 2 Aug 2019 02:30:19 +0200 Subject: [PATCH] Update ChatPhoto file_id format --- .../client/types/user_and_chats/chat_photo.py | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) 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( - "