Fix get_nearby_chats breaking with the new Layer (#446)
* fix for new format This fixes the `AttributeError: 'PeerUser' object has no attribute 'channel_id'`. Maybe we should also have a method to show nearby users? * Update get_nearby_chats.py Use isinstance instead of type Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
parent
c8c6faa96e
commit
ce0ddcddb2
@ -64,11 +64,12 @@ class GetNearbyChats(BaseClient):
|
|||||||
peers = r.updates[0].peers
|
peers = r.updates[0].peers
|
||||||
|
|
||||||
for peer in 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:
|
for chat in chats:
|
||||||
if chat.id == chat_id:
|
if chat.id == chat_id:
|
||||||
chat.distance = peer.distance
|
chat.distance = peer.distance
|
||||||
break
|
break
|
||||||
|
|
||||||
return chats
|
return chats
|
||||||
|
Loading…
Reference in New Issue
Block a user