Skip to content

Commit

Permalink
Merge pull request #274 from kalmengr/patch-1
Browse files Browse the repository at this point in the history
Add bound methods block and unblock to User object
  • Loading branch information
delivrance committed Jul 9, 2019
2 parents 485877d + 92d47f1 commit eff2285
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions pyrogram/client/types/user_and_chats/user.py
Expand Up @@ -214,3 +214,51 @@ def unarchive(self):
"""

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)

0 comments on commit eff2285

Please sign in to comment.