mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 12:57:52 +00:00
Refactor ChatPhoto to accommodate L100 changes
This commit is contained in:
parent
fda456cd1e
commit
b217bf3784
@ -50,31 +50,24 @@ class ChatPhoto(PyrogramType):
|
||||
self.big_file_id = big_file_id
|
||||
|
||||
@staticmethod
|
||||
def _parse(client, chat_photo: types.UserProfilePhoto or types.ChatPhoto):
|
||||
def _parse(client, chat_photo: types.UserProfilePhoto or types.ChatPhoto, peer_id: int):
|
||||
if not isinstance(chat_photo, (types.UserProfilePhoto, types.ChatPhoto)):
|
||||
return None
|
||||
|
||||
if not isinstance(chat_photo.photo_small, types.FileLocation):
|
||||
return None
|
||||
|
||||
if not isinstance(chat_photo.photo_big, types.FileLocation):
|
||||
return None
|
||||
|
||||
photo_id = getattr(chat_photo, "photo_id", 0)
|
||||
loc_small = chat_photo.photo_small
|
||||
loc_big = chat_photo.photo_big
|
||||
|
||||
return ChatPhoto(
|
||||
small_file_id=encode(
|
||||
pack(
|
||||
"<iiqqqqi",
|
||||
1, loc_small.dc_id, photo_id, 0, loc_small.volume_id, loc_small.secret, loc_small.local_id
|
||||
"<iiqqib",
|
||||
1, chat_photo.dc_id, peer_id, loc_small.volume_id, loc_small.local_id, 0
|
||||
)
|
||||
),
|
||||
big_file_id=encode(
|
||||
pack(
|
||||
"<iiqqqqi",
|
||||
1, loc_big.dc_id, photo_id, 0, loc_big.volume_id, loc_big.secret, loc_big.local_id
|
||||
"<iiqqib",
|
||||
1, chat_photo.dc_id, peer_id, loc_big.volume_id, loc_big.local_id, 1
|
||||
)
|
||||
),
|
||||
client=client
|
||||
|
Loading…
x
Reference in New Issue
Block a user