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)ÚUserNotParticipantc                   @   s6   e Zd Zdddeeef deeef ddfdd„Zd	S )
ÚGetChatMemberÚselfzpyrogram.ClientÚchat_idÚuser_idÚreturnztypes.ChatMemberc           
      Ã   s4  �|   |¡I dH }|   |¡I dH }t|tjjƒrb|  tjjj|j	d�¡I dH }t
|jjdg ƒ}dd„ |jD ƒ}|D ]&}tj | ||i ¡}t|tjjƒrT|jjrS|  S q9|jj|jkr_|  S q9t‚t|tjjƒr’|  tjjj||d�¡I dH }dd„ |jD ƒ}dd„ |jD ƒ}	tj | |j||	¡S td	|› d
�ƒ‚)aÍ  Get information about one member of a chat.

        .. include:: /_includes/usable-by/users-bots.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).

            user_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target user.
                For you yourself you can simply use "me" or "self".
                For a contact that exists in your Telegram address book you can use his phone number (str).
                You can also use user profile link in form of *t.me/<username>* (str).

        Returns:
            :obj:`~pyrogram.types.ChatMember`: On success, a chat member is returned.

        Example:
            .. code-block:: python

                member = await app.get_chat_member(chat_id, "me")
                print(member)
        N)r   Úparticipantsc                 S   ó   i | ]}|j |“qS © ©Úid©Ú.0Úir   r   úc/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/chats/get_chat_member.pyÚ
<dictcomp>E   ó    z1GetChatMember.get_chat_member.<locals>.<dictcomp>)ÚchannelÚparticipantc                 S   r   r   r   r   r   r   r   r   Y   r   c                 S   r   r   r   r   r   r   r   r   Z   r   zThe chat_id "z" belongs to a user)Úresolve_peerÚ
isinstancer   r   ÚInputPeerChatÚinvokeÚ	functionsÚmessagesÚGetFullChatr   ÚgetattrÚ	full_chatr   ÚusersÚ
ChatMemberÚ_parseÚInputPeerSelfÚuserÚis_selfr   r	   r   ÚInputPeerChannelÚchannelsÚGetParticipantÚchatsr   Ú
ValueError)
r   r   r	   Úchatr%   ÚrÚmembersr!   Úmemberr*   r   r   r   Úget_chat_member   s@   €ÿ
ÿÿÿþ
ÿzGetChatMember.get_chat_memberN)Ú__name__Ú
__module__Ú__qualname__r   ÚintÚstrr0   r   r   r   r   r      s    ÿ
þ
ýür   )Útypingr   Úpyrogramr   r   Úpyrogram.errorsr   r   r   r   r   r   Ú<module>   s   