From a3a4a0204c382bc2e4038f8c6cb9a7e215603c48 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 11 Mar 2023 16:45:32 +0100 Subject: [PATCH] Update chat username parsing in case of multiple usernames --- pyrogram/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyrogram/client.py b/pyrogram/client.py index 9de55621..f213c57a 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -513,7 +513,11 @@ class Client(Methods): elif isinstance(peer, (raw.types.Channel, raw.types.ChannelForbidden)): peer_id = utils.get_channel_id(peer.id) access_hash = peer.access_hash - username = (getattr(peer, "username", None) or "").lower() or None + username = ( + peer.username.lower() if peer.username + else peer.usernames[0].username.lower() if peer.usernames + else None + ) peer_type = "channel" if peer.broadcast else "supergroup" else: continue