Discord bot to display private leaderboards for Advent of Code.

Overview

Advent Of Code Discord Bot

image Discord bot for displaying Advent of Code private leardboards, as well as custom leaderboards where participants can set their own start times. The latter function is ideal for participants in different time zones looking for a way to compete with each other.

Screenshots

The Leaderboard in Discord

The !plb Command

User Stats

the !stats Command

Commands

Command Description
!plb Print out the private leaderboard. This uses the original advent of code scoring scheme.
!clb Prints out the custom leaderboard. This uses our custom advent of code scoring scheme.
!register [AOC_USERNAME] Associate yourself with given AoC user. Can be called without an argument, if so will print out the list of registered users. If no argument, will register your discord ID with your Advent of Code username for custom scoring.
!start Start a day. This will set your starttime for our custom scoring.
!schedule [<+/-> ] Can be called without an argument, if so will print the next scheduled send time. With an argument, will schedule a time for the leaderboard to send automatically. Takes in a indicator (either + or -) and an integer (minutes) and sends the leaderboard at the start time of the competition for that day (midnight EST), given that offset.
!stats [AOC_USERNAME] Send individual stats for a user. Can be called with and without an argument, without an argument it will use the account that is registered with your user.

Running the bot

  1. Clone this repo to your machine with git clone https://github.com/TheFutureGadgetsLab/AdventOfCodeBot.git.
  2. Run python3 -m pip install requirements
  3. Run python3 main.py

Getting Started

In order to configure the bot you'll need to open the config located at /src/config.py and set the YEAR, SESSION_COOKIE, DISCORD_TOKEN and LEADERBOARD. The YEAR should be whichever year you're trying to get on the scoreboard, the SESSION_COOKIE should be the session cookie you get when logging into Advent of Code, and the LEADERBOARD should be the ID of the leaderboard you're trying to access. You will need to set up a Discord bot and add it to the server you plan to use this bot in, and then retrieve the bot token and set the DISCORD_TOKEN to be that.

Scoring

This bot provides two unique methods of scoring the leaderboard, specifically based on start time of a problem. Both scoring methods work by counting the number of players on the leaderboard (n), then for each star giving the first player to finish n stars, the second player n - 1 stars, and so on, until the last player recieves 1 star.

Original Scoring

The original scoring (!plb) uses the exact same scoring conditions as the original advent of code leaderboard, where start time for a problem is set by the time the problem opens (Midnight EST) for each day.

Custom Scoring

The custom scoring (!clb) uses custom set start times by players. These are set using the !start command after a user has registered with !register . If a user has not set a start time for a problem, the scoring algorithm will use the time that problem originally opened at Midnight EST of that day.

FAQ

  1. What are these weird files called hackikuji.mayoi and senjougahara.hitagi?
    These are the shelve files that store state so it persists between bot shutdowns. hackikuji.mayoi stores the registered users and their start times, and senjougahara.hitagi stores the scheduled time for the server to run.

Attribution

Built by Future Gadgets Lab members @haydn-jones, @bensonalec, and @benpm.

You might also like...
It's a Discord bot to control your PC using your Discord Channel or using Reco: Discord PC Remote Controller App.
It's a Discord bot to control your PC using your Discord Channel or using Reco: Discord PC Remote Controller App.

Reco PC Server Reco PC Server is a cross platform PC Controller Discord Bot which is a modified and improved version of Chimera for Reco-Discord PC Re

A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py)
A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py)

Articuno (discord-interactions) A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py) Get started If you wa

Discord bot script for sending multiple media files to a discord channel according to discord limitations.

Discord Bulk Image Sending Bot Send bulk images to Discord channel. This is a bot script that will allow you to send multiple images to Discord channe

A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studying.

Studying RPC Description A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studyin

Rich presence app for playstation 3. Display what game you are playing on the PS3 via Discord
Rich presence app for playstation 3. Display what game you are playing on the PS3 via Discord

PS3-Rich-Presence-for-Discord Discord Rich Presence script for PS3 consoles on HFW&HEN or CFW. Written in Python. Display what you are playing on your

An Open-Source Discord bot created to provide basic functionality which should be in every discord guild. We use this same bot with additional configurations for our guilds.

A Discord bot completely written to be taken from the source and built according to your own custom needs. This bot supports some core features and is

Discord ToolBox is a discord bot developed by DJD320 created for the purpose of having some convenient tools in the form of a single bot.

Discord ToolBox Discord ToolBox is a discord bot developed by DJD320 created for the purpose of having some convenient tools in the form of a single b

Linky bot, A open-source discord bot that allows you to add links to ur website, youtube url, etc for the people all around discord to see!

LinkyBot Linky bot, An open-source discord bot that allows you to add links to ur website, youtube url, etc for the people all around discord to see!

Comments
  • Leaderboard commands not working

    Leaderboard commands not working

    when running the program the it gives errors when it gets an request

    when printing the person it does show

    Ignoring exception in command clb:
    Traceback (most recent call last):
      File "/Users/Joy/Desktop/AdventOfCodeBot/.venv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
        ret = await coro(*args, **kwargs)
      File "/Users/Joy/Desktop/AdventOfCodeBot/main.py", line 37, in clb
        leaderboard = Leaderboard(db)
      File "/Users/Joy/Desktop/AdventOfCodeBot/src/Leaderboard.py", line 17, in __init__
        self.merge_shelf(db)
      File "/Users/Joy/Desktop/AdventOfCodeBot/src/Leaderboard.py", line 57, in merge_shelf
        if player.name.lower() not in registered_players:
    AttributeError: 'NoneType' object has no attribute 'lower'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/Users/Joy/Desktop/AdventOfCodeBot/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
        await ctx.command.invoke(ctx)
      File "/Users/Joy/Desktop/AdventOfCodeBot/.venv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
        await injected(*ctx.args, **ctx.kwargs)
      File "/Users/Joy/Desktop/AdventOfCodeBot/.venv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped
        raise CommandInvokeError(exc) from exc
    discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'lower'
    
    opened by timmermansjoy 4
  • A few issues upon setup

    A few issues upon setup

    Whilst setting up this bot the other day, I ran into a few issues:

    • simplejson module is required, but not in the requirements.txt
    • discord.py requires intents when setting up the bot

    I was able to fix both of these and I can make a PR if you'd like.

    opened by funnyboy-roks 2
  • Stats div by zero

    Stats div by zero

    If a user requests stats but they have not completed any parts the bot will throw an exception.

    Ignoring exception in command stats:
    Traceback (most recent call last):
      File "/home/supa/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
        ret = await coro(*args, **kwargs)
      File "/home/supa/AdventOfCodeBot/main.py", line 64, in stats
        await run_stats(ctx, " ".join(args).lower())
      File "/home/supa/AdventOfCodeBot/src/stats.py", line 30, in run_stats
        averages = player.build_averages()
      File "/home/supa/AdventOfCodeBot/src/Player.py", line 38, in build_averages
        average_ttf = sum(ttf_list,datetime.timedelta()) / len(ttf_list)
    ZeroDivisionError: integer division or modulo by zero
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/home/supa/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
        await ctx.command.invoke(ctx)
      File "/home/supa/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
        await injected(*ctx.args, **ctx.kwargs)
      File "/home/supa/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped
        raise CommandInvokeError(exc) from exc
    discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ZeroDivisionError: integer division or modulo by zero
    
    opened by haydn-jones 0
Releases(v1.0.0)
Owner
The Future Gadgets Lab
Weebs arguing instead of developing
The Future Gadgets Lab
The text based version of my App Blocker that I planning on converting to GUI soon.

App-Blocker The text based version of my App Blocker that I planning on converting to GUI soon. Currently I am just uploading the appblocker.py file,

Harsh Raj 0 Sep 13, 2022
Weather telegram bot with aiogram, on Russian language

weather_bot Weather telegram bot with aiogram, on Russian language #RU Бот по определению погоды в Telegram, написана на библиотеке aiogram, весь инте

LinkxWan 0 Jan 06, 2022
Ulaavi for nuke, helps to keep our stocl elements organised.

Ulaavi Ulaavi for nuke, helps to keep our stock elements organised. Installation Downlaod ffmpeg from ffmpeg.org linux : https://johnvansickle.com/ffm

Arun Subramaniyam 17 Aug 24, 2022
(@Tablada32BOT is my bot in twitter) This is a simple bot, its main and only function is to reply to tweets where they mention their bot with their @

Remember If you are going to host your twitter bot on a page where they can read your code, I recommend that you create an .env file and put your twit

3 Jun 04, 2021
Api REST para gerenciamento de cashback.

Documentação API para gerenciamento de cashback - MaisTODOS Features Em construção... Tecnologias utilizadas Back end Python 3.8.10 Django REST Framew

Alinne Grazielle 2 Jan 22, 2022
Mikasa is a 100% Spanish bot, a multifunctional bot, Mikasa is in beta.

Mikasa Miaksa, It is a multi-functional discord bot that is currently in development, this is not complete, there are still many things to fix and imp

Made in 2 Oct 05, 2021
Bearer API client for Python

Bearer Python Bearer Python client Installation pip install bearer Usage Get your Bearer Secret Key and integration id from the Dashboard and use the

Bearer 9 Oct 31, 2022
Send song lyrics to iMessage users using the Genius lyrics API

pyMessage Send song lyrics to iMessage users using the Genius lyrics API. Setup 1.) Open the main.py file, and add your API key on line 7. 2.) Install

therealkingnull 1 Jan 23, 2022
Easy to use Google Pub/Sub

Relé makes integration with Google PubSub straightforward and easy. Motivation and Features The Publish-Subscribe pattern and specifically the Google

Mercadona 188 Jan 06, 2023
An alternative launcher for Lunar Client which is aimed at portability and functionality.

Portaluna An alternative launcher for Lunar Client which is aimed at portability and functionality. Features Portable. Lightweight. Functional. Note:

4 Mar 05, 2022
Discord bot for playing Werewolf game on League of Legends.

LoLWolf LoL人狼をプレイするときのDiscord用botです。 (Discord bot for playing Werewolf game on League of Legends.) 以下のボタンを押してbotをあなたのDiscordに招待することで誰でも簡単に使用することができます。

Hatsuka 4 Oct 18, 2021
Um bot para contar quantas vezes o meu amigo troca de pfp/nick/tag essas coisas ae pq aquele mlk n para quieto

EkiBot Um bot que tem apenas as suas funções de audit log com as PFP's (avatares) dos usuários Pode ser usado para um usuário em específico, ou até me

Samuel 3 Aug 11, 2021
A discord bot that send SMS spam!

bruh-bot send spam sms! send spam with email! it sends you spam via sms and Email using two tools, quack and impulse! if you have some problem contact

pai 32 Dec 25, 2022
Integrating Amazon API Gateway private endpoints with on-premises networks

Integrating Amazon API Gateway private endpoints with on-premises networks Read the blog about this application: Integrating Amazon API Gateway privat

AWS Samples 12 Sep 09, 2022
Fix Twitter video embeds in Discord

TwitFix very basic flask server that fixes twitter embeds in discord by using youtube-dl to grab the direct link to the MP4 file and embeds the link t

Robin Universe 682 Dec 28, 2022
Search stock images (e.g. via Unsplash) and save them to your Wagtail image library.

Wagtail Stock Images Search stock images (e.g. via Unsplash) and save them to your Wagtail image library. Requirements Python 3 Django = 2 Wagtail =

Vicktor 12 Oct 12, 2022
Asynchronous Guilded API wrapper for Python

Welcome to guilded.py, a discord.py-esque asynchronous Python wrapper for the Guilded API. If you know discord.py, you know guilded.py. Documentation

shay 115 Dec 30, 2022
BSDotPy, A module to get a bombsquad player's account data.

BSDotPy BSDotPy, A module to get a bombsquad player's account data from bombsquad's servers. Badges Provided By: shields.io Acknowledgements Issues Pu

Rudransh Joshi 3 Feb 17, 2022
A Discord Token Grabber/Stealer But It's in One Line of Coding

Discord-Token-Grabber-But-In-One-Line That's a Discord Token Grabber/Stealer But It's in One Line of Coding! The Name Says All 3

YoSoyAngi 2 Jan 11, 2022
Balsam Python client API & SDK

balsam No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) This Python package is automatically

Darren Govoni 1 Oct 22, 2021