From 5599182fd192e3c29494c3778dc3f95c9f019548 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 11 Jul 2019 14:42:18 +0200 Subject: [PATCH] Fix Chat.join The bound method will only be able to make users join public chats that have set a username. --- pyrogram/client/types/user_and_chats/chat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyrogram/client/types/user_and_chats/chat.py b/pyrogram/client/types/user_and_chats/chat.py index ee8aacb8..cac5d0c7 100644 --- a/pyrogram/client/types/user_and_chats/chat.py +++ b/pyrogram/client/types/user_and_chats/chat.py @@ -386,7 +386,6 @@ class Chat(Object): description=description ) - def set_photo(self, photo: str) -> bool: """Bound method *set_photo* of :obj:`Chat`. @@ -688,6 +687,9 @@ class Chat(Object): chat.join() + Note: + This only works for public groups and channels that have set a username. + Returns: :obj:`Chat`: On success, a chat object is returned. @@ -695,7 +697,7 @@ class Chat(Object): 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): """Bound method *leave* of :obj:`Chat`. @@ -716,4 +718,3 @@ class Chat(Object): """ return self._client.leave_chat(self.id) -