Files
QuizBot/cogs/stage.py

94 lines
3.1 KiB
Python

from discord import SlashCommandGroup, option, ApplicationContext, Attachment
from discord.ext.commands import Cog
from discord.utils import basic_autocomplete
from classes.pycord_bot import PycordBot
from modules.utils import autofill_active_events
class Stage(Cog):
"""Cog with event stage management commands."""
def __init__(self, bot: PycordBot):
self.bot: PycordBot = bot
command_group: SlashCommandGroup = SlashCommandGroup("stage", "Event stage management")
# TODO Implement the command
# /stage add <event> <question> <answer> <media>
# TODO Maybe add an option for order?
@command_group.command(
name="add",
description="Add new event stage",
)
@option(
"event",
description="Name of the event",
autocomplete=basic_autocomplete(autofill_active_events),
required=True,
)
@option("question", description="Question to be answered", required=True)
@option("answer", description="Answer to the stage's question", required=True)
@option("media", description="Media file to be attached", required=False)
async def command_stage_add(
self,
ctx: ApplicationContext,
event: str,
question: str,
answer: str,
media: Attachment = None,
) -> None:
await ctx.respond("Not implemented.")
# TODO Implement the command
# /stage edit <event> <stage> <order> <question> <answer> <media>
@command_group.command(
name="edit",
description="Edit the event stage",
)
@option(
"event",
description="Name of the event",
autocomplete=basic_autocomplete(autofill_active_events),
required=True,
)
@option("stage", description="Stage to edit", required=True)
@option("order", description="Number in the event stages' order", required=False)
@option("question", description="Question to be answered", required=False)
@option("answer", description="Answer to the stage's question", required=False)
@option("media", description="Media file to be attached", required=False)
async def command_stage_edit(
self,
ctx: ApplicationContext,
event: str,
stage: str,
order: int,
question: str,
answer: str,
media: Attachment = None,
) -> None:
await ctx.respond("Not implemented.")
# TODO Implement the command
# /stage delete <event> <stage> <confirm>
@command_group.command(
name="delete",
description="Delete the event stage",
)
@option(
"event",
description="Name of the event",
autocomplete=basic_autocomplete(autofill_active_events),
required=True,
)
@option("stage", description="Stage to edit", required=True)
@option("confirm", description="Confirmation of the operation", required=False)
async def command_stage_delete(
self, ctx: ApplicationContext, event: str, stage: str, confirm: bool = False
) -> None:
await ctx.respond("Not implemented.")
def setup(bot: PycordBot) -> None:
bot.add_cog(Stage(bot))