update_username()

Client.update_username()

Update your own username.

This method only works for users, not bots. Bot usernames must be changed via Bot Support or by recreating them from scratch using BotFather. To update a channel or supergroup username you can use update_chat_username().

Parameters

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

Returns

bool – True on success.

Example

app.update_username("new_username")