Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit 2de8f19

Browse files
committed
Fix resolving peers for users with multiple usernames
This currently makes it work for the first available username only
1 parent 3b0dee7 commit 2de8f19

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyrogram/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,11 @@ async def fetch_peers(self, peers: List[Union[raw.types.User, raw.types.Chat, ra
487487
if isinstance(peer, raw.types.User):
488488
peer_id = peer.id
489489
access_hash = peer.access_hash
490-
username = (peer.username or "").lower() or None
490+
username = (
491+
peer.username.lower() if peer.username
492+
else peer.usernames[0].username.lower() if peer.usernames
493+
else None
494+
)
491495
phone_number = peer.phone
492496
peer_type = "bot" if peer.bot else "user"
493497
elif isinstance(peer, (raw.types.Chat, raw.types.ChatForbidden)):

0 commit comments

Comments
 (0)