o
    -˜Žj�  ã                   @   sJ   d dl mZ d dlZd dlmZ d dlmZ d dlmZ G dd„ dƒZdS )é    )ÚUnionN)Úraw)Útypes)Úutilsc                   @   s.   e Zd Zdddeeef ded fdd„ZdS )	ÚGetChatÚselfzpyrogram.ClientÚchat_idÚreturn)z
types.Chatztypes.ChatPreviewc                 Ã   sB  �| j  t|ƒ¡}|rP|  tjjj| d¡d�¡I dH }t	|tj
jƒr*t
j | |¡S |  |jg¡I dH  t	|jtj
jƒrA|jj }t	|jtj
jƒrPt |jj¡}|  |¡I dH }t	|tj
jƒrn|  tjjj|d�¡I dH }n)t	|tj
jtj
jfƒrˆ|  tjjj|d�¡I dH }n|  tjjj|jd�¡I dH }t
j | |¡I dH S )a”  Get up to date information about a chat.

        Information include current name of the user for one-on-one conversations, current username of a user, group or
        channel, etc.

        .. include:: /_includes/usable-by/users-bots.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/* or *t.me/<username>* link link,
                identifier (int) or username of the target channel/supergroup (in the format @username).
                You can also use chat public link in form of *t.me/<username>* (str).

        Returns:
            :obj:`~pyrogram.types.Chat` | :obj:`~pyrogram.types.ChatPreview`: On success, if you've already joined the chat, a chat object is returned,
            otherwise, a chat preview object is returned.

        Raises:
            ValueError: In case the chat invite link points to a chat you haven't joined yet.

        Example:
            .. code-block:: python

                chat = await app.get_chat("pyrogram")
                print(chat)
        é   )ÚhashN)Úchannel)Úid)r   ) ÚINVITE_LINK_REÚmatchÚstrÚinvoker   Ú	functionsÚmessagesÚCheckChatInviteÚgroupÚ
isinstancer   Ú
ChatInviteÚChatPreviewÚ_parseÚfetch_peersÚchatÚChatr   ÚChannelr   Úget_channel_idÚresolve_peerÚInputPeerChannelÚchannelsÚGetFullChannelÚInputPeerUserÚInputPeerSelfÚusersÚGetFullUserÚGetFullChatr   Ú_parse_full)r   r   r   ÚrÚpeer© r+   ú\/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/chats/get_chat.pyÚget_chat   s,   €ÿ
ÿ
zGetChat.get_chatN)Ú__name__Ú
__module__Ú__qualname__r   Úintr   r-   r+   r+   r+   r,   r      s    ÿ
þýr   )Útypingr   Úpyrogramr   r   r   r   r+   r+   r+   r,   Ú<module>   s   