toggle_chat_username()

async Client.toggle_chat_username()

Activate or deactivate a collectible username on a channel or supergroup.

Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target channel or supergroup.

  • username (str) – The username to toggle.

  • active (bool) – Whether to activate (True) or deactivate (False) the username.

Returns:

bool – True on success.

Example

await app.toggle_chat_username(chat_id, "myusername", True)