mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Fix resolving peers for users with multiple usernames
This currently makes it work for the first available username only
This commit is contained in:
parent
3b0dee7dd5
commit
2de8f1921c
1 changed files with 5 additions and 1 deletions
|
|
@ -487,7 +487,11 @@ class Client(Methods):
|
||||||
if isinstance(peer, raw.types.User):
|
if isinstance(peer, raw.types.User):
|
||||||
peer_id = peer.id
|
peer_id = peer.id
|
||||||
access_hash = peer.access_hash
|
access_hash = peer.access_hash
|
||||||
username = (peer.username or "").lower() or None
|
username = (
|
||||||
|
peer.username.lower() if peer.username
|
||||||
|
else peer.usernames[0].username.lower() if peer.usernames
|
||||||
|
else None
|
||||||
|
)
|
||||||
phone_number = peer.phone
|
phone_number = peer.phone
|
||||||
peer_type = "bot" if peer.bot else "user"
|
peer_type = "bot" if peer.bot else "user"
|
||||||
elif isinstance(peer, (raw.types.Chat, raw.types.ChatForbidden)):
|
elif isinstance(peer, (raw.types.Chat, raw.types.ChatForbidden)):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue