Blog and knowledge base of the service

What is the condition block in the Telegram Bot-Market bot constructor?

The condition block is a block that allows you to redirect the logic of the chain in different directions. In total, it has two output directions. It directs to "success" in case of success or to "fail" in case of failure to check the conditions inside the block.


There can be several logical conditions in the condition block, each condition is checked in turn. The number of conditions depends on the bot's tariff.

What is the condition block in the Telegram Bot-Market bot constructor?

How do I add a block of conditions in the Bot Market constructor?

General provisions of the Terms and Conditions block

This unit has two operating modes:


  1. "AND" - check all conditions inside the block.


  1. "OR" - check for at least one success in the conditions.

For example, you will set 3 conditions for checking channel subscription in telegram. With the logical operator "AND". This means that it will be sent to the "success" chain only if the user subscribes to all three channels. If you switch to "OR", then the "success" chain will direct the user if he subscribes to at least one channel.


The number of conditions is expanded depending on the connected components.

After the condition is met, new constants are formed:


  1. These constants contain the result of fulfilling the condition and technical data.


  1. For example, the verification condition for subscribing to a chat or channel will contain the user's status and a ChatMember array with information about the user.


If at least one condition causes an error, an entry about it will appear in the log. And the whole chain will be stopped.

General provisions of the Terms and Conditions block-1

Setting up a bot's whiteboard in the Bot-Market


Setting up a bot's whiteboard in the Bot-Market-1

How to add a condition block:


  1. Click on the "+" in the upper-right corner of the selected workboard.


  1. Selecting the conditions block


  1. Click on the "Add" button


Parameters of the condition block


Parameters of the condition block-1

The condition block in the Telegram bot is used to control the logic of the bot's operation and make decisions based on incoming data, i.e. checking the fulfillment of a condition.


The following settings can be set for the condition block:


  1. Checking the user's presence in the chat or channel


  1. Checking for the "float" constant


  1. Checking the contents of the constantly "row"


  1. Checking the value of the "Bool" constant


DEBUG mode

Enabling Debug mode for developers

Debug is a special mode of operation of the telegram bot, which allows developers to find and fix errors (bugs) in the logic of the bot, allowing them to track every action performed.


To enable DEBUG mode, you must:


1. Go to the "Bot Settings" tab


2. Change the status of the bot from "ON" to "Debug"


Enabling Debug mode for developers-1

Important! When the Debug Mode is enabled, the bot becomes unavailable to bot users, the mode is intended only for administrators!

Basic log entries in Debug mode


Basic log entries in Debug mode-1

In the "DEBUG" mode, full debugging of all intermediate states is enabled.


1. When the condition group starts working, the log will contain an entry: "Condition next item run, ItemId: {NUMBER}", which shows which condition was checked.


2. Then a check entry for "OR/AND" will appear – "All conditions OR/AND".


3. If a condition is found for verification, the "Detect condition" entry will appear.


4. If a condition is called, an entry with its initialization "Init: Condition {DESCRIPTION}" will appear.


5. Then write "Params" with the current parameter values for the condition.


6. Then write "Constants generate" with the generated constants.


7. Next, the following condition is checked and so on until they run out or there is success.