Skip to content

Commit 5599182

Browse files
committed
Fix Chat.join
The bound method will only be able to make users join public chats that have set a username.
1 parent 3c4a8f0 commit 5599182

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • pyrogram/client/types/user_and_chats

pyrogram/client/types/user_and_chats/chat.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@ def set_description(self, description: str) -> bool:
386386
description=description
387387
)
388388

389-
390389
def set_photo(self, photo: str) -> bool:
391390
"""Bound method *set_photo* of :obj:`Chat`.
392391
@@ -688,14 +687,17 @@ def join(self):
688687
689688
chat.join()
690689
690+
Note:
691+
This only works for public groups and channels that have set a username.
692+
691693
Returns:
692694
:obj:`Chat`: On success, a chat object is returned.
693695
694696
Raises:
695697
RPCError: In case of a Telegram RPC error.
696698
"""
697699

698-
return self._client.join_chat(self.id)
700+
return self._client.join_chat(self.username)
699701

700702
def leave(self):
701703
"""Bound method *leave* of :obj:`Chat`.
@@ -716,4 +718,3 @@ def leave(self):
716718
"""
717719

718720
return self._client.leave_chat(self.id)
719-

0 commit comments

Comments
 (0)