Economy w/ leaderboard page
The ultimate economy app featuring a full web page to show off your server leaderboard, whos on top of the game with nice styling and fancy animations!
Table of contents
Version
Features
- Customization
- Web page (example)
- Tax
- Editable shop
Setup
- Copy this airtable database.
- Link your discord bot and copied airtable database.
- Fill out the enviroment variables
- guildId: The ID of your guild.
- Audit_Log_Channel: ID of the channel where all transactions will be logged to.
- ADMIN_ROLE_ID: The ID of your admin role responsible for managing users.
- ADMIN_LOG_CHANNEL_ID: The ID of the channel where all the logs of admin actions end up in.
- CURRENCY_EMOJI: Symbol/Emoji of the representing your guild currency.
- EMBEDCOLOR: Color integred, format: "0xHEX_CODE", example: "0xff0000" for white.
- CommandCreation: "yes" if you want it to create the slash commands, "no" if you don't, useful if you just want to check it out or look at the code.
- TAX: "yes" if you want your bot to feature a tax system (changes every day between 5 and 20 %). "no" otherwise.
- Set the
Timeout (ms)
(bottom left hand side of your project) to 30000
.
- Navigate to the
functions/extra-function/commandCreator.js
, functions/extra-function/commandCreator1.js
and functions/extra-function/commandCreator2.js
files and click the green run
button a couple of times in all 3 files to assure all commands are created.
- Head over to the
functions/__main__.js
file and copy the url at the bottom of the page.

- Paste this url on line 52 of the functions/commands/leaderboard.js file.
- Enjoy your new economy bot!
Commands
command |
parameters |
description |
/balance |
user |
Returns user balance. |
/work |
|
Earn some cash. |
/deposit |
amount |
Deposit money to your bank. |
/withdraw |
amount |
Withdraw money from your bank. |
/coin-flip |
bet, side |
Bet your money on a game of coin flip. |
/leaderboard |
|
Returns guild leaderboard. |
/shop |
subcommands |
Open, buy, create and delete shop items. |
/transaction |
subcommands |
Create and retrieve transactions. |
/profile |
user |
Returns user profile. |
/inventory |
user |
Returns user items. |
/tax |
|
Returns current tax rate. |
/user-update |
subcommands |
Allows server admins to remove/add money and items. |
Help
Got stuck whilst installing the app?
Have any questions?
Found a bug?
Have some feedback?
How to find me
What can you learn?
How to split my code up in multiple files?
If you look at the code in this project you can see that there has been made good use of the require() function, this is used to load modules from other files in the current file.
How can I make use of subcommands?
In this project I've made use of the subcommand feature, this means there can be commands inside commands but all of these commands will be handled by one file. Of course you don't want to have all the function for all the commands compiled in the same file. Look at how I made use of the require() function to split it up!
How to connect lib api calls to web pages?
It was quite the challenge fetching the users in the index.ejs page. I asked around and found out that I can have a module inside the functions directory that fetches the users and exports it, then make a fetch request to that file. Check out the full script in the views/index.ejs
file.
- I suggest you take a look around, test and try around with all the concepts that are new to you.
Changelogs
Version 0.0.0
- Changes
- Initial release
- Commands
- /balance
- /work
- /leaderboard
- /shop
- /transaction
- /profile
- /tax
Version 0.0.1
- Changes
- Fixed an error where the User_ID field did not accept the provided value.
Version 0.1.1
- Changes
- Added commands:
/deposit
, /withdraw
, coin-flip
.
Version 0.1.2
- Changes
- Added commands:
/inventory
.
Yh I know it wasnt there, I forgot... sorry.
Version 0.1.3
- Changes
- Fixed an issue where the commandCreator file would return errors.
- Removed the KV pair that would hold on to the leaderboard page URL and instead using a variable the user has to manualy put in (instructions in the setup).
v0.1.4
- Changes
- Fixed the work command cooldown π©
v0.2.4
- Changes
- Added commands:
/user-update
with 4 sub commands: item-remove
, item-add
, money-remove
, money-add
.
- Added global variables:
ADMIN_ROLE_ID
(The ID of your admin role responsible for managing users), ADMIN_LOG_CHANNEL_ID
(The ID of the channel where all the logs of admin actions end up in).