add_chat_members()¶
- Client.add_chat_members()¶
Add new chat members to a group, supergroup or channel.
Usable by Users Bots
- 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:¶
List of :obj:`~pyrogram.types.Message` | :obj:`~pyrogram.types.Message` | ``bool`` (On success, a service message will be returned (when applicable),)
otherwise, in case a message object couldn’t be returned, True is returned.
Example
# 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)