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
Satoshi is a discord bot template in python using discord.py that allow you to track some live crypto prices with your own discord bot.

Satoshi ~ DiscordCryptoBot Satoshi is a simple python discord bot using discord.py that allow you to track your favorites cryptos prices with your own

Théo 2 Sep 15, 2022
My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA

My solutions to adventofcode.com puzzles. I post videos of me solving the puzzles in real-time at https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41

null 195 Jan 4, 2023
Copier template for solving Advent of Code puzzles with Python

Advent of Code Python Template for Copier This template creates scaffolding for one day of Advent of Code. It includes tests and can download your per

Geir Arne Hjelle 6 Dec 25, 2022
A GitHub Action that automatically reports your Advent of Code progress in a table in your README

Advent README Stars This action adds and maintains a stars report in your README based on your Advent of Code progress. Example Table 2021 Results Day

Kevin Duff 36 Dec 30, 2022
A simple Discord Bot that uses the free CryptoCompare API to display cryptocurrency prices

What is this? This is a simple Discord Bot coded in Python that uses the free CryptoCompare API to display cryptocurrency prices Download Use git to c

Kevin 10 Apr 17, 2022
A simple Discord bot wrote with Python. Kizmeow let you track your NFT project and display some useful information

Kizmeow-OpenSea-and-Etherscan-Discord-Bot 中文版 | English Ver A Discord bot wrote with Python. Kizmeow let you track your NFT project and display some u

Xeift 93 Dec 31, 2022
Pancakeswap Sniper BOT - TORNADO CASH Proxy (MAC WINDOWS ANDROID LINUX) A fully decentralized protocol for private transactions

TORNADO CASH Proxy Pancakeswap Sniper BOT 2022-V1 (MAC WINDOWS ANDROID LINUX) ⭐️ A fully decentralized protocol for private transactions ⭐️ AUTO DOWNL

Crypto Trader 1 Jan 5, 2022
Customizable and open-sourced bot for a few private servers

MarlBot A private bot for controlling monkeys and turtles. Why does this bot exist? The bot exists as a general-purpose community bot for a select few

KR 1 Jan 18, 2022
LimitatiBot - A simple telegram bot to establish a conversation with a user without having to use private chats

?? LimitatiBot [0.2] LimitatiBot is a simple telegram bot to establish a convers

xMrPente 9 Dec 27, 2022
Frwdit-V1 - A Simple Bot can copy any media to a private channel provided

?? Auto Forward V2 A Simple Bot can copy any media to a private channel provided

FUCK OFF ANE 3 Dec 3, 2022