Skip to main content

Transferring funds between users inside the bot

This tutorial will help you organize the translation of funds between users within your bot. Funds will be transferred from the balance of one user to the balance of another. The user himself indicates the amount, the addressee and performs the transfer.

 

❖ 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:

1. Variables - 2 pieces
☞ 🔐Admin | 🧩Extensions | 📂Variables

2. Actions - 4 pieces
☞ 🔐Admin | 🧩Extensions | 📂Actions

3. Plugin - Conditions for a Button
☞ 🔐Admin | 🧩Extensions | 📂Buttons

4. Plugin - Macros and Expressions for Buttons
☞ 🔐Admin | 🧩Extensions | 📂Buttons

 

Creation of funds transfer

 

To create the functionality of internal transfers of funds, you will need to create a form in which the user will indicate the addressee and the amount of the transfer.

 

1. Necessary variables

Create two variables in the bot, one Text and the other Numeric.

Go to your bot:
☞ 🔐Admin | 🗄Variables | 📙Text | ➕Create Variable
Name the Text one: "uid".

Go to your bot:
☞ 🔐Admin | 🗄Variables | 📙Numeric | ➕Create Variable
Name the Numeric one: "usum".

Guide on Variables by link.

 

2. Button for translation

Click in your bot:
☞ 🎛Buttons Editor | ➕Add Button
Name of the button: "Funds Transfer".

 

3. Form for entering the data of the addressee

Click in your bot:
☞ 📝Post Editor
And go to the created button "Funds Transfer".

Read more about working with Forms and user Variable Input in manuals.

3.1 Creating an Addressee ID Input
• Select "Variable Input"
• Variable uid
• Message: "Enter the recipient's Telegram ID: "

3.2 Create an Input of the transferred amount
• Select "Variable Input"
• Variable usum
• Message: "Enter the amount to transfer:"

 

4. Message for verification and confirmation

• Click "Add Message".
• Message:
"Confirm the transfer of funds:
Addressee: %uid%
Amount: %usum%
Click «Send Funds» if everything is correct or «Cancel» to start over."

 

5. Confirmation and transfer button

5.1 Go to the "Buttons Editor" create a button called "Send Funds".

5.2 Without leaving the "Buttons Editor" (if you left, go back) press the inline Settings button [*].
Click "Assign Pre-Action".

● Select "Action of Transactions" (This is the transfer of funds).
Variable for accrual: "balance".
Value to change: "%usum%".
User ID: "%uid%".

Read more about how to work with the Action of Transaction in the manual.
See the complete Actions Guide here.

● Select the "Action of Numbers"
Variable to change, "balance"
Operation type: Change Value
Value: -%usum% (note the minus "-" at the beginning)
Condition: none

● Select "Action of Commands"
Command: "/home".

In this case, after the transaction, the user will be moved to the Main Menu of the bot. If after transaction, you want your user to be moved to some other menu, specify the command of that button in whose menu you want to move the user.

 

6. Condition of the "Send Funds" button

Assign a condition to the "Send Funds" button, so that a user with an insufficient balance cannot use the button. Without leaving the "Button Editor" (if you left, go back) press the inline Settings button [*].
Click "Assign Condition".
• Condition: {%balance% >= %usum%}
• Condition's error messages:
"Not enough funds on the balance.
Balance: %balance%
Needed: %usum%."


7. "Cancel" button

7.1 Create a button under the "Send Funds" button and name it "Cancel".

7.2 Without leaving the "Button Editor" (if you left, go back) press the inline Settings button [*].
Click "Assign Pre-Action".

● Select "Action of Commands"
Command: "/home".

In this case, after the transaction, the user will be moved to the Main Menu of the bot. If after transaction, you want your user to be moved to some other menu, specify the command of that button in whose menu you want to move the user.