Categorygithub.com/Alextopher/aocbot
modulepackage
0.0.0-20240918162312-142dfff1d118
Repository: https://github.com/alextopher/aocbot.git
Documentation: pkg.go.dev

# README

aoc-bot

image

A Discord bot that connects to the Advent of Code private leaderboard API. It hands out roles for achieving star milestones and unlocks daily discussion channels after challenge completion.

This bot is currently a minimum viable product. There is no usage document, and that isn't a priority yet. Get in contact with me if you want to add this to another server; I might be able to host it for the time being.

This year (2023) will serve as a trial run. I will take what I learn and try to tidy it up and launch it as a larger project in 2024.

License (MIT)

Copyright (c) 2023 Christopher Mahoney

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# Functions

NewAdventOfCode creates a new Advent of Code API.
NewBot creates a new bot.
NewDatabase creates a new database.
NewEventCreate creates a new database event for creating a claim.
NewEventDelete creates a new database event for deleting a claim.
NewEventSnapshot creates a new database event for taking a snapshot of the total scores.
NewGuildState creates a new guild state.
ParseConfig parses a config file.
ParseLeaderboard parses a leaderboard from a reader.

# Variables

ErrAlreadyClaimed is returned when a user is already claimed.
ErrDoesNotExist is returned when a user does not exist.
ErrInvalidSession is returned when the advent of code session is invalid.
ErrNotConfigured is returned when a guild is not configured.

# Structs

AdventOfCode is an Advent of Code API client.
Bot is the main bot struct.
CompletionDayLevel is the completion status of a day.
Config is the bot config.
Database keeps an append-only log file of bot operation - tracks APOD id claims - tracks APOD id unclaims - creates APOD total score snapshots.
DatabaseEvent is a single database event.
DeferredInteraction is a small wrapper around an interaction that allows for deferring the response.
EventCreate is a database event for creating a claim.
EventDelete is a database event for deleting a claim.
EventSnapshot is a database event for taking a snapshot of the total scores.
GuildConfig is the config per guild.
GuildState keeps track of the state of a single guild.
Leaderboard is what is returned by the Advent of Code API.
Member is a member of the leaderboard.