add_chat_members()

Client.add_chat_members()

Add new chat members to a group, supergroup or channel. This method can’t be used to join a chat. Members can’t be added to a channel if it has more than 200 members.

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 FailedToAddMember – On success, an empty list is returned, otherwise a list of FailedToAddMember 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)