Also fetch peer_id user details
This commit is contained in:
parent
a73f990667
commit
bf9e186414
@ -436,18 +436,25 @@ class Message(Object, Update):
|
|||||||
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)
|
||||||
|
|
||||||
user_id = utils.get_raw_peer_id(message.from_id) or utils.get_raw_peer_id(message.peer_id)
|
from_id = utils.get_raw_peer_id(message.from_id)
|
||||||
if user_id not in users:
|
peer_id = utils.get_raw_peer_id(message.peer_id)
|
||||||
try:
|
user_id = from_id or peer_id
|
||||||
r = (await client.send(
|
|
||||||
raw.functions.users.GetUsers(
|
if isinstance(message.from_id, raw.types.PeerUser) and isinstance(message.peer_id, raw.types.PeerUser):
|
||||||
id=[await client.resolve_peer(user_id)]
|
if from_id not in users or peer_id not in users:
|
||||||
|
try:
|
||||||
|
r = await client.send(
|
||||||
|
raw.functions.users.GetUsers(
|
||||||
|
id=[
|
||||||
|
await client.resolve_peer(from_id),
|
||||||
|
await client.resolve_peer(peer_id)
|
||||||
|
]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
))[0]
|
except PeerIdInvalid:
|
||||||
except PeerIdInvalid:
|
pass
|
||||||
pass
|
else:
|
||||||
else:
|
users.update({i.id: i for i in r})
|
||||||
users[r.id] = r
|
|
||||||
|
|
||||||
if isinstance(message, raw.types.MessageService):
|
if isinstance(message, raw.types.MessageService):
|
||||||
action = message.action
|
action = message.action
|
||||||
|
Loading…
Reference in New Issue
Block a user