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

MicroStealer - A compact Discord Token Logger/Discord Token Grabber made in only 15 lines of code! Injects into discord for long-term use

๐Ÿ’พ MicroStealer โšก A compact Discord Token Logger/Discord Token Grabber made in o

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
Posts locally saved videos to the desired subreddit

redditvideoposter posts locally saved videos to the desired subreddit ================================================================= STEPS: pip ins

Kyrus 2 Dec 01, 2021
Video-Player - Telegram Music/ Video Streaming Bot Using Pytgcalls

Video Player ๐Ÿ”ฅ แดขแด€ษชแด… แด แด„ แด˜สŸแด€yแด‡ส€ ษช๊œฑ แด€ แด›แด‡สŸแด‡ษขส€แด€แด แด˜ส€แดแดŠแด‡แด„แด› ส™แด€๊œฑแด‡แด… แดษด แด˜สส€แดษขส€แด€แด ๊œฐแดส€ แด˜สŸแด€ส

Zaid 16 Nov 30, 2022
Want to play What Would Rather on your Server? Invite the bot now! ๐Ÿ˜

What is this Bot? ๐Ÿ‘€ What You Would Rather? is a Guessing game where you guess one thing. Long Description short Take this example: You typed r!rather

FSP Gang s' YT 3 Oct 18, 2021
A Discord bot that rewards players in Minecraft for sending messages on Discord

MCRewards-Discord-Bot A Discord bot that rewards players in Minecraft for sending messages on Discord How to setup: Download this git as a .zip, or cl

3 Dec 26, 2021
Robot Swerve Test Public With Python

Robot-Swerve-Test-Public The codebase for our swerve drivetrain prototype robot.

1 Jan 09, 2022
Automatically copy the Discord Status of a Friend you share a server with (conditions have to be satisfied to work)

CopyDiscordStatusOfUser-SelfBot Basic Function Automatically copy the Discord Status of a friend User whom you share a server with (These conditions h

Certified Baller 5 Aug 05, 2022
KTUN ร–ฤŸrenci Bilgi Sistemine baฤŸlanฤฑp her 15 dakikada notlarฤฑ kontrol eden ve deฤŸiลŸiklik olduฤŸu zaman size Discord Webhook ile mesaj atan uygulama.

KTUN_Obis KTUN ร–ฤŸrenci Bilgi Sistemi KTUN ร–ฤŸrenci Bilgi Sistemine selenium kullanarak girip setttings.py dosyasฤฑnda verdiฤŸiniz bilgeri doldurup ardฤฑnd

ฤฐbrahim Uysal 5 Oct 27, 2022
Purpose To make a cloudflare challenge pass successfully, Can be use cf_clearance bypassed by cloudflare

Purpose To make a cloudflare challenge pass successfully, Can be use cf_clearance bypassed by cloudflare, However, with the cf_clearance, make sure you use the same IP and UA as when you got it.

vvanglro 129 Jan 09, 2023
A python based Telegram Bot for Compressing Videos with negligible Quality change

๐•๐•š๐••๐•–๐•  โ„‚๐•†๐•„โ„™โ„๐”ผ๐•Š๐•Š๐•†โ„ ๐”น๐•†๐•‹ แดแดœสŸแด›ษชา“แดœษดแด„แด›ษชแดษด วซแดœแด€สŸษชแด›ส แด„แดแดแด˜ส€แด‡ssแดส€ A Telegram Video CompressorBot it compress videos with negligible Quality change.

Danish 154 Dec 04, 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 05, 2022
Joshua McDonagh 1 Jan 24, 2022
Asynchronous multi-platform robot framework written in Python

NoneBot โœจ ่ทจๅนณๅฐ Python ๅผ‚ๆญฅๆœบๅ™จไบบๆก†ๆžถ โœจ ๆ–‡ๆกฃ ยท ๅฎ‰่ฃ… ยท ๅผ€ๅง‹ไฝฟ็”จ ยท ๆ–‡ๆกฃๆ‰“ไธๅผ€๏ผŸ ็ฎ€ไป‹ NoneBot2 ๆ˜ฏไธ€ไธช็Žฐไปฃใ€่ทจๅนณๅฐใ€ๅฏๆ‰ฉๅฑ•็š„ Python ่Šๅคฉๆœบๅ™จไบบๆก†ๆžถ๏ผŒๅฎƒๅŸบไบŽ Python ็š„็ฑปๅž‹ๆณจ่งฃๅ’Œๅผ‚ๆญฅ็‰นๆ€ง๏ผŒ่ƒฝๅคŸไธบไฝ ็š„้œ€ๆฑ‚ๅฎž็Žฐๆไพ›ไพฟๆท็ตๆดป็š„ๆ”ฏๆŒใ€‚

NoneBot 3.1k Jan 04, 2023
Media Replay Engine (MRE) is a framework to build automated video clipping and replay (highlight) generation pipelines for live and video-on-demand content.

Media Replay Engine (MRE) is a framework for building automated video clipping and replay (highlight) generation pipelines using AWS services for live

Amazon Web Services - Labs 30 Nov 29, 2022
PerrOS - The operating system for your discord server.

PerrOS PerrOS is a Opensource Discord Bot to do it all! Installation Use the package manager pip to install the python3 requirements. pip3 install -r

Webshort 2 Jun 20, 2022
A bot framework for Reddit to manage threads, wiki pages, widgets, menus and more.

Sub Manager Sub Manager is a bot framework for Reddit to automate a variety of tasks on one or more subreddits, and can be configured and run without

r/SpaceX 3 Aug 26, 2022
The official source code for Ghost Discord selfbot.

๐Ÿ‘ป Ghost Selfbot The official code for Ghost which was recently discontinued and released to the public. Feel free to use any of the code found in thi

Ghost 121 Nov 09, 2022
AWS Lambda - Parsing Cloudwatch Data and sending the response via email.

AWS Lambda - Parsing Cloudwatch Data and sending the response via email. Author: Evan Erickson Language: Python Backend: AWS / Serverless / AWS Lambda

Evan Scott Erickson 1 Nov 14, 2021
A simple Python TDLib wrapper

Telegram Forwarder App Description pywtdlib (Python Wrapper TDLib) is a simple synchronous Python wrapper that makes you easy to create new Python Tel

รlvaro Fernรกndez 2 Jan 04, 2023
Astro Bot With Golang

Astro-Bot Features: Astronomy Picture of the day Horoscope People In Space How we built it Our team was broken, one person didn't do anything the othe

Vaarun Sinha 1 Nov 21, 2021