U
    ;g@                     @   s2   d dl mZ d dlZd dlmZ G dd dZdS )    )UnionN)rawc                   @   s2   e Zd Zdeeef eeef eedddZdS )SetAdministratorTitlezpyrogram.Client)selfchat_iduser_idtitlereturnc                    s   |  |I dH }|  |I dH }| tjjj||dI dH j}t|tjj	rZtj
 }nt|tjjrp|j}ntd| tjjj||||dI dH  dS )ao  Set a custom title (rank) to an administrator of a supergroup.

        If you are an administrator of a supergroup (i.e. not the owner), you can only set the title of other
        administrators who have been promoted by you. If you are the owner, you can change every administrator's title.

        .. 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).

            title (``str``, *optional*):
                A custom title that will be shown to all members instead of "Owner" or "Admin".
                Pass None or "" (empty string) to remove the custom title.

        Returns:
            ``bool``: True on success.

        Example:
            .. code-block:: python

                await app.set_administrator_title(chat_id, user_id, "Admin Title")
        N)channelparticipantzLCustom titles can only be applied to owners or administrators of supergroups)r
   r   admin_rightsZrankT)Zresolve_peerZinvoker   Z	functionsZchannelsZGetParticipantr   
isinstancetypesZChannelParticipantCreatorZChatAdminRightsZChannelParticipantAdminr   
ValueErrorZ	EditAdmin)r   r   r   r   rr    r   n/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/chats/set_administrator_title.pyset_administrator_title   s,    !
	z-SetAdministratorTitle.set_administrator_titleN)__name__
__module____qualname__r   intstrboolr   r   r   r   r   r      s   

r   )typingr   Zpyrogramr   r   r   r   r   r   <module>   s   