A self-hosted discord bot to show your private Advent of Code leaderboards on your discord servers
- Clone
git clone https://github.com/kavinvalli/aoc-private-lb-discord-bot.git
- Install dependencies
npm install
-
Setup environment variables
- App Name could be anything (optional)
- Get your DISCORD_BOT_TOKEN and DISCORD_CLIENT_ID from here. More details here.
- For SESSION, follow the following steps.
- Go to the Private Leaderboards Page on adventofcode.com.
- Click on View on the leaderboard you want the discord bot to run for.
- Click on API, then click on JSON.
- Now, right click on the page and click on Inspect.
- Go to the Network tab.
- Refresh the page.
- On the table, click on the one which has a name ending in
.json
and type asdocument
. - Scroll down, and in the Request Headers section, you will find a field that says
cookie
. Copy everything aftersession=
and that is your SESSION.
- PRIVATE_LEADERBOARD_ID: In step 3, after clicking on JSON, you visit a page. The URL would look something like this:
https://adventofcode.com/2022/leaderboard/private/view/1234567.json
. Here 1234567 is the PRIVATE_LEADERBOARD_ID.
-
Run the App
- Development mode
npm run dev
- Normal Start
npm start
- Build the application. The build files will be in the
dist/
folder.
npm run build
To deploy the app on an EC2, GCP Instance, etc. use pm2.
- Build the app using
npm run build
. - Start the pm2 process.
pm2 start dist/index.js --name aoc-private-lb-discord-bot # Replace aoc-private-lb-discord-bot with whatever you want to name the process (this is only for reference)