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
A Discord bot to combat phishing links for Steam trades and Discord gifts.

delink-bot A Discord bot to combat phishing links for Steam trades and Discord gifts. Requirement python3 -m pip install -U discord.py python3 -m pip

hugonun 15 Dec 09, 2022
Google scholar share - Simple python script to pull Google Scholar data from an author's profile

google_scholar_share Simple python script to pull Google Scholar data from an au

Paul Goldsmith-Pinkham 9 Sep 15, 2022
AWS-serverless-starter - AWS Lambda serverless stack via Serverless framework

Serverless app via AWS Lambda, ApiGateway and Serverless framework Configuration

Bəxtiyar 3 Feb 02, 2022
A Telegram Bot to Extract Various Types Of Archives

IDN Unzip Bot A Telegram Bot to Extract Various Types Of Archives Features Extract various types of archives like rar, zip, tar, 7z, tar.xz etc. Passw

IDNCoderX 8 Jul 25, 2022
PyDiscord, a maintained fork of discord.py, is a python wrapper for the Discord API.

discord.py A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. The Future of discord.py Please read the gi

Omkaar 1 Jan 16, 2022
This is a very simple botnet with a CnC server, made by me. Feel free to change anything

This is a very simple botnet with a CnC server, made by me. Feel free to change anything

8 Nov 12, 2022
Alienworlds-bot - A Python script made to automate the tidious job of mining on AlienWorlds

AlienWorlds bot A Python script designed to automate the tedious work of mining

5 Dec 23, 2022
Represents a Lavalink client used to manage nodes and connections.

lavaplayer Represents a Lavalink client used to manage nodes and connections. setup pip install lavaplayer setup lavalink you need to java 11* LTS or

HazemMeqdad 37 Nov 21, 2022
Price checker windows application

Price-Checker price checker windows application This application monitors the prices of selected products and displays a notification if the price has

Danila Tsareff 1 Nov 29, 2021
A free tempmail api for your needs!

Tempmail A free tempmail api for your needs! Website · Report Bug · Request Feature Features Add your own private domains Easy to use documentation No

dropout 10 Oct 26, 2021
This wrapper now has async support, its basically the same except it uses asyncio

This is a python wrapper for my api api_url = "https://api.dhravya.me/" This wrapper now has async support, its basically the same except it uses asyn

Dhravya Shah 5 Mar 10, 2022
Reddit bot that uses sentiment analysis

Reddit Bot Project 2: Neural Network Boogaloo Reddit bot that uses sentiment analysis from NLTK.VADER WIP_WIP_WIP_WIP_WIP_WIP Link to test subreddit:

TpK 1 Oct 24, 2021
OpenQuake's Engine for Seismic Hazard and Risk Analysis

OpenQuake Engine The OpenQuake Engine is an open source application that allows users to compute seismic hazard and seismic risk of earthquakes on a g

Global Earthquake Model 281 Dec 21, 2022
A solution designed to extract, transform and load Chicago crime data from an RDS instance to other services in AWS.

This project is intended to implement a solution designed to extract, transform and load Chicago crime data from an RDS instance to other services in AWS.

Yesaswi Avula 1 Feb 04, 2022
Simple spam bot made in python

Simple Spam Bot A Simple and easy way to be the most hated person between your friends, All you have to do is spam the group chat using this bot until

Kareem Osama 6 Sep 05, 2022
修改自SharpNoPSExec的基于python的横移工具 A Lateral Movement Tool Learned From SharpNoPSExec -- Twitter: @juliourena

PyNoPSExec A Lateral Movement Tool Learned From SharpNoPSExec -- Twitter: @juliourena 根据@juliourena大神的SharpNOPsExec项目改写的横向移动工具 Platform(平台): Windows 1

<a href=[email protected]"> 23 Nov 09, 2022
A Simple Telegram Bot that can Download Files From Mega.nz and Upload It to Telegram

MegaDL-Bot A Simple Telegram Bot By @mrkpbots to Download Files From Mega.nz and Upload It to Telegram Features No Login Required All Mega.nz File Lin

MRKP BOTS 5 Feb 20, 2022
An implementation of webhook used to notify GitHub repository events to DingTalk.

GitHub to DingTask An implementation of webhook used to notify GitHub repository events to DingTalk.

Prodesire 5 Oct 02, 2022
This Lambda will Pull propagated routes from TGW and update VPC route table

AWS-Transitgateway-Route-Propagation This Lambda will Pull propagated routes from TGW and update VPC route table. Tested on python 3.8 Lambda AWS INST

4 Jan 20, 2022
A discord token nuker With loads of options that will screw an account up real bad, also has inbuilt massreport, GroupChat Spammer and Token/Password/Creditcard grabber and so much more!

Installation | Important | Changelogs | Discord NOTE: Hazard is not finished! You can expect bugs, crashes, and non-working functions. Please make an

Rdimo 470 Aug 09, 2022