update_chat_username()

Client.update_chat_username()

Update a channel or a supergroup username.

To update your own username (for users only, not bots) you can use update_username().

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

  • username (str | None) – Username to set. Pass “” (empty string) or None to remove the username.

Returns

bool – True on success.

Raises

ValueError – In case a chat id belongs to a user or chat.

Example

app.update_chat_username(chat_id, "new_username")