o
    -˜Žj™	  ã                   @   s6   d dl mZmZ d dlZd dlmZ G dd„ dƒZdS )é    )ÚUnionÚOptionalN)Úrawc                   @   s2   e Zd Zdddeeef dee defdd„ZdS )	ÚSetChatUsernameÚselfzpyrogram.ClientÚchat_idÚusernameÚreturnc                 Ã   sV   �|   |¡I dH }t|tjjƒr#t|  tjjj	||pdd�¡I dH ƒS t
d|› d�ƒ‚)aD  Set a channel or a supergroup username.

        To set your own username (for users only, not bots) you can use :meth:`~pyrogram.Client.set_username`.

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

        Parameters:
            chat_id (``int`` | ``str``)
                Unique identifier (int) or username (str) of the target chat.
                You can also use chat public link in form of *t.me/<username>* (str).

            username (``str`` | ``None``):
                Username to set. Pass "" (empty string) or None to remove the username.

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

        Raises:
            ValueError: In case a chat id belongs to a user or chat.

        Example:
            .. code-block:: python

                await app.set_chat_username(chat_id, "new_username")
        NÚ )Úchannelr   zThe chat_id "z" belongs to a user or chat)Úresolve_peerÚ
isinstancer   ÚtypesÚInputPeerChannelÚboolÚinvokeÚ	functionsÚchannelsÚUpdateUsernameÚ
ValueError)r   r   r   Úpeer© r   úe/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/chats/set_chat_username.pyÚset_chat_username   s   €þÿÿ	z!SetChatUsername.set_chat_usernameN)	Ú__name__Ú
__module__Ú__qualname__r   ÚintÚstrr   r   r   r   r   r   r   r      s    ÿ
þýür   )Útypingr   r   Úpyrogramr   r   r   r   r   r   Ú<module>   s   