/advent-of-code-bot

A simple Discord bot for Advent Of Code

Primary LanguagePythonApache License 2.0Apache-2.0

advent-of-code-bot Latest release

A simple Discord bot for Advent Of Code

Getting started

Setup

You'll need to create a discord bot of your own in the Discord Developer Portal with View Channels and Read Messages permissions. It's also handy if you have an empty server (or "guild") for you to test in. This section of this guide may be helpful to set that up.

You'll need to set three environment variables:

  • DISCORD TOKEN -> The Discord token for the bot you created (Available on your bot page in the developer portal)
  • AOC_LEADERBOARD_ID -> The leaderboard ID of your private leaderboard
  • AOC_COOKIE -> Your Advent Of Code session cookie so the bot has permission to view your private leaderboard (You can extract this from your web browser after signing in to AoC)
  • CHANNEL_NAME -> The name of the channel the bot should respond to requests in
  • CURRENT_YEAR -> The default year to request

You can put these in a .env file in the repo directory as it uses dotenv (See here for usage) so you don't have to keep them in your environment

Starting the bot

Using Docker

docker compose up --build

Manually

First install the dependencies:

pip install -U Discord.py python-dotenv

Then run the main file:

python src/main.py

Contributions

In short, patches welcome.

If you raise a PR, I'll test it, give some feedback and then (eventually) merge it.

This project aims to follow PEP8, but with a line length of 120 characters, and PEP8 Speaks and Travis CI will perk up in the comments of your PR if you go against this.