promote_chat_member()

Client.promote_chat_member()

Promote or demote a user in a supergroup or a channel.

You must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user.

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 target user. For a contact that exists in your Telegram address book you can use his phone number (str).

  • privileges (:obj:`~pyrogram.types.ChatPrivileges`, *optional*) – New user privileges.

Returns:

  • :obj:`~pyrogram.types.Message` | ``bool`` (On success, a service message will be returned (when applicable),)

  • otherwise, in case a message object couldn’t be returned, True is returned.

Example

# Promote chat member to admin
await app.promote_chat_member(chat_id, user_id)