Files
QuizBot/cogs/event.py
2025-04-18 18:18:26 +02:00

79 lines
2.5 KiB
Python

from discord import ApplicationContext, Attachment, SlashCommandGroup, option
from discord.ext.commands import Cog
from classes import PycordGuild
from classes.pycord_bot import PycordBot
class Event(Cog):
"""Cog with event management commands."""
def __init__(self, bot: PycordBot):
self.bot: PycordBot = bot
# TODO Introduce i18n
command_group: SlashCommandGroup = SlashCommandGroup("event", "Event management")
# TODO Implement the command
@command_group.command(
name="create",
description="Create new event",
)
@option("name", description="Name of the event", required=True)
@option("start", description="Date when the event starts (DD.MM.YYYY)", required=True)
@option("finish", description="Date when the event finishes (DD.MM.YYYY)", required=True)
@option("thumbnail", description="Thumbnail of the event", required=False)
async def command_event_create(
self,
ctx: ApplicationContext,
name: str,
start: str,
finish: str,
thumbnail: Attachment = None,
) -> None:
guild: PycordGuild = await self.bot.find_guild(ctx.guild.id)
await ctx.respond("Not implemented.")
# TODO Implement the command
@command_group.command(
name="edit",
description="Edit event",
)
@option("event", description="Name of the event", required=True)
@option("name", description="New name of the event", required=False)
@option("start", description="Date when the event starts (DD.MM.YYYY)", required=False)
@option("finish", description="Date when the event finishes (DD.MM.YYYY)", required=False)
@option("thumbnail", description="Thumbnail of the event", required=False)
async def command_event_edit(
self,
ctx: ApplicationContext,
event: str,
name: str,
start: str,
finish: str,
thumbnail: Attachment = None,
) -> None:
guild: PycordGuild = await self.bot.find_guild(ctx.guild.id)
await ctx.respond("Not implemented.")
# TODO Implement the command
@command_group.command(
name="cancel",
description="Cancel event",
)
@option("name", description="Name of the event", required=True)
async def command_event_cancel(
self,
ctx: ApplicationContext,
name: str,
) -> None:
guild: PycordGuild = await self.bot.find_guild(ctx.guild.id)
await ctx.respond("Not implemented.")
def setup(bot: PycordBot) -> None:
bot.add_cog(Event(bot))