Update chat username parsing in case of multiple usernames

This commit is contained in:
Dan 2023-03-11 16:45:32 +01:00
parent d6476ce57e
commit a3a4a0204c

View File

@ -513,7 +513,11 @@ class Client(Methods):
elif isinstance(peer, (raw.types.Channel, raw.types.ChannelForbidden)): elif isinstance(peer, (raw.types.Channel, raw.types.ChannelForbidden)):
peer_id = utils.get_channel_id(peer.id) peer_id = utils.get_channel_id(peer.id)
access_hash = peer.access_hash 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" peer_type = "channel" if peer.broadcast else "supergroup"
else: else:
continue continue