/balance: see your coins./work: earn coins, with a lucky bonus./give: give coins to a friend./buy-vip: spend 500 coins on a VIP role./add-coins: staff only, add coins to anyone.
Step 1: Make the variable
On the Database page, make one variable:
Now
{DBVAR_coins} means “the coins of the person using the command”. Need help? See Make your first variable.
Step 2: /balance
- Make a new Slash command called
balance, descriptionSee your coins. - Add a Reply block under the first block and connect it.
- Type:
You have {DBVAR_coins|0} coins. - Save.
|0 is a backup, so a brand new member sees 0 instead of nothing.
Step 3: /work
- Make a slash command called
work. - Add Do the maths. Variable:
coins. Whose variable: the person who used the command. Maths:+ 25. - Add a Random chance check under it, set to 10%.
- On the yes path: another Do the maths,
+ 100, then a Reply:Lucky day! You earned 25 coins plus a 100 coin bonus. You now have {DBVAR_coins}. - On the else path: a Reply:
You worked hard and earned 25 coins. You now have {DBVAR_coins}. - Save.
Step 4: /give
This one uses Inputs: the boxes people fill in.- Make a slash command called
give. - From the Inputs tab, add a User input called
memberand a Number input calledamount. Make both required. - Add a Compare check: is
{DBVAR_coins}greater than or equal to the amount? (Use the Variables button to pick the amount input’s value.) - On the yes path:
- Do the maths on
coins, whose variable: the person who used the command, maths: minus the amount. - Do the maths on
coins, whose variable: the member from the input, maths: plus the amount. - Reply:
You gave coins to your friend!
- Do the maths on
- On the else path: Reply:
You don't have enough coins. You have {DBVAR_coins}. - Save.
Step 5: /buy-vip (a shop)
- Make a slash command called
buy-vip. - Add Compare: is
{DBVAR_coins}greater than or equal to500? - On the yes path:
- Do the maths on
coins:- 500. - Give roles: pick your VIP role.
- Reply:
You bought VIP! You have {DBVAR_coins} coins left.
- Do the maths on
- On the else path: Reply:
VIP costs 500 coins. You have {DBVAR_coins}. - Save.
Your bot’s own role must be above the VIP role in your server’s role list, or Discord will not let it give that role.
Step 6: /add-coins (staff only)
- Make a slash command called
add-coinswith a User inputmemberand a Number inputamount. - Add a check that looks at the permissions of the person who used it (type
permissioninto the block search). Choose Administrator. - On the yes path: Do the maths on
coins, whose variable: the member from the input, maths: plus the amount. Then Reply:Done! - On the else path: Reply:
Only admins can use this.
Make it yours
- Show coins on a picture: make a wallet card in Card Studio with
{DBVAR_coins}on it. See Card Studio. - Sell more things: copy
/buy-vipand change the price and role. - Use a User -> Object variable called
walletwith keyscoinsandgemsfor two kinds of money. See Objects and Collections.
