Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated advent of code cog to new extension format #255

Merged
merged 16 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
311 changes: 0 additions & 311 deletions bot/cogs/adventofcode.py

This file was deleted.

2 changes: 1 addition & 1 deletion bot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class AoC(BaseModel):
channel_id: int
role_id: int
leaderboard_code: str
session_cookie: str


Expand Down Expand Up @@ -97,7 +98,6 @@ class CustomRoles(BaseModel):

class YouTube(BaseModel):
channel_id: str

text_channel_id: int
role_id: int

Expand Down
9 changes: 9 additions & 0 deletions bot/extensions/adventofcode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from bot.core import DiscordBot

from .commands import AdventOfCode
from .tasks import AdventOfCodeTasks


async def setup(bot: DiscordBot) -> None:
await bot.add_cog(AdventOfCode(bot=bot))
await bot.add_cog(AdventOfCodeTasks(bot=bot))
18 changes: 18 additions & 0 deletions bot/extensions/adventofcode/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from discord import app_commands
from discord.ext import commands

from bot import core
from bot.extensions.adventofcode.utils import home_embed
from bot.extensions.adventofcode.views import CreateAdventOfCodeView


class AdventOfCode(commands.Cog):
def __init__(self, bot):
self.bot = bot
self._create_aoc_view = CreateAdventOfCodeView(timeout=None)
self.bot.add_view(self._create_aoc_view)

@app_commands.command(name="advent-of-code")
async def advent_of_code(self, interaction: core.InteractionType):
"""Returns information about the Advent of Code"""
await interaction.response.send_message(embed=home_embed(), ephemeral=True, view=self._create_aoc_view)
Loading
Loading