B
    fd                 @   s2   d dl mZ d dlZd dlmZ G dd dZdS )    )UnionN)rawc               @   s&   e Zd Zdeeef edddZdS )GetChatMembersCountzpyrogram.Client)selfchat_idreturnc                s   |  |I dH }t|tjjrJ| tjjj|j	gdI dH }|j
d jS t|tjjr|| tjjj|dI dH }|jjS td| ddS )a+  Get the number of members in a chat.

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

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

        Returns:
            ``int``: On success, the chat members count is returned.

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

        Example:
            .. code-block:: python

                count = await app.get_chat_members_count(chat_id)
                print(count)
        N)idr   )ZchannelzThe chat_id "z" belongs to a user)Zresolve_peer
isinstancer   typesZInputPeerChatZinvokeZ	functionsmessagesZGetChatsr   ZchatsZparticipants_countZInputPeerChannelZchannelsZGetFullChannelZ	full_chat
ValueError)r   r   Zpeerr r   Q/tmp/pip-unpacked-wheel-rcokkf2l/pyrogram/methods/chats/get_chat_members_count.pyget_chat_members_count   s    z*GetChatMembersCount.get_chat_members_countN)__name__
__module____qualname__r   intstrr   r   r   r   r   r      s   
r   )typingr   Zpyrogramr   r   r   r   r   r   <module>   s   