From aaf0e82cdf4292634de3ef4f9b9b6e05973907eb Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 9 Sep 2019 15:28:27 +0200 Subject: [PATCH] Optimize join_chat code --- pyrogram/client/methods/chats/join_chat.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/pyrogram/client/methods/chats/join_chat.py b/pyrogram/client/methods/chats/join_chat.py index c1dd923a..45d35b48 100644 --- a/pyrogram/client/methods/chats/join_chat.py +++ b/pyrogram/client/methods/chats/join_chat.py @@ -58,20 +58,9 @@ class JoinChat(BaseClient): elif isinstance(chat.chats[0], types.Channel): return pyrogram.Chat._parse_channel_chat(self, chat.chats[0]) else: - resolved_peer = self.send( - functions.contacts.ResolveUsername( - username=chat_id.lower().strip("@") - ) - ) - - channel = types.InputPeerChannel( - channel_id=resolved_peer.chats[0].id, - access_hash=resolved_peer.chats[0].access_hash - ) - chat = self.send( functions.channels.JoinChannel( - channel=channel + channel=self.resolve_peer(chat_id) ) )