mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-09 00:14:50 +00:00
Fix ChatPhoto failing to parse in case the user is not known yet
This commit is contained in:
parent
7cac3521fe
commit
c3dde77274
1 changed files with 5 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
||||||
peer = client.resolve_peer(peer_id)
|
try:
|
||||||
|
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…
Reference in a new issue