Implemented /stage add (#2)
This commit is contained in:
@@ -2,6 +2,7 @@ from discord import SlashCommandGroup, option, ApplicationContext, Attachment
|
||||
from discord.ext.commands import Cog
|
||||
from discord.utils import basic_autocomplete
|
||||
|
||||
from classes import PycordGuild, PycordEventStage, PycordEvent
|
||||
from classes.pycord_bot import PycordBot
|
||||
from modules.utils import autofill_active_events
|
||||
|
||||
@@ -14,8 +15,7 @@ class Stage(Cog):
|
||||
|
||||
command_group: SlashCommandGroup = SlashCommandGroup("stage", "Event stage management")
|
||||
|
||||
# TODO Implement the command
|
||||
# /stage add <event> <question> <answer> <media>
|
||||
# TODO Introduce i18n
|
||||
# TODO Maybe add an option for order?
|
||||
@command_group.command(
|
||||
name="add",
|
||||
@@ -38,7 +38,27 @@ class Stage(Cog):
|
||||
answer: str,
|
||||
media: Attachment = None,
|
||||
) -> None:
|
||||
await ctx.respond("Not implemented.")
|
||||
guild: PycordGuild = await self.bot.find_guild(ctx.guild.id)
|
||||
pycord_event: PycordEvent = await self.bot.find_event(event)
|
||||
|
||||
if not guild.is_configured():
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Guild is not configured.")
|
||||
return
|
||||
|
||||
event_stage: PycordEventStage = await self.bot.create_event_stage(
|
||||
event=pycord_event,
|
||||
event_id=pycord_event._id,
|
||||
guild_id=guild.id,
|
||||
sequence=len(pycord_event.stage_ids),
|
||||
creator_id=ctx.author.id,
|
||||
question=question,
|
||||
answer=answer,
|
||||
media=None if media is None else media.id,
|
||||
)
|
||||
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Event stage has been created.")
|
||||
|
||||
# TODO Implement the command
|
||||
# /stage edit <event> <stage> <order> <question> <answer> <media>
|
||||
|
Reference in New Issue
Block a user