@@ -1,6 +1,7 @@
|
||||
from datetime import datetime
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from bson.errors import InvalidId
|
||||
from discord import ApplicationContext, Attachment, SlashCommandGroup, option
|
||||
from discord.ext.commands import Cog
|
||||
from discord.utils import basic_autocomplete
|
||||
@@ -14,7 +15,7 @@ async def validate_event_status(
|
||||
ctx: ApplicationContext,
|
||||
event: PycordEvent,
|
||||
) -> None:
|
||||
if event.cancelled:
|
||||
if event.is_cancelled:
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("This event was cancelled.")
|
||||
return
|
||||
@@ -63,7 +64,12 @@ class Stage(Cog):
|
||||
await ctx.respond("Guild is not configured.")
|
||||
return
|
||||
|
||||
pycord_event: PycordEvent = await self.bot.find_event(event)
|
||||
try:
|
||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||
except (InvalidId, RuntimeError):
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Event was not found.")
|
||||
return
|
||||
|
||||
await validate_event_status(ctx, pycord_event)
|
||||
|
||||
@@ -123,11 +129,21 @@ class Stage(Cog):
|
||||
await ctx.respond("Guild is not configured.")
|
||||
return
|
||||
|
||||
pycord_event: PycordEvent = await self.bot.find_event(event)
|
||||
try:
|
||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||
except (InvalidId, RuntimeError):
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Event was not found.")
|
||||
return
|
||||
|
||||
await validate_event_status(ctx, pycord_event)
|
||||
|
||||
event_stage: PycordEventStage = await self.bot.find_event_stage(stage)
|
||||
try:
|
||||
event_stage: PycordEventStage = await self.bot.find_event_stage(stage)
|
||||
except (InvalidId, RuntimeError):
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Event stage was not found.")
|
||||
return
|
||||
|
||||
if order is not None and order > len(pycord_event.stage_ids):
|
||||
# TODO Make a nice message
|
||||
@@ -180,11 +196,21 @@ class Stage(Cog):
|
||||
await ctx.respond("Guild is not configured.")
|
||||
return
|
||||
|
||||
pycord_event: PycordEvent = await self.bot.find_event(event)
|
||||
try:
|
||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||
except (InvalidId, RuntimeError):
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Event was not found.")
|
||||
return
|
||||
|
||||
await validate_event_status(ctx, pycord_event)
|
||||
|
||||
event_stage: PycordEventStage = await self.bot.find_event_stage(stage)
|
||||
try:
|
||||
event_stage: PycordEventStage = await self.bot.find_event_stage(stage)
|
||||
except (InvalidId, RuntimeError):
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Event stage was not found.")
|
||||
return
|
||||
|
||||
await pycord_event.remove_stage(self.bot, event_stage._id, cache=self.bot.cache)
|
||||
await event_stage.purge(cache=self.bot.cache)
|
||||
|
Reference in New Issue
Block a user