mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-09 00:14:50 +00:00
Merge pull request #275 from kalmengr/patch-2
Add join and leave bound methods to Chat object
This commit is contained in:
commit
3c4a8f0da4
1 changed files with 44 additions and 0 deletions
|
|
@ -673,3 +673,47 @@ 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…
Reference in a new issue