Add .archive() and .unarchive() bound methods to Chat
This commit is contained in:
parent
9b12e823b4
commit
6e3d8ca20b
@ -59,6 +59,15 @@ Message
|
||||
- :meth:`~Message.reply_video_note`
|
||||
- :meth:`~Message.reply_voice`
|
||||
|
||||
Chat
|
||||
^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 2
|
||||
|
||||
- :meth:`~Chat.archive`
|
||||
- :meth:`~Chat.unarchive`
|
||||
|
||||
CallbackQuery
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
@ -109,6 +118,10 @@ Details
|
||||
.. automethod:: Message.reply_video_note()
|
||||
.. automethod:: Message.reply_voice()
|
||||
|
||||
.. Chat
|
||||
.. automethod:: Chat.archive()
|
||||
.. automethod:: Chat.unarchive()
|
||||
|
||||
.. CallbackQuery
|
||||
.. automethod:: CallbackQuery.answer()
|
||||
|
||||
|
@ -257,3 +257,49 @@ class Chat(Object):
|
||||
return Chat._parse_user_chat(client, chat)
|
||||
else:
|
||||
return Chat._parse_channel_chat(client, chat)
|
||||
|
||||
def archive(self):
|
||||
"""Bound method *archive* of :obj:`Chat`.
|
||||
|
||||
Use as a shortcut for:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
client.archive_chats(-100123456789)
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
chat.archive()
|
||||
|
||||
Returns:
|
||||
True on success.
|
||||
|
||||
Raises:
|
||||
RPCError: In case of a Telegram RPC error.
|
||||
"""
|
||||
|
||||
return self._client.archive_chats(self.id)
|
||||
|
||||
def unarchive(self):
|
||||
"""Bound method *unarchive* of :obj:`Chat`.
|
||||
|
||||
Use as a shortcut for:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
client.unarchive_chats(-100123456789)
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
chat.unarchive()
|
||||
|
||||
Returns:
|
||||
True on success.
|
||||
|
||||
Raises:
|
||||
RPCError: In case of a Telegram RPC error.
|
||||
"""
|
||||
|
||||
return self._client.unarchive_chats(self.id)
|
||||
|
Loading…
Reference in New Issue
Block a user