2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 13:27:47 +00:00

Fix Chat.join

The bound method will only be able to make users join public chats that
have set a username.
This commit is contained in:
Dan 2019-07-11 14:42:18 +02:00
parent 3c4a8f0da4
commit 5599182fd1

View File

@ -386,7 +386,6 @@ class Chat(Object):
description=description description=description
) )
def set_photo(self, photo: str) -> bool: def set_photo(self, photo: str) -> bool:
"""Bound method *set_photo* of :obj:`Chat`. """Bound method *set_photo* of :obj:`Chat`.
@ -688,6 +687,9 @@ class Chat(Object):
chat.join() chat.join()
Note:
This only works for public groups and channels that have set a username.
Returns: Returns:
:obj:`Chat`: On success, a chat object is returned. :obj:`Chat`: On success, a chat object is returned.
@ -695,7 +697,7 @@ class Chat(Object):
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """
return self._client.join_chat(self.id) return self._client.join_chat(self.username)
def leave(self): def leave(self):
"""Bound method *leave* of :obj:`Chat`. """Bound method *leave* of :obj:`Chat`.
@ -716,4 +718,3 @@ class Chat(Object):
""" """
return self._client.leave_chat(self.id) return self._client.leave_chat(self.id)