Botmother has helpers for all basic mathematical operations. All math heplers are linear.


You need helper "add" to add two numbers together:

{{add variable1 variable2}}

As in block helpers, in linear ones you can specify not only variables, but also literal values:

{{add 5 100}}

105 will be sent in a message.

If you need to add several numbers or variables, you can use helper "sum":

{{sum var1 var2 var3}}

It sums variable var1, variable var2 and variable var3.


We use helper "subtract" to subtract one number from another.

{{subtract variable1 variable2}}


We can use helper "multiply" to multiply one number by another:

{{multiply variable1 variable2}}


We can use helper "divide" to divide one number by another:

{{divide variable1 variable2}}


To round the resulting numbers to two decimal places, use component Assign a variable. Write value "var" in the final variable:

{{toRub variable}}

Where "variable" is the variable obtained after calculations.

You can also use Assign a variable component to round the resulting numbers to a specified number of decimal places. In the final variable, write the value:

{{toFixed 1.1234 2}}

Where 2 is the number of digits that should remain after the decimal point, and 1.1234 is the number in which you need to reduce the number of digits after the decimal point. Instead of a number, there may be a variable in which the number had been previously written, for example {{toFixed var2}}

If you need to create a variable with a fractional number after the dot, use helper:

{{toFixedRub variable ','}}

You can use the following helpers to round to an integer:

  • floor - always rounds down;
  • ceil - always rounds up;
  • round - rounds according to the rules of mathematics


{{variable 5.6}}
{{floor variable}}

As a result, the value of the variable will be rounded to 5.

Number module

Here is how you can calculate the number module (if the number is negative, delete the minus, if the number is positive, don’t change it):

{{abs number}}

where number is a variable with a number.

To the beginning ↑