mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-01 13:14:52 +00:00
Optimize join_chat code
This commit is contained in:
parent
80c7a6e988
commit
aaf0e82cdf
1 changed files with 1 additions and 12 deletions
|
|
@ -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 a new issue