How to create a claim button (faucet)¶
This guide shows you how to set up a button in your bot that changes a user's balance. As an example, we will use a button called Claim
that will increase a user's balance by 1 each time they press it.
What will we do?¶
When a user presses the button:
- Their balance will increase by 1.
- They will receive a message confirming the change and showing their new balance.
Prerequisites¶
- Premium subscription: These settings require the use of actions, a feature exclusive to the premium subscription in VisualMaker.
- Required actions:
- Change variable: Allows you to save and modify data in variables. In this case, we will increment the
balance
variable. - Send message: To send a message to the user.
- Change variable: Allows you to save and modify data in variables. In this case, we will increment the
Steps to configure the balance change¶
1. Enter edit mode and select the button¶
- Go to your bot and press
🛠 Edit
. - Select the button you want to configure, in this case,
Claim
. Or create it if you haven’t done so yet. - Press
Actions 🌟
to enter the actions menu.
2. Add the action to change the balance¶
- Add an action of type Change variable.
- Press
Configure 🛠
to set it up. - Press
💠 Select variable 💠
and enter the name of the variable (in this case,balance
). - Press
🔺 Increment 🔺
to increase the value of the variable. -
Enter 1 to increase the balance by 1.
If you want to decrease the balance, enter a negative number, such as -1.
3. Send a message to the user¶
- Create another action of type Send message.
-
Press
Configure 🛠
and save the message the user will receive.- Example message:
(Use
{balance}
to display the current value of the variablebalance
to the user).
- Example message:
(Use
4. Activate the actions¶
- Go back to the button's actions list.
- Ensure that both actions (change variable and send message) are active.
Done!¶
When a user presses the Claim
button, their balance will increase by 1 and they will see a message like this:
More tips
-
Use "Increment" to add or subtract values:
The
🔺 Increment 🔺
option is used to increase or decrease the variable's value. In this guide, we used it to add1
, but you could also subtract using negative numbers like-5
. It's useful for dynamically updating balances. -
Use "Set" for fixed values:
If you need to assign a specific value to a variable, choose the
💢 Set 💢
option instead of🔺 Increment 🔺
. For example, if you want the balance to always be100
when the button is pressed, use this option and enter100
. -
Update another user's balance:
If you need to change the balance of another user (not the one pressing the button), you can enable the
👤 To other user 👤
option when configuring the Change variable action. You just need to enter the ID or@username
of the other user.