diff --git a/docs/source/api/bound-methods.rst b/docs/source/api/bound-methods.rst index ac348d03..d01a4383 100644 --- a/docs/source/api/bound-methods.rst +++ b/docs/source/api/bound-methods.rst @@ -68,6 +68,15 @@ Chat - :meth:`~Chat.archive` - :meth:`~Chat.unarchive` +User +^^^^ + +.. hlist:: + :columns: 2 + + - :meth:`~User.archive` + - :meth:`~User.unarchive` + CallbackQuery ^^^^^^^^^^^^^ @@ -122,6 +131,10 @@ Details .. automethod:: Chat.archive() .. automethod:: Chat.unarchive() +.. User +.. automethod:: User.archive() +.. automethod:: User.unarchive() + .. CallbackQuery .. automethod:: CallbackQuery.answer() diff --git a/pyrogram/client/types/user_and_chats/user.py b/pyrogram/client/types/user_and_chats/user.py index 50dd8361..05877b63 100644 --- a/pyrogram/client/types/user_and_chats/user.py +++ b/pyrogram/client/types/user_and_chats/user.py @@ -160,3 +160,49 @@ class User(Object): restriction_reason=user.restriction_reason, client=client ) + + def archive(self): + """Bound method *archive* of :obj:`User`. + + Use as a shortcut for: + + .. code-block:: python + + client.archive_chats(123456789) + + Example: + .. code-block:: python + + user.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:`User`. + + Use as a shortcut for: + + .. code-block:: python + + client.unarchive_chats(123456789) + + Example: + .. code-block:: python + + user.unarchive() + + Returns: + True on success. + + Raises: + RPCError: In case of a Telegram RPC error. + """ + + return self._client.unarchive_chats(self.id)