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:
elandorr 2020-08-21 05:30:42 +00:00 committed by GitHub
parent c8c6faa96e
commit ce0ddcddb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,6 +64,7 @@ class GetNearbyChats(BaseClient):
peers = r.updates[0].peers peers = r.updates[0].peers
for peer in peers: for peer in peers:
if isinstance(peer.peer, types.PeerChannel):
chat_id = utils.get_channel_id(peer.peer.channel_id) chat_id = utils.get_channel_id(peer.peer.channel_id)
for chat in chats: for chat in chats: