U
    ;g
                     @   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                   @   s0   e Zd Zdeeef eeef ddddZdS )GetChatMemberzpyrogram.Clientztypes.ChatMember)selfchat_iduser_idreturnc           
         s:  |  |I dH }|  |I dH }t|tjjr| tjjj|j	dI dH }t
|jjdg }dd |jD }|D ]L}tj| ||i }t|tjjr|jjr|  S qp|jj|jkrp|  S qptnrt|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
dS )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.

            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).

        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   s   i | ]}|j |qS  id.0ir   r   f/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/chats/get_chat_member.py
<dictcomp>B   s      z1GetChatMember.get_chat_member.<locals>.<dictcomp>)Zchannelparticipantc                 S   s   i | ]}|j |qS r   r   r   r   r   r   r   W   s      c                 S   s   i | ]}|j |qS r   r   r   r   r   r   r   X   s      zThe chat_id "z" belongs to a user)Zresolve_peer
isinstancer   r   ZInputPeerChatZinvokeZ	functionsmessagesZGetFullChatr   getattrZ	full_chatr   usersZ
ChatMember_parseZInputPeerSelfuserZis_selfr   r	   r   ZInputPeerChannelZchannelsZGetParticipantchatsr   
ValueError)
r   r   r	   Zchatr   rmembersr   memberr   r   r   r   get_chat_member   s:    



zGetChatMember.get_chat_memberN)__name__
__module____qualname__r   intstrr    r   r   r   r   r      s
   

r   )typingr   Zpyrogramr   r   Zpyrogram.errorsr   r   r   r   r   r   <module>   s
   