Skip to content

Cool script that posts a Advent of Code private leaderboard on Discord

License

Notifications You must be signed in to change notification settings

DaInfLoop/AoC-Leaderboard-Bot

Repository files navigation

Advent of Code Leaderboard Webhook

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.

Setup

GitHub Actions (recommended)

  1. Fork this repo (fork)
  2. Edit config.json with your private leaderboard ID
  3. Open your Repository settings and head to Secrets and variables > Actions
  4. Create two Secrets, called COOKIE (contains your Advent of Code session ID), and WEBHOOK (contains a Discord webhook URL)
  5. Voila!

Self-hosting

  1. Clone this repo:
$ git clone https://github.com/DaInfLoop/AoC-Leaderboard-Bot.git
  1. Move into the newly made directory
  2. Run npm i
  3. Edit config.json with your private leaderboard ID
  4. Set up two environmental variables, called COOKIE (contains your Advent of Code session ID), and WEBHOOK (contains a Discord webhook URL)
  5. 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.

Linking Discord Users

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",
}

"Hey, but how do I get my Advent of Code ID?"

To get your Advent of Code ID, first go to your settings page. It should look something like this:
AoC Settings Page

Grab your User ID from the (anonymous user XXXXXX) option. Voila.

"Okay, how do I get my Discord ID?"

First of all:

Frost Keeper from "House Vibe" kicking you

Jokes aside, to get your Discord User ID, first enable Developer Mode (User Settings > Advanced > Developer Mode):

Developer Mode

Then click your user profile and click Copy User ID:

image

Voila!

Cool, but how do I get my leaderboard ID?

Incoming Sword

Open your private leaderboard (e.g. https://adventofcode.com/2023/leaderboard/private/view/970245) and grab the ID. It's that easy.

About

Cool script that posts a Advent of Code private leaderboard on Discord

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •