block_user()#

Client.block_user()#

Block a user.

Usable by Users Bots
Parameters:
  • user_id (int | str) – Unique identifier (int) or username (str) of the target user. For you yourself you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use their phone number (str).

  • my_stories_from (bool, optional) – Whether the peer should be added to the story blocklist; if not set, the peer will be added to the main blocklist.

Returns:

bool – True on success

Example

await app.block_user(user_id)