Examples of conditions in the feedback Forms
The data that users enter in the feedback forms can be checked using the Conditions (for example, addresses of crypto wallets).
❖ Acquiring of functionality
All functionality is purchased IN YOUR BOT, for this go to your bot:☞ 🔐Admin | 🧩Extensions
IMPORTANT: The purchase of functionality for the bot is available only to the Creator (owner) of the bot. Admins CANNOT buy functionality!
You will need:
In order to be able to use the Conditions in the Feedback Forms, the following Extensions must be enabled in your bot:
1. Conditions in Forms
☞ 🔐Admin | 🧩Extensions | 📂Forms
❖ Checking for "@" at the beginning
Required knowledge:
● How to create a feedback form.
● Input of a variable by the user.
● Expressions and the startswith() function.
TASK: Suppose the user must enter his social network address starting with "@
". The data entered by the user is stored in a variable %text_var%
.
Example of Condition:{startswith("%text_var%", "@")}
The Condition will check, that the text stored in the variable, begins with an "@" sign.
TASK: Let's say you want the user to send you the name of their social network account WITHOUT the initial "@
".
Example of Condition:{startswith("%text_var%", "@") == False}
The Condition will check that the text, stored in the variable, does NOT start with the "@" sign.
❖ ETH (Ethereum) address verification
Required knowledge:
● How to create a feedback form.
● Input of a variable by the user.
● Expressions and the startswith() function.
● Expressions and the len() function.
● Syntax of Conditions.
TASK: Let's say the user must enter his Ethereum (ETH) wallet address. The addresses of this network must start with the characters "0x
" and have an identifier length of 40 to 44 characters (thus the total length is from 42
to 46
characters). The data, entered by the user, is stored in a variable %text_var%
.
Example of Condition: {(startswith("%text_var%", "0x")) and (42 <= len("%text_var%") <= 46)}
The condition will check that the text, stored in the variable, starts with the characters "0x" and will be greater than or equal to 42 and less than or equal to 46 characters in length.
❖ BTC (Bitcoin) address verification
Required knowledge:
● How to create a feedback form.
● Input of a variable by the user.
● Expressions and the startswith() function.
● Expressions and the len() function.
● Syntax of Conditions.
TASK: Let's say the user has to enter his Bitcoin (BTC) wallet address. There are three types of addresses for this network:
● Start with "1
" and has the total length from 20
to 35
characters.
● Start with "3
" and has the total length from 20
to 35
characters.
● Start with "bc1
" and has the total length from 20
to 90
characters.
The data, entered by the user, is stored in a variable %text_var%
.
1. An example of a simple Condition (without checking the length):{startswith("%text_var%", "1") or startswith("%text_var%", "3") or startswith("%text_var%", "bc1")}
2. An example of a complex Condition (with checking the length):
Step one - checking the first two types of wallets:( (startswith("%text_var%", "1") or startswith("%text_var%", "3")) and (20 <= len("%text_var%") <= 35) )
Step two - checking the third type of wallets:( startswith("%text_var%", "bc1") and (20 <= len("%text_var%") <= 90) )
The structure of the general condition will look like this:{( ((...)or(...)) and (...) ) or ( (...) and (...) )}
The general condition will look like this:{( (startswith("%text_var%", "1") or startswith("%text_var%", "3")) and (20 <= len("%text_var%") <= 35) ) or ( startswith("%text_var%", "bc1") and (20 <= len("%text_var%") <= 90) )}
The condition will check that the text, stored in the variable, starts with the characters "1" or "3" with a length of 20 to 35 characters, or starts with the characters "bc1" and has a length of 20 to 90 characters.
❖ Additional information
Condition for TON
{(startswith("%text_var%", "EQ")) and (len("%text_var%") == 48)}
The condition will check that the text stored in the variable starts with the characters "EQ" and is equal to 48 characters in length.
Condition for DOGE
{(startswith("%text_var%", "D")) and (len("%text_var%") == 34)}
The condition will check that the text stored in the variable starts with the characters "D" and is equal to 34 characters in length.
Condition for TRON
{(startswith("%text_var%", "T")) and (len("%text_var%") == 34)}
The condition will check that the text stored in the variable starts with the characters "T" and is equal to 34 characters in length.