diff --git a/pyrogram/client/methods/chats/get_nearby_chats.py b/pyrogram/client/methods/chats/get_nearby_chats.py index 6b4ab56d..4e76b7e6 100644 --- a/pyrogram/client/methods/chats/get_nearby_chats.py +++ b/pyrogram/client/methods/chats/get_nearby_chats.py @@ -64,11 +64,12 @@ class GetNearbyChats(BaseClient): peers = r.updates[0].peers for peer in peers: - chat_id = utils.get_channel_id(peer.peer.channel_id) + if isinstance(peer.peer, types.PeerChannel): + chat_id = utils.get_channel_id(peer.peer.channel_id) - for chat in chats: - if chat.id == chat_id: - chat.distance = peer.distance - break + for chat in chats: + if chat.id == chat_id: + chat.distance = peer.distance + break return chats