Skip to main content

Paid subscription to a group or channel

In this tutorial we will talk about how to create a Paid Subscription for your group or channel using the @MenuBuilderBot constructor.

This manual is intended for people who DO NOT know the constructor, so it will describe in detail all the stages of organizing a Paid Subscription. Those who are familiar with the basic functions of the constructor can directly refer to the Paid Subscription chapter of the «Groups» section.

❖ How it works

The bot you created is added to the group as an admin. In the bot itself, using a button with two Actions, a mechanism for paying for a subscription (tariff) and saving the end date are created. The subscription expiration time for each user is stored in a special variable you created. Once a day, your bot (system) will check the time in this variable and remove from the group those users whose subscription time has already expired or notify those whose time will soon expire. You, as the creator, pay for the Paid Subscription feature using  Tokens of Functions directly at  the moment of verifying users in the group (50,000 Tokens of Functions are available MONTHLY to each bot. This is enough for a group of approximately 160 people for a month).

You need to understand that the creation of all functionality is done by the constructor, using the mechanisms and functions already available in the constructor. For beginners, this may seem difficult and in some ways, at the initial stage, perhaps it is really more difficult than creating similar functionality on specialized bots. However, at the same time, the tool that you use and, accordingly, the functionality that you will create as a result, these are much more flexible, easy-to-manage projects that will be under your full control. In addition, later, not if, but WHEN, you have new ideas, you can easily add additional functions to your project, a huge number of which are already available in the constructor and for this you will not need to look for a programmer or look for another a specialized tool - everything will already be at hand.

❖ Creating a bot

To create paid subscription functionality, you will need a bot created on the @MenuBuilderBot platform, this will allow your bot to interact with the system functions of the constructor.

If you already have a bot created and connected to the @MenuBuilderBot platform, then simply skip this step.

INFO: For more information on how to create your first bot, see the link:
https://docs.menubuilder.cc/books/1-beginners-guide/page/how-to-create-your-first-bot

Acquiring functionality


All necessary functionality can be purchased in advance or purchased as needed during the creation of individual functions. The functionality described in this manual will be sufficient to create the Paid Subscription itself and one tariff for paying for it. Each new tariff, in its basic form, will require two additional Actions. All other functionality is common to the entire Paid Subscription project.

For those who are completely unfamiliar with the @MenuBuilderBot project, we note that in our project we prefer NOT to charge an aggregate monthly payment using one or two tariffs for functions that you will never use. Moreover, there is so much functionality in the constructor that the monthly fee would be simply huge. Instead, we provide the opportunity to pay only for the functionality that you really need. Moreover, in 99% of cases, this functionality is paid ONCE and is used for as long as your bot or account exists. There is barely any functionality, in the project, that is paid monthly. Therefore, at the beginning, activating new functions may seem unnecessarily confusing to you, but later you will appreciate this approach.

Sequence of actions:
 1. Top up your Account's Balance
2. Exchange funds for the internal TMH token
3. Connect the necessary functions for TMH.

INFO: For more information about WALLETS for your Account, see the link:
https://docs.menubuilder.cc/books/1-beginners-guide/page/account-wallets

INFO: For more information about how to REPLENISH your Account Balance, see the link:
https://docs.menubuilder.cc/books/1-beginners-guide/page/how-to-top-up-your-account-balance

INFO: For more information on how to exchange the internal TMH TOKEN, see the link:
https://docs.menubuilder.cc/books/ 1-rukovodstvo-novichka/page/kak-obmenyat-kupit-tmh

INFO: For more information on how to PURCHASE functionality, see the link:
https://docs.menubuilder.cc/books/1-beginners-guide/page/how-to-exchange-buy-tmh

You will need:

1. Group tokens (any amount to start with)
☞ 🔐Admin | 🧩Extensions | 📂Channels & Groups

2. Variable (1 piece) (we assume that payment will be made from the Balance, which is already available to everyone)
☞ 🔐Admin | 🧩Extensions | 📂Variables

3. Conditions (plugin)
☞ 🔐Admin | 🧩Extensions | 📂Buttons

4. Macros and expressions for buttons
☞ 🔐Admin | 🧩Extensions | 📂Buttons

5. Actions (2 pieces)
☞ 🔐Admin | 🧩Extensions | 📂Actions

❖ Creating a Date and Time variable

We need the variable to store the end time of the subscription for each user, so the Paid Subscription function could check this value every day. The Paid Subscription function itself (see below) is enabled when you specify this variable in its settings.

Purely technically, the variable can be set later, but for the purposes of this Tutorial we will set it now, which in the future will allow us to more consistently configure the functionality of the group without being distracted by variables.

Sequence of actions:
1. Go to the Admin panel of your bot:
☞ 🔐Admin | 🗄Variables | 📕Time
2. Create a variable by giving it a name

You can choose the name of the variable yourself and then use it in your settings; we’ll call it date_var.

INFO: For more information on how to CREATE A VARIABLE, see the link:
https://docs.menubuilder.cc/books/5-functions-manuals/page/variables

❖ Adding a bot to the group

As part of creation of the functionality of a Paid Subscription in a group, your bot will be engaged in, firstly, accepting or rejecting join requests, and secondly, deleting users whose subscription has expired.

In addition to the above functions, a bot in a group can also perform other duties - see the Group manual for all the bot’s capabilities.

IMPORTANT: you need to understand that the bot in the group “sees”, or rather knows about the existence, only those users whom it personally permitted into the group using the «Accept Join Requests» functionality. Accordingly, if there are already users in your group, then the bot cannot see the “old” users who were in the group before the functionality for accepting requests was enabled. Ideally, the creation of Paid Subscription functionality should be carried out for a new group - in which there are no users.

If you have a Group and not a Channel, then with varying degrees of probability you can remove old users from the group using the «Kick by Activity» option, when setting up the removal (Kick) of a user from the group (see below).

Sequence of actions:
1. Set up a group to accept join applications
2. Find out the group's ID
3. Connect and ( ! ) activate the group in the bot (Group Tokens will be required)
4. Only after this - add the bot itself to the group (otherwise the bot will leave it)

GROUP SETUP - for the presented functionality to work, you will need:
• A public Group
• The “Requests to join” option is enabled.
To enable the “Requests to join” option, go to your PUBLIC group:
Group settings > Group type > Approve new members

IMPORTANT: For more information on HOW BOTS WORK IN GROUPS, see the link:
https://docs.menubuilder.cc/books/5-functions-manuals/page/groups-general-info

INFO: For more information on how to ADD A BOT TO A GROUP, see the link:
https://docs.menubuilder.cc/books/5-functions-manuals/page/how-to-add-setup-and-delete-group

❖ Setting up a Paid Subscription in the bot

Now that your group is activated in the bot, and the bot itself is added to the group, you need to configure the bot’s behavior in the group so that the bot knows what it will do there. The minimum required settings for checking a subscription in a group are:
• Accepting requests
• Paid subscription

Sequence of actions:
1. Go to the group settings in the bot Administrator:
☞ 🔐Админ | 🧫Каналы и Группы
2. Select the group you added
3. Set up the “User Management” section (Receiving requests and Paid subscription)

You will need to enable the “Accept Requests” option, as well as provide all the necessary data for the “Paid Subscription” option.

INFO: For more information about the settings of the USER MANAGEMENT section, see the link:
https://docs.menubuilder.cc/books/5-rukovodstva-po-funktsiyam/page/modul-upravleniia-iuzerami

❖ Create a paid subscription tariff in the bot menu

From an interface point of view, there can be a large number of options for presenting tariffs to the user:
• Command in the bot's command menu
• Message with a command
• Message with an inline button
• Bottom menu button.

In this guide, we will limit ourselves to describing the basic principles of creating a tariff, and you will be able to decorate the payment process for the user individually - once you get comfortable with working with the constructor. One way or another, the basis of any functionality is always organized through the buttons in the bottom menu. This is what we will do - we will create a payment option through the buttons in the bottom menu of the bot.

If your project has only one Tariff, then you can directly create one button. If there are several tariffs, it may make sense to combine them within one sub-menu.

INFO: For more information about CREATING BUTTONS, see the link:
https://docs.menubuilder.cc/books/2-basic-functions/page/how-to-add-a-button

INFO: For more information about creating a SUB-MENU, see the link: 
https://docs.menubuilder.cc/books/2-basic-functions/page/how-to-create-a-button-inside-a-button-sub-menu

1.1 Create a button for the user to purchase the desired tariff.

1.2 Place a Condition on the button that will check whether there are enough funds on the user’s Balance.
For example: {%balance% >= 100} (100 is the cost)

INFO: For more information about the user’s BALANCE in the bot, see the link:
https://docs.menubuilder.cc/books/5-functions-manuals/page/balance-and-variables-editor

INFO: For more information about the CONDITIONS, see the link:
https://docs.menubuilder.cc/books/5-functions-manuals/page/conditions

1.3 Put a Command on the button
For example: /sub (with the «Move by Command» parameter)

INFO: For more information about COMMANDS, see the link: 
https://docs.menubuilder.cc/books/5-functions-manuals/page/commands

This command can be specified in the “message about the end of the subscription” or in the “message about removal from the group (Kick)” so that the user is automatically transferred or can immediately get to the Tariff renewal menu.

If you have one tariff, then the command can be assigned to the tariff button itself; if your tariffs are combined in one sub-menu, then the command must be assigned to the parent button.

1.4 In the button itself, add «Action of Numbers» which will debit the amount you specified in the Conditions from the Balance.

INFO: For more information about ACTIONS, see the link: 
https://docs.menubuilder.cc/books/5-functions-manuals/chapter/actions

1.5 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 created earlier.
For example:
Action {dt_add("%date_var%", 1, "m")}

Using one month as an example, the constructor naturally allows you to set any duration from a few seconds to several years.

INFO: For more information about EXPRESSIONS, see the link:
https://docs.menubuilder.cc/books/5-functions-manuals/page/expressions

By default (if the user has not previously interacted with your bot), or if he was removed from the group (Kick), the variable when accessed will show the System time "now". Therefore, any purchase of time according to the tariff will be counted either from the time “now”, or from the one that is ALREADY stored in a variable, which will allow you to pay for the Tariff before it expires - adding time. If the user was removed from the group, the variable will be deinitialized and, accordingly, will return the time “now” again.

1.6 Add a message that shows the new subscription date.

For example:

📆 New subscription date: %date_var%.

This completes the creation of the basic form of your first paid Tariff.

By analogy, you can then create various tariffs, including a FREE DEMO TARIFF. In the free tariff, instead of debiting funds from the Balance, you will need to create a separate Numeric Variable, and when activating the Tariff, set it to the value “1” - this will mean that the user has already received one free demo mode. In this case, you will need to put a condition on the button itself which checks that your numeric variable is equal to zero (not equal to one). With such mechanics, for example, you can provide a free tariff several times - increasing the value in the variable... It makes no sense to describe all possible options.

❖ Creating a Balance and replenishing the Balance

In its minimal form, Balance is a button with a message in which you, using the Variable Macros, show the state of the variable balance and at least one way to replenish it.

You can top-up your balance manually or automatically.

Manually (it's free) - through any of your local or international payment systems. To do this, you can create a Form of any complexity you need.

Automatic replenishment methods are presented in the «Guide on Automatic Payments» (there are free methods and paid ones).

You need to understand that the Balance can be replenished by distributing bonuses, creating various clickers and similar things. In addition, it can be awarded manually for some actions in the group - here you will have complete freedom. Study tutorials and manuals, ask in technical support groups.