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
- Web page (example)
- Editable shop
- 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
- Navigate to the
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!
||Returns user balance.
||Earn some cash.
||Deposit money to your bank.
||Withdraw money from your bank.
||Bet your money on a game of coin flip.
||Returns guild leaderboard.
||Open, buy, create and delete shop items.
||Create and retrieve transactions.
||Returns user profile.
||Returns user items.
||Returns current tax rate.
||Allows server admins to remove/add money and items.
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
- I suggest you take a look around, test and try around with all the concepts that are new to you.
- Initial release
- Fixed an error where the User_ID field did not accept the provided value.
- Added commands:
- Added commands:
Yh I know it wasnt there, I forgot... sorry.
- 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).
- Fixed the work command cooldown 😩
- Added commands:
/user-update with 4 sub commands:
- 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).