o
    -˜ŽjÚ  ã                   @   s6   d dl mZ d dlZd dlmZmZ G dd„ dƒZdS )é    )ÚUnionN)ÚrawÚutilsc                
   @   s:   e Zd Zdddeeef deeef dedef
dd„Zd	S )
ÚTransferChatOwnershipÚselfzpyrogram.ClientÚchat_idÚuser_idÚpasswordÚreturnc                 Ã   s’   �|   |¡I dH }|   |¡I dH }t|tjjƒstdƒ‚t|tjjƒs'tdƒ‚|  tjj	j
||t |  tjj ¡ ¡I dH |¡d�¡I dH }t|ƒS )a†  Transfer the owner of a chat or channel to another user.

        .. note:

            Requires owner privileges.

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

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target chat.
                Unique identifier for the target chat in form of a *t.me/joinchat/* link, identifier (int) or username
                of the target channel/supergroup (in the format @username).

            user_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the new owner.
                For a contact that exists in your Telegram address book you can use his phone number (str).

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

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

        Raises:
            ValueError: In case of invalid parameters.
            RPCError: In case of a Telegram RPC error.

        Example:
            .. code-block:: python

                await app.transfer_chat_ownership(chat_id, user_id, "password")
        Nz0The chat_id must belong to a channel/supergroup.z"The user_id must belong to a user.)Úchannelr   r	   )Úresolve_peerÚ
isinstancer   ÚtypesÚInputPeerChannelÚ
ValueErrorÚInputPeerUserÚinvokeÚ	functionsÚchannelsÚEditCreatorr   Úcompute_password_checkÚaccountÚGetPasswordÚbool)r   r   r   r	   Úpeer_channelÚ	peer_userÚr© r   úk/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/chats/transfer_chat_ownership.pyÚtransfer_chat_ownership   s"   €'ÿý
ÿ
z-TransferChatOwnership.transfer_chat_ownershipN)Ú__name__Ú
__module__Ú__qualname__r   ÚintÚstrr   r   r   r   r   r   r      s    ÿ
þ
ýüûr   )Útypingr   Úpyrogramr   r   r   r   r   r   r   Ú<module>   s   