From 75cbd18edee5a66f9c52466066fab8952e2c8472 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 13 Apr 2018 16:41:20 +0200 Subject: [PATCH] Add ability to re-fetch usernames and contacts --- pyrogram/client/client.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 52c22f97..3436f471 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -222,6 +222,9 @@ class Client: now = time.time() if abs(now - self.date) > Client.OFFLINE_SLEEP: + self.peers_by_username = {} + self.peers_by_phone = {} + self.get_dialogs() self.get_contacts() else: @@ -469,9 +472,6 @@ class Client: if isinstance(entity, types.User): user_id = entity.id - if user_id in self.peers_by_id: - continue - access_hash = entity.access_hash if access_hash is None: @@ -497,9 +497,6 @@ class Client: chat_id = entity.id peer_id = -chat_id - if peer_id in self.peers_by_id: - continue - input_peer = types.InputPeerChat( chat_id=chat_id ) @@ -510,9 +507,6 @@ class Client: channel_id = entity.id peer_id = int("-100" + str(channel_id)) - if peer_id in self.peers_by_id: - continue - access_hash = entity.access_hash if access_hash is None: