Skip to content

Commit aaf0e82

Browse files
committed
Optimize join_chat code
1 parent 80c7a6e commit aaf0e82

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

pyrogram/client/methods/chats/join_chat.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,9 @@ def join_chat(
5858
elif isinstance(chat.chats[0], types.Channel):
5959
return pyrogram.Chat._parse_channel_chat(self, chat.chats[0])
6060
else:
61-
resolved_peer = self.send(
62-
functions.contacts.ResolveUsername(
63-
username=chat_id.lower().strip("@")
64-
)
65-
)
66-
67-
channel = types.InputPeerChannel(
68-
channel_id=resolved_peer.chats[0].id,
69-
access_hash=resolved_peer.chats[0].access_hash
70-
)
71-
7261
chat = self.send(
7362
functions.channels.JoinChannel(
74-
channel=channel
63+
channel=self.resolve_peer(chat_id)
7564
)
7665
)
7766

0 commit comments

Comments
 (0)