Skip to main content

Commands

The @MenuBuilderBot constructor allows you to interact with your bot using commands. Commands are assigned to the lower menu buttons, allowing them to be used on their own, as well as for creation of inline keyboards.


What commands are


In Telegram, commands are like "shortcuts" for some functions. Command syntax in Telegram is: any Latin word starting with "/" (slash). Numbers and "_" underscores are allowed.
For example: /command, /command1, /command_1

All messages in your bot should be bound to some button in the lower menu. Thus, to display the message, the user must press the appropriate button. Any button of the lower menu in your bot, @MenuBuilderBot allows to assign a command.

Any command must be associated with particular button of the lower menu. When the user sends a command, the bot shows him all the messages assigned to the corresponding button or activates the functions added to the button. The inline keyboard (in command mode), in turn, is associated with the particular button of the lower menu through its command.

Thus, the commands in @MenuBuilderBot, basically, is a way to remotely click on the buttons of the lower menu, which allows you to create bots without a lower menu at all, or use an inline keyboard with commands to interact with the user.

Some functions have their own commands - these commands are listed in the manuals for the respective functions. For example: Guide on Variables, Guide on Captcha, QnA chat Guide, Turbo Mode and others.

Summarizing all above: Any command you create in @MenuBuilderBot must be bound to some button in the lower menu. You can call this command (thereby referring to the content or functionality of the button) by sending this command directly to the bot, or by creating an inline button with this command.


❖ Bot's system commands


Bot's system commands are commands that are not binded to individual functions, they work at the level of the bot itself and refer to its functionality, properties or settings.

Like any other commands, they are sent directly to the chat with the bot. In general, a Command consists of a Name, Parameters and Arguments. This means that the command can contain additional parameters such as Telegram ID or UserCode of the user, as well as arguments such as text or numbers.

A list of system commands available initially for everyone can be found in the Basic Functions manual.


Buttons commands management


How to add a command to a button

To manage commands go to the "Button Editor":


e6de08ad297c26c565a0e.jpg


Specify the desired button by clicking it and open the Button Settings (✱):


1e751456ed92141eb11fe.jpg


Click on "Assign Command" button:


d97e8f5e6bd9a52bd2cb1.jpg


You will get a command assignment interface:


20d13eb1643a257215ec1.jpg


If a command has already been assigned to this button, you will see it here in the message (1).

To create a new command, write it in the text field (2) and send it as a message to the bot.

The command must begin with the “/” (Slash) character and can only contain:
• Latin letters
• Numbers
• The “_” (underscore) character.

For example:
/help
/message5
/buy_01

We want to draw your attention to the fact that, purely technically, you can add the SAME commands to two different buttons, while the bot will show an unambiguous warning. If after that you still decide to leave a duplicate, then only one of the buttons will work on command (most likely the one located higher in the bot's menu). Therefore, if your bot somehow reacts incorrectly to the command, check if you have two identical commands for different buttons. To see the structure of your menu, you can using, for example, special command from the List of System Commands.

So, the check for duplication of command, when adding a new one, is not carried out... There are several reasons for this type of behavior.
1. Firstly, these are not our problems 🤪.
2. Carrying out a check will complicate the mechanics of copying buttons (especially if an entire menu branch is copied).
3. Sometimes it happened that we create a new button and assign our command to it, and only then delete the old one with the same command. This behavior will be more convenient than undoing everything that was done in order to first delete the command in another button, and then return to the new one again.

If the command sent to the bot is correct, you will see a confirmation message:


f624c97d8b238f0308510.jpg


By default, commands are only displaying the messages of its button. If, in addition to displaying the messages by command, you need to transfer your user to the corresponding menu, switch the "Move by command" setting. The current state of the transition settings is displayed on the button itself. If active, your user will be transferred to the menu of the button whose command he send to the bot.


f229b7fc9454d87c2e0fc.jpg


To delete a created command, use the "Delete Command" button.

To confirm the creation of the command, click "Confirm".

Click "Cancel" if you change your mind to add or modify an existing command.


8876de86ba5d9cc6c63be.jpg


To complete the creation of the command, click "Confirm" and exit the "Button Editor". To use the command, just send it to the bot:


6a3f8fe5c9092bd732569.jpg


How to remove a command

Deleting a command is carried out in the same menu as adding. See above for a description of the process.


That's all about command assignment and management in @MenuBuilderBot, see a little more information below.


❖ If commands don't work


If your bot does not respond to the /start command, or gives an error when entering any other command, check if you are using custom fonts. Sometimes the characters in custom fonts do not correspond to the characters of the Latin alphabet. In the example below, the /start command is sent using custom fonts:

IMG_20221201_221529.jpg

Enter commands ONLY using an English keyboard.


 Additional information


How to create an inline bot?

The constructor allows you to create bots without a lower menu - controlled only by commands or an inline keyboard. As of now, @MenuBuilderBot has no way to add commands without lower buttons. There are 2 ways to hide command's buttons.

Learn more about creating inline buttons.

Method 1:

Switch the button to “Admin Only” mode. This will hide the button from users, however, it will make it impossible to utilize “Move by command” option and navigate through such a menu using commands. Since such a button and all its menus will be “admin only” and therefore forbidden for the user. However, the messages of such a button can still be displayed via command. See here: "How to make a button visible only to admins?"

Method 2:

Make your button Invisible. This will also hide it from users, however, unlike the admin buttons, navigating through such a menu using commands will remain possible, besides, "invisible" buttons can be hidden from admins too. Read more about “Invisible Buttons” in the help bot.


9e72380ded71d3733f203.jpg


If you need a lot of admin buttons, create one admin button and add buttons with commands inside of it. All internal buttons will inherit this attribute and will also be hidden for the user (does not work for "Invisible" buttons).


How can I see the menu structure and all the button commands?

Use the command:
/showmenu - allows you to see all existing commands and find buttons containing them.



Just send this command to your bot to see the entire structure of its menu.


How to create a Command Menu and add Buttons to your Bot Profile

Telegram allows you to create a custom menu for Bot Commands. In addition, separate buttons can be added to the bot’s profile for functions such as «Help» and «Settings».

 

Screenshot_2024_01_16_13_55_39_311_org_telegram_messenger_edit.jpg

 

Screenshot_2024_01_16_13_57_21_530_org_telegram_messenger_edit.jpg

 

See the section «BotFather - features and functionality» for details.