mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 12:57:52 +00:00
Add join and leave methods to Chat object
This commit is contained in:
parent
6a62d1b8c4
commit
be8d1068c0
@ -673,3 +673,51 @@ class Chat(Object):
|
|||||||
can_pin_messages=can_pin_messages,
|
can_pin_messages=can_pin_messages,
|
||||||
can_promote_members=can_promote_members
|
can_promote_members=can_promote_members
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def join(self):
|
||||||
|
"""Bound method *join* of :obj:`Chat`.
|
||||||
|
|
||||||
|
Use as a shortcut for:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
client.join_chat(123456789)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
chat.join()
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
:obj:`Chat`: On success, a chat object is returned.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
RPCError: In case of a Telegram RPC error.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self._client.join_chat(self.id)
|
||||||
|
|
||||||
|
|
||||||
|
def leave(self):
|
||||||
|
"""Bound method *leave* of :obj:`Chat`.
|
||||||
|
|
||||||
|
Use as a shortcut for:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
client.leave_chat(123456789)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
chat.leave()
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
RPCError: In case of a Telegram RPC error.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self._client.leave_chat(self.id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user