transfer_chat_ownership()

Client.transfer_chat_ownership()

Transfer the owner of a chat or channel to another user.

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. Unique identifier for the target chat in form of a t.me/joinchat/ link, identifier (int) or username of the target channel/supergroup (in the format @username).

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

  • password (str) – The 2-step verification password of the current user.

Returns:

bool – True on success.

Raises:
  • ValueError – In case of invalid parameters.

  • RPCError – In case of a Telegram RPC error.

Example

await app.transfer_chat_ownership(chat_id, user_id, "password")