The Discord Leaderboard Bot is a bot that allows you to manage a leaderboard within your Discord server without an open websocket connection.
Instead it only uses Discord's interactions endpoint to handle commands.
- vote for a user every week
- see the current standings
- monthly resets
Interaction events are handled in 2 steps:
index.ts
validates the request, launchesexecute.ts
and responds immediately withDEFERRED_CHANNEL_MESSAGE_WITH_SOURCE
execute.ts
received the original interaction object and processes the given command
-
Clone the repository:
git clone https://github.com/your-username/discord-leaderboard-bot.git
-
Install the required dependencies:
npm install #install aws-cli
-
Set up your Discord bot:
- Create a new Discord application and bot on the Discord Developer Portal.
- Add the bot to your server, e.g.
https://discord.com/oauth2/authorize?client_id=<clientId>&permissions=826781289536&scope=bot+applications.commands
- Create
.env
file from.env.dist
and fill it out:DISCORD_TOKEN=your-bot-token APPLICATION_PUBLIC_KEY=your-public-key APPLICATION_CLIENT_ID=your-client-id GUILD_ID=your-discord-server-id CHANNEL_ID=channel-for-bot-messages
-
Deploy all commands to your server:
npm run deploy:commands
-
Create an AWS profile in ~/.aws/credentials named
discord-leaderboard-bot
-
Deploy the bot to AWS:
#bootstrap your AWS account #npx cdk bootstrap ... npm run deploy
-
Update the interactions endpoint url in your bot's settings to point to the deployed API's url.
This project is licensed under the MIT License.