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 or chat/channel public linkuser_ids (
int
|str
| List ofint
orstr
) – 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. You can also use user profile link in form of t.me/<username> (str).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
# 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)