Skip to main content

Module of user management

The section contains all the tools for managing the users of your group - both - new ones and those already present in the group.

For the presented functionality to work, you will need a GROUP or CHANNEL with the «APPROVE NEW MEMBERS» option enabled.

How to enable new members approval for group or channel:
1. PUBLIC GROUP can be enabled directly in the settings - go to:
Group Settings > Group type > Approve new members
2. PRIVATE GROUP - via a separate link - go to:
Group Settings > Group Type > Manage Invite Links > Create a New Link
Enable the «Request Admin Approval» option for this link.
3. PUBLIC CHANNEL - cannot be turned on.
4. PRIVATE CHANNEL - via a separate link - go to:
Group Settings > Group Type > Manage Invite Links > Create a New Link
Enable the «Request Admin Approval» option for this link.

Accept Join Requests

When enabled, the bot will automatically accept join requests («Approve new members» setting) in groups that are set to require "Join Requests" to be sent before the user can join the group. 
Modes:
Off ⏹️ - function disabled.
On ▶️ - function is enabled.

Joining Condition

Allows you to assign a Condition that a user must meet in order to be accepted to the group (so that his request to join will be accepted by the bot automatically).

For example, the Condition may be the presence of the required number of referrals or the presence of Balance in the bot.

The presence of this setting in the interface will depend on whether the extension is active:
Condition for Join Request.
To connect, go to your bot:
☞ 🔐Admin | 🧩Extensions | 📂Groups

You will need to: 
• Enter the Condition itself (based on the bot's data).
 • (MANDATORY) Add an Error Message (will be shown in the bot itself)

In the Error Message, you must inform your user what Conditions he must meet to join the group, as well as indicate where and how he must go to fulfill these Conditions in the bot.

Optionally, you can place a Command in the menu section - where exactly this condition can be fulfilled - to make it easier for the user to find the place and perform it itself.

Paid Subscription

The function allows you to remove from a group, those users, whose subscription to the group has expired. And also warn them about the expiration of the prepaid subscription to the group. When you remove a user from a group, the bot can call the command you specified.

The verification of Paid Subscription and the actual Kicking of users performed at night (during hours of minimal activity) according to system time (+3 UTC). This is due to the fact that such verifications are quite resource-consuming procedures.

For the presented functionality to work, you MUST have:
• Public Group (without it you cannot enable the following parameter).
• Enabled “Approve new members” option.
Group Settings > Group type > Approve new members
Checking a paid subscription through the “Approval” is the most reliable way, because with 100% certainty, technically, it cannot be guaranteed that the bot will not miss an illegal entry via a link without having an Approval enabled.

ATTENTION: the function consumes 10 "Tokens of Functions" per verification of one user. Payment is made at each check, according to the number of users with Date and Time data saved in the variable specified in the function settings. After Kick from the group, the user variable is cleared (deinitialized).

The feature will initially use 50000 free monthly Tokens (which will approximately allow you to verify a group of 160 users).


Set Date Variable

Specify a Variable (Date and Time) that stores the end date of the user’s group “prepaid subscription”.
Delete the variable, previously specified here, to disable the Paid Subscription function itself.

You write the data stored in the variable yourself using the constructor's functionality, creating in the bot the interface you need and under the conditions you need - the bot only compares the current date with the one YOU have saved in the variable.

Set Error Message

Here you need to set a message that will be shown to the user in the bot if he tries to access a paid group without paying for his stay in it. In the message, add instructions that will allow the user to pay for the subscription.

For example:

❗️ To join the group you need to buy a subscription.
ℹ️ Press the command /sub

Where: /sub is the command of the menu section where you have collected all existing Paid Subscription Tariffs.

Set Warning

Set a Warning Message the user will see near the end of the subscription period and the period itself - how long (in days) to start warning the user.

For example:

❗️ Your subscription expires in %kickdays% days.
📆 Date: %date_var%

Where: kickdays is a local macros for the number of days remaining, and date_var is the data in your variable.

If you used the System Time of the dt_now() function to save data into a variable, but your bot’s time zone is not +3UTC, then in the message it is better to use the local kickdate macros to display the subscription end date (it takes into account the bot’s time zone).

Set Kick

1. Kick by Activity - this option allows you to remove “old” users from the group (those who came to the group before Paid Subscription was activated in it), the only way available for this is by tracking users activity in the group. If a user who is illegally in a group writes a message in it, the bot will mark this event, and the actual removal of the user from the group will occur at night during a general verification of users for by Paid Subscription function.

Technically, a bot (this is how Telegram works) cannot see all users of a group, so there is no more or less simple way to remove “old” users from a group (there are only complex ones). The “by activity” method of deletion does not provide a 100% guarantee, since only those users who have somehow shown themselves in the group (for example, sent a message) will be noticed by the bot. The method is based on the fact that the user DOES NOT KNOW what caused his deletion - therefore, so that the user cannot associate his actions with removal from the group, the deletion does NOT occur IMMEDIATELY, but at night - along with everyone else.

2.1 Set a message informing the user about Kik from the Group after the Paid Subscription period expires.

For example:

❌ Your subscription has ended.
ℹ️ Buy a new subscription.

2.2 OPTIONALLY. Specify a command that will be called when a user is kicked out of a group.

Using this command you can call the functions you need or perform the actions you need (for example, transfer the user to the menu for purchasing a new Paid Subscription)

• • •

An approximate mechanism for organizing a Paid Subscription Tariff in a bot :
0. We believe that your bot has already been added to the public group and is an admin in it.
1. Create a date and time variable.

For example: date_var
 2. Create a button for the user to purchase the desired Tariff.
2.1 Place a Condition on the button that will check whether there are enough funds on the user’s Balance.
For example: {%balance% >= 100} (this is the cost)
2.2 Place a Command on the button (this command can be indicated in the message about the end of the subscription or in the message about removal from the group (kick))
For example: /sub (with «Move by Command» opiton)
2.3 In the button itself, add «Action of Numbers» which will debit the amount you specified from the Balance. 
2.4 Add a second «Action of Numbers» that will set a date one month greater than what is written in the Date and Time variable you have created before.
For example:
Action 
{dt_add("%date_var%", 1, "m")}
2.5 Add a message that shows the new subscription date.
For example: New subscription date: %date_var%.

A detailed guide to creating a Paid Subscription.

Message After Joining

The message added here will be shown to the user who (by sending a join request) has successfully joined the chat. In this case, the user will be shown a button to (re)start the bot.

IMPORTANT: This message will be shown to the user if all other checks have already been passed (or are missing) and the user is accepted to the group.

This message is OPTIONAL and not necessarily has to be used.
You can use a picture in this message.
Delete the previously added message so that the bot stops contacting new users.

INFO: There is no single scenario or application context for this message. For example, in the absence of additional checks (when the bot simply automatically confirms all joining requests), this message will be shown to a NEW user - the content of this message may be appropriate to the context of a “new user” - for example, a description of the benefits of becoming a bot user. If the bot contains any additional checks, for example, «Joining Condition» or «Paid Subscription», in this case it must be assumed that the user is ALREADY a user of the bot, to one degree or another understanding of this fact - therefore the content of the message, in theory, should be different from the one shown to a new user, in addition, it makes sense to show this message if, after passing all the the checks in your scenario, the user (for some reason) still did not get access to the bot's menu, or you want to force him to be transferred to the Main Menu. 

 Therefore, in order to consciously use this function, it is important to understand the core mechanics of its operation.

 MECHANICS OF OPERATION: The bot has the ability to send a message to users who have sent a request to join the chat (where the bot is an administrator), even if the user has never interacted with this bot before. At the same time, in the lower menu the user will see a button to join the bot, after clicking on which he will be in the Main Menu of the bot, (in general) becoming its user. Initially, this message was intended as a welcome message for new users, however, with the advent of additional verification functions, its operation became less obvious and more complex.

 IMPORTANT: The user account will NOT automatically become a bot user by only receiving this message. The user will either have to launch the bot independently and consciously, using the button shown by the bot in the bottom menu, or previously in some way - send a Message or Command to the bot. Adding a user to the bot automatically is IMPOSSIBLE (it was not possible, it is not possible now and it will not be possible in the future, neither for a fee, nor if it is "really necessary", but for ETHICAL reasons).

❖ General sequence of functions

For a better understanding of the mechanics of the functions of this section, you need to keep in mind the following points:

1. The only condition for the functionality of this section to work is that the «Accept Join Requests» option is enabled. Without turning it on, other functions will not work.

2. The functions are not interconnected and have their own separate settings that do not affect each other.

3. This functionality is triggered when the user sends a request to join the group - with each such request, the bot checks the settings of the functions of this section and ALL active functions being completely validated AGAIN (all their conditions must be met).

4. The functions have a certain sequence of operation relative to each other:
- When requesting to join, we check whether the «Accept Join Requests» function is enabled (if it is NOT enabled, no further checks are performed).
- Check whether the «Joining Condition» is set. We carry out checks and display error messages if necessary (specified by you or the system default one).
- Check whether the «Paid Subscription» function is active. We carry out checks and display error messages if necessary (specified by you or the system default one).
- Check whether the «Message After Joining» is set. If specified, display it in the bot.

IMPORTANT: When creating User Management functionality in a group (in particular when adding «Joining Condition» or «Paid Subscription»), it is important to understand that the constructor allows your bot to also have ITS OWN user verification conditions, such as «Captcha», «Subscription to the Channel», «Entry only by Ref. link», «Availability of Username», etc. At the same time, the work of all these checks can give rise to difficult-to-predict interactions. In particular, checks of the bot itself can (and most often will) INTERRUPT the linear scenario of checking for a user to join a group. Therefore, test your settings and think through all possible scenarios IN ADVANCE, have an idea in which section of the menu the user will be at each stage of its check. In general, it is recommended to disable bot checks if you use the functions of the group's User Management, or think through your messages so that the user can clearly understand what he is doing at each moment, AND ALSO have the opportunity to move on to the next stage after completing the previous one.

❖ Error messages

❌ Your request to join the Group or Channel has not been confirmed.
Subscription to this Group or Channel has joining Conditions or Paid Subscription.
ℹ️ Contact the project administrator to find out the Join Conditions.

This system default message is for the user, designed in the most neutral style. The message indicates that you (as the creator of the bot), forgot to indicate an "Error Message" either in the Joining Condition or in the Paid Subscription. Set necessary messages and your bot will show them instead of default.