mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-27 16:45:19 +00:00
Don't propagate errors when fetching missing user details
This commit is contained in:
parent
85ee6c3785
commit
8d03850d03
@ -24,7 +24,7 @@ import pyrogram
|
|||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram import utils
|
from pyrogram import utils
|
||||||
from pyrogram.errors import MessageIdsEmpty
|
from pyrogram.errors import MessageIdsEmpty, PeerIdInvalid
|
||||||
from pyrogram.parser import utils as parser_utils, Parser
|
from pyrogram.parser import utils as parser_utils, Parser
|
||||||
from ..object import Object
|
from ..object import Object
|
||||||
from ..update import Update
|
from ..update import Update
|
||||||
@ -435,13 +435,16 @@ class Message(Object, Update):
|
|||||||
):
|
):
|
||||||
user_id = utils.get_raw_peer_id(message.from_id) or utils.get_raw_peer_id(message.peer_id)
|
user_id = utils.get_raw_peer_id(message.from_id) or utils.get_raw_peer_id(message.peer_id)
|
||||||
if user_id not in users:
|
if user_id not in users:
|
||||||
r = (await client.send(
|
try:
|
||||||
raw.functions.users.GetUsers(
|
r = (await client.send(
|
||||||
id=[await client.resolve_peer(user_id)]
|
raw.functions.users.GetUsers(
|
||||||
)
|
id=[await client.resolve_peer(user_id)]
|
||||||
))[0]
|
)
|
||||||
|
))[0]
|
||||||
users[r.id] = r
|
except PeerIdInvalid:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
users[r.id] = r
|
||||||
|
|
||||||
if isinstance(message, raw.types.MessageEmpty):
|
if isinstance(message, raw.types.MessageEmpty):
|
||||||
return Message(message_id=message.id, empty=True, client=client)
|
return Message(message_id=message.id, empty=True, client=client)
|
||||||
|
Loading…
Reference in New Issue
Block a user