transfer_chat_ownership()

Client.transfer_chat_ownership()

Changes the owner of a chat.

Requires owner privileges in the chat. Available only for supergroups and channel chats.

Usable by Users Bots
Parameters:
  • chat_id (``int`` | ``str``) – Unique identifier (int) or username (str) of the target chat.

  • user_id (``int`` | ``str``) – Unique identifier (int) or username (str) of the new owner. The ownership can’t be transferred to a bot or to a deleted user.

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

Returns:

``bool`` (True on success.)

Raises:
  • ValueError – In case of invalid parameters.:

  • RPCError –

Example

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