2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-09-05 16:55:20 +00:00

Add .archive() and .unarchive() bound methods to Chat

This commit is contained in:
Dan
2019-06-08 19:25:57 +02:00
parent 9b12e823b4
commit 6e3d8ca20b
2 changed files with 59 additions and 0 deletions

View File

@@ -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)