Basic information about helpers

You can create templates and check their work in Handlebars Sandbox.

You can do a lot of other things with the help of variables. For example, you can sort, add, multiply, divide, subtract and select them according to certain conditions.

To make work with variables possible, there are various helper functions in Botmother.

Botmother uses Handlebars templates "engine". This means that almost everything you can do with it you can do in Botmother. However, there are almost invisible, small differences, since Handlebars was created primarily for web pages. And, in this sense, templates are any text that contains variables or helpers.

Helpers are small helpers that can do something with our variables. There are two types of helpers: block and string helpers.

Block helpers look like this:

{{#helper variable1 variable2 variableN}}
Any text or variables
{{/helper}}

They start with line #helper-name, that is the beginning of the block, and end with line /helper-name, that is the end of the block.

This construction creates a semantic block. Helper has the beginning, the end, a body with text and variables, that's why it is called block helper.

Block helpers are usually used to show a text depending on certain conditions. Do not worry, only theory is not clear, in practice you will get everything.

String helpers are much simpler:

{{helper variable1 variable2 variableN}}

They are similar to variables. If you are familiar with any programming language, and you know what functions are, you will notice that string helpers are very similar to them. String helpers have a helper name and they also can have some variables with which they can do something.

For example, this is how to get a random number in a variable:

{{random 00000 99999999}}

A random number between the first (00000) and the second (99999999) will be written to the variable.

To the beginning ↑