U
    ;g$                     @   s6   d dl mZmZ d dlZd dlmZ G dd dZdS )    )UnionListN)rawc                	   @   sH   e Zd Zddeeef eeeef eeeef  f eedddZdS )AddChatMembersd   zpyrogram.Client)selfchat_iduser_idsforward_limitreturnc                    s     |I dH }t|ts |g}t|tjjrh|D ]2} tjjj	|j
  |I dH |dI dH  q2n2 tjjj| fdd|D I dH dI dH  dS )aY  Add new chat members to a group, supergroup or channel

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

        Parameters:
            chat_id (``int`` | ``str``):
                The group, supergroup or channel id

            user_ids (``int`` | ``str`` | List of ``int`` or ``str``):
                Users to add in the chat
                You can pass an ID (int), username (str) or phone number (str).
                Multiple users can be added by passing a list of IDs, usernames or phone numbers.

            forward_limit (``int``, *optional*):
                How many of the latest messages you want to forward to the new members. Pass 0 to forward none of them.
                Only applicable to basic groups (the argument is ignored for supergroups or channels).
                Defaults to 100 (max amount).

        Returns:
            ``bool``: On success, True is returned.

        Example:
            .. code-block:: python

                # Add one member to a group or channel
                await app.add_chat_members(chat_id, user_id)

                # Add multiple members to a group or channel
                await app.add_chat_members(chat_id, [user_id1, user_id2, user_id3])

                # Change forward_limit (for basic groups only)
                await app.add_chat_members(chat_id, user_id, forward_limit=25)
        N)r   user_idZ	fwd_limitc                    s   g | ]}  |I d H qS )N)resolve_peer).0r   r    g/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/chats/add_chat_members.py
<listcomp>S   s   z3AddChatMembers.add_chat_members.<locals>.<listcomp>)ZchannelZusersT)r   
isinstancelistr   typesZInputPeerChatZinvokeZ	functionsmessagesZAddChatUserr   ZchannelsZInviteToChannel)r   r   r	   r
   Zpeerr   r   r   r   add_chat_members   s*    '




zAddChatMembers.add_chat_membersN)r   )	__name__
__module____qualname__r   intstrr   boolr   r   r   r   r   r      s    
r   )typingr   r   Zpyrogramr   r   r   r   r   r   <module>   s   