2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-09-10 11:15:27 +00:00

Fix group, channel and supergroup ChatPhoto downloads

Closes #326
This commit is contained in:
Dan
2019-10-19 16:24:23 +02:00
parent 2482358484
commit 51cd186559
4 changed files with 33 additions and 8 deletions

View File

@@ -1221,6 +1221,7 @@ class Client(Methods, BaseClient):
access_hash=data.access_hash,
thumb_size=data.thumb_size,
peer_id=data.peer_id,
peer_type=data.peer_type,
peer_access_hash=data.peer_access_hash,
volume_id=data.volume_id,
local_id=data.local_id,
@@ -1866,6 +1867,7 @@ class Client(Methods, BaseClient):
access_hash: int,
thumb_size: str,
peer_id: int,
peer_type: str,
peer_access_hash: int,
volume_id: int,
local_id: int,
@@ -1913,11 +1915,23 @@ class Client(Methods, BaseClient):
file_ref = utils.decode_file_ref(file_ref)
if media_type == 1:
location = types.InputPeerPhotoFileLocation(
peer=types.InputPeerUser(
if peer_type == "user":
peer = types.InputPeerUser(
user_id=peer_id,
access_hash=peer_access_hash
),
)
elif peer_type == "chat":
peer = types.InputPeerChat(
chat_id=peer_id
)
else:
peer = types.InputPeerChannel(
channel_id=peer_id,
access_hash=peer_access_hash
)
location = types.InputPeerPhotoFileLocation(
peer=peer,
volume_id=volume_id,
local_id=local_id,
big=is_big or None