Action: force chat join¶
Use this action to force a user to join one or more channels or groups, the bot must be an administrator of the channels or groups to which the join will be forced.
The number of actions you can have simultaneously per bot, and the channels and groups to which you force joining per action, depend on your current subscription in VisualMaker.
Options of the action:¶
- Set chats: The channels or groups in which to check if the user is a member, separated by commas. You can use expressions, variables, and IDs of previous actions to dynamically check chats.
-
Other user (optional): User to verify if they are a member of the specified chats. If not specified, it will verify the user who executed the action. You can use expressions, variables, and IDs of previous actions to dynamically set users.
-
Set chats to join: The channels or groups to force the user to join, separated by commas.
- Force another user (optional): User to force to join, if not specified, the user who executed the action will be forced.
- Message if not joined (optional): Message to show to the user if they have not joined the required channels or groups, if not set a default message will be displayed.
What does the action return through its ID? (advanced)¶
By forcing the user to join chats, you also obtain some data that might be of interest to you. Access them through the chat number, in the order it was saved, with the format #IDAction.chat(num)#
, replace IDAction
with the ID of this action, and (num)
with the number of the chat to verify, according to the order in which it was saved, for example, if you saved two channels separated by comma: @channel_of_cats, @channel_of_dogs
, access the user's status in @channel_of_cats
through #IDaction.chat1.status#
, and from @channel_of_dogs
through #IDaction.chat2.status#
. Don't forget to replace actionID
with the ID of this action.
Understanding the above, there is a lot of information you can obtain about the user's membership in the verified chat.
Parameters that can be obtained¶
- status: The user's status in the verified chat, which can be
member
,administrator
,owner
,left
,banned
, orrestricted
. - joined_date: Date when the user joined the chat.
- invited_by: ID of the user who invited the user to the chat via an invitation link.
- promoted_by: If the user is an administrator of the chat, ID of the administrator who promoted them.
- restricted_by: If the user is restricted or banned, ID of the administrator who restricted or banned them.
- until_date: If the user is restricted or banned, until what date.
- can_be_edited: Returns
True
if the user is allowed to edit the user's admin privileges, otherwise returnsFalse
. - privileges: Only if the user is an administrator or owner. Privileged actions that the user, as an administrator, can perform.
- permissions: Only if the user is restricted or banned. Restricted actions that the user, if not an administrator, can perform.
Obtain user privileges¶
- privileges.can_manage_chat: Returns
True
if the user can access chat events log, chat statistics, channel message statistics, see channel members, view anonymous admins in groups, and ignore slow mode. Includes any other admin privilege. Otherwise returnsFalse
. - privileges.can_delete_messages: Returns
True
if the user can delete messages from other users, otherwise returnsFalse
. - privileges.can_manage_video_chats: Only for groups. Returns
True
if the admin can manage videochats (also known as group calls), otherwise returnsFalse
. - privileges.can_restrict_members: Returns
True
if the user can restrict, ban, or unban chat members, otherwise returnsFalse
. - privileges.can_promote_members: Returns
True
if the user can add new admins with a subset of their own privileges or demote admins they have promoted, directly or indirectly (promoted by admins appointed by the user), otherwise returnsFalse
. - privileges.can_change_info: Returns
True
if the user can change the chat title, photo, and other settings, otherwise returnsFalse
. - privileges.can_post_messages: Only for channels. Returns
True
if the user can post messages in the channel, otherwise returnsFalse
. - privileges.can_edit_messages: Only for channels. Returns
True
if the user can edit messages from other users, otherwise returnsFalse
. - privileges.can_invite_users: Returns
True
if the user can invite new users to the chat, otherwise returnsFalse
. - privileges.can_pin_messages: Only for groups. Returns
True
if the user can pin messages, otherwise returnsFalse
. - privileges.is_anonymous: Returns
True
if the user is hidden in the chat, otherwise returnsFalse
.
Obtain user permissions¶
- permissions.can_send_messages: Returns
True
if the user is allowed to send text messages, contacts, locations, and venues, otherwise returnsFalse
. - permissions.can_send_media_messages: Returns
True
if the user is allowed to send audios, documents, photos, videos, video notes, and voice notes. Includescan_send_messages
. Otherwise returnsFalse
. - permissions.can_send_other_messages: Returns
True
if the user can send animations, games, stickers, and use inline bots. Includescan_send_media_messages
. Otherwise returnsFalse
. - permissions.can_send_polls: Returns
True
if the user is permitted to send polls. Includescan_send_messages
. Otherwise returnsFalse
. - permissions.can_add_web_page_previews: Returns
True
if the user can add web page previews to their messages. Includescan_send_media_messages
. Otherwise returnsFalse
. - permissions.can_change_info: Returns
True
if the user can change the chat title, photo, and other settings. Ignored in public groups. Otherwise returnsFalse
. - permissions.can_invite_users: Returns
True
if the user can invite new users to the chat, otherwise returnsFalse
. - permissions.can_pin_messages: Returns
True
if the user can pin messages. Ignored in public groups. Otherwise returnsFalse
.
Guide
Need an example? We have a detailed guide where we walk you through step by step on how to require users to join certain channels when starting the bot, and only after joining can they continue. To view it click here.