Fix ChatPhoto failing to parse in case the user is not known yet

This commit is contained in:
Dan 2019-09-07 15:55:58 +02:00
parent 7cac3521fe
commit c3dde77274

View File

@ -20,6 +20,7 @@ from struct import pack
import pyrogram
from pyrogram.api import types
from pyrogram.errors import PeerIdInvalid
from ..object import Object
from ...ext.utils import encode
@ -58,7 +59,10 @@ class ChatPhoto(Object):
loc_small = chat_photo.photo_small
loc_big = chat_photo.photo_big
try:
peer = client.resolve_peer(peer_id)
except PeerIdInvalid:
return None
if isinstance(peer, types.InputPeerUser):
peer_id = peer.user_id