unban_chat_member()

Client.unban_chat_member()

Unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. You must be an administrator for this to work.

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. You can also use chat public link in form of t.me/<username> (str).

  • user_id (int | str) – Unique identifier (int) or username (str) of the target user. For a contact that exists in your Telegram address book you can use his phone number (str).

Returns:

bool – True on success.

Example

# Unban chat member right now
await app.unban_chat_member(chat_id, user_id)