
    N[i                     @    d dl mZ d dlZd dlmZmZmZ  G d d      Zy)    )UnionN)rawtypeserrorsc                   @    e Zd Z	 d
dddeeef   deeef   dddef
d	Zy)PromoteChatMemberNselfzpyrogram.Clientchat_iduser_id
privilegesztypes.ChatPrivilegesreturnc                   K   | j                  |       d{   }| j                  |       d{   }|t        j                         }	 | j                  t        j
                  j                  j                  ||             d{   j                  }d}t        |t        j                  j                        r|j                  }| j                  t        j
                  j                  j                  ||t        j                  j                  |j                   |j"                  |j$                  |j&                  |j(                  |j*                  |j,                  |j.                  |j0                  |j2                  |j4                        |xs d             d{    y7 7 |7 &# t        j                  $ r d}Y 2w xY w7 *w)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)	anonymouschange_infopost_messagesedit_messagesdelete_messages	ban_usersinvite_userspin_messages
add_adminsmanage_callother )r   r   admin_rightsrankT)resolve_peerr   ChatPrivilegesinvoker   	functionschannelsGetParticipantr   r   RPCError
isinstanceChannelParticipantAdminr   	EditAdminChatAdminRightsis_anonymouscan_change_infocan_post_messagescan_edit_messagescan_delete_messagescan_restrict_memberscan_invite_userscan_pin_messagescan_promote_memberscan_manage_video_chatscan_manage_chat)r	   r
   r   r   raw_chat_memberr   s         ]/var/www/files/kim/lib/python3.12/site-packages/pyrogram/methods/chats/promote_chat_member.pypromote_chat_memberz%PromoteChatMember.promote_chat_member   s    B ))'22))'22 --/J	#%)[[&&55# ' 6 &  
 {  osyy'H'HI"''DkkMM"",, YY66(55 * : :",">">",">">$.$B$B(==!+!<!<!+!<!<)== * A A$44 7  ZR! - 
 	
 	
* U 32   	#"O	#	
sb   GF)GF,G=F2 	F/
F2 DG#G$G,G/F2 2GG
GG)N)__name__
__module____qualname__r   intstrboolr7        r6   r   r      sP    
 .2	KKsCxK sCxK +	K
 
Kr?   r   )typingr   pyrogramr   r   r   r   r>   r?   r6   <module>rB      s   &   ' 'L Lr?   