mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 20:59:29 +00:00
Optimize join_chat code
This commit is contained in:
parent
80c7a6e988
commit
aaf0e82cdf
@ -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)
|
||||
)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user