U
    ;g                     @   s:   d dl mZ d dlZd dlmZmZmZ G dd dZdS )    )UnionN)rawtypeserrorsc                   @   s4   e Zd Zddeeef eeef dedddZdS )PromoteChatMemberNzpyrogram.Clientztypes.ChatPrivileges)selfchat_iduser_id
privilegesreturnc                    s   |  |I dH }|  |I dH }|dkr0t }z$| tjjj||dI dH j}W n t	j
k
rn   d}Y nX d}t|tjjr|j}| tjjj||tjj|j|j|j|j|j|j|j|j|j|j|jd|pddI dH  dS )a  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.

        .. include:: /_includes/usable-by/users-bots.rst

        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:
            ``bool``: True on success.

        Example:
            .. code-block:: python

                # Promote chat member to admin
                await app.promote_chat_member(chat_id, user_id)
        N)channelparticipant)Z	anonymousZchange_infoZpost_messagesZedit_messagesZdelete_messagesZ	ban_usersZinvite_usersZpin_messagesZ
add_adminsZmanage_callother )r   r	   Zadmin_rightsrankT)Zresolve_peerr   ZChatPrivilegesZinvoker   Z	functionsZchannelsZGetParticipantr   r   ZRPCError
isinstanceZChannelParticipantAdminr   Z	EditAdminZChatAdminRightsZis_anonymousZcan_change_infoZcan_post_messagesZcan_edit_messagesZcan_delete_messagesZcan_restrict_membersZcan_invite_usersZcan_pin_messagesZcan_promote_membersZcan_manage_video_chatsZcan_manage_chat)r   r   r	   r
   Zraw_chat_memberr    r   j/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/chats/promote_chat_member.pypromote_chat_member   sJ    !

z%PromoteChatMember.promote_chat_member)N)__name__
__module____qualname__r   intstrboolr   r   r   r   r   r      s    

r   )typingr   Zpyrogramr   r   r   r   r   r   r   r   <module>   s   