Cool script that posts a Advent of Code private leaderboard on Discord
Note
This version of the webhook runs in the Friends of Replit Discord server, running every day at about 5:30AM UTC.
- Fork this repo (fork)
- Edit
config.json
with your private leaderboard ID - Open your Repository settings and head to
Secrets and variables
>Actions
- Create two Secrets, called
COOKIE
(contains your Advent of Code session ID), andWEBHOOK
(contains a Discord webhook URL) - Voila!
- Clone this repo:
$ git clone https://github.com/DaInfLoop/AoC-Leaderboard-Bot.git
- Move into the newly made directory
- Run
npm i
- Edit
config.json
with your private leaderboard ID - Set up two environmental variables, called
COOKIE
(contains your Advent of Code session ID), andWEBHOOK
(contains a Discord webhook URL) - Set up a cron-job or similar to run
node .
in the current directory at a certain time (e.g. 5:00AM UTC). The script does not do this by default.
To link a Discord user, open up users.js
and add a new property to the object. The format is:
{
// other fields
// An Identifier of sorts (not required)
"AoC ID": "Discord ID",
}
To get your Advent of Code ID, first go to your settings page. It should look something like this:
Grab your User ID from the (anonymous user XXXXXX)
option. Voila.
First of all:
Jokes aside, to get your Discord User ID, first enable Developer Mode (User Settings > Advanced > Developer Mode):
Then click your user profile and click Copy User ID
:
Voila!
Open your private leaderboard (e.g. https://adventofcode.com/2023/leaderboard/private/view/970245) and grab the ID. It's that easy.