mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 20:59:29 +00:00
Add bound methods block and unblock to User object
This commit is contained in:
parent
485877daa3
commit
856870c195
@ -214,3 +214,38 @@ class User(Object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
return self._client.unarchive_chats(self.id)
|
return self._client.unarchive_chats(self.id)
|
||||||
|
|
||||||
|
|
||||||
|
def block(self):
|
||||||
|
"""Bound method *block* of :obj:`User`.
|
||||||
|
Use as a shortcut for:
|
||||||
|
.. code-block:: python
|
||||||
|
client.block_user(123456789)
|
||||||
|
Example:
|
||||||
|
.. code-block:: python
|
||||||
|
user.block()
|
||||||
|
Returns:
|
||||||
|
True on success.
|
||||||
|
Raises:
|
||||||
|
RPCError: In case of a Telegram RPC error.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self._client.block_user(self.id)
|
||||||
|
|
||||||
|
|
||||||
|
def unblock(self):
|
||||||
|
"""Bound method *unblock* of :obj:`User`.
|
||||||
|
Use as a shortcut for:
|
||||||
|
.. code-block:: python
|
||||||
|
client.unblock_user(123456789)
|
||||||
|
Example:
|
||||||
|
.. code-block:: python
|
||||||
|
user.unblock()
|
||||||
|
Returns:
|
||||||
|
True on success.
|
||||||
|
Raises:
|
||||||
|
RPCError: In case of a Telegram RPC error.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self._client.unblock_user(self.id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user