mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-27 12:28:09 +00:00
Fix ChatPhoto failing to parse in case the user is not known yet
This commit is contained in:
parent
7cac3521fe
commit
c3dde77274
@ -20,6 +20,7 @@ from struct import pack
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
|
from pyrogram.errors import PeerIdInvalid
|
||||||
from ..object import Object
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
@ -58,7 +59,10 @@ class ChatPhoto(Object):
|
|||||||
loc_small = chat_photo.photo_small
|
loc_small = chat_photo.photo_small
|
||||||
loc_big = chat_photo.photo_big
|
loc_big = chat_photo.photo_big
|
||||||
|
|
||||||
|
try:
|
||||||
peer = client.resolve_peer(peer_id)
|
peer = client.resolve_peer(peer_id)
|
||||||
|
except PeerIdInvalid:
|
||||||
|
return None
|
||||||
|
|
||||||
if isinstance(peer, types.InputPeerUser):
|
if isinstance(peer, types.InputPeerUser):
|
||||||
peer_id = peer.user_id
|
peer_id = peer.user_id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user