
    N[i
                     8    d dl mZ d dlZd dlmZ  G d d      Zy)    )UnionN)rawc                   .    e Zd Zdddeeef   dedefdZy)SetChatTitleselfzpyrogram.Clientchat_idtitlereturnc                   K   | j                  |       d{   }t        |t        j                  j                        rM| j                  t        j                  j                  j                  |j                  |             d{    yt        |t        j                  j                        rC| j                  t        j                  j                  j                  ||             d{    yt        d| d      7 7 }7 w)al  Change the title of a chat.
        Titles can't be changed for private chats.
        You must be an administrator in the chat for this to work and must have the appropriate admin rights.

        Note:
            In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
            setting is off.

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

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target chat.

            title (``str``):
                New chat title, 1-255 characters.

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

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

        Example:
            .. code-block:: python

                await app.set_chat_title(chat_id, "New Title")
        N)r   r	   )channelr	   zThe chat_id "z" belongs to a userT)resolve_peer
isinstancer   typesInputPeerChatinvoke	functionsmessagesEditChatTitler   InputPeerChannelchannels	EditTitle
ValueError)r   r   r	   peers       X/var/www/files/kim/lib/python3.12/site-packages/pyrogram/methods/chats/set_chat_title.pyset_chat_titlezSetChatTitle.set_chat_title   s     B &&w//dCII334++&&44 LL 5      cii889++&&00  1     }WI5HIJJ# 0s5   D	DA/D	DA&D	.D/D	D	D	N)__name__
__module____qualname__r   intstrboolr        r   r   r      s3    44sCx4 4 
	4r#   r   )typingr   pyrogramr   r   r"   r#   r   <module>r&      s   &   5 5r#   