Registering after the event already began will now create a channel

This commit is contained in:
2025-04-26 19:16:34 +02:00
parent 3e9edf91d5
commit 94c4cdbf65
2 changed files with 9 additions and 0 deletions

View File

@@ -81,7 +81,10 @@ class PycordBot(LibPycordBot):
f"Could not start the event **{event.name}**: no event stages are defined.",
)
await event.cancel(self.cache)
continue
first_stage: PycordEventStage = await self.find_event_stage(event.stage_ids[0])
# Get list of participants

View File

@@ -1,3 +1,6 @@
from datetime import datetime
from zoneinfo import ZoneInfo
from bson.errors import InvalidId
from discord import ApplicationContext, Cog, option, slash_command
from discord.utils import basic_autocomplete
@@ -56,6 +59,9 @@ class CogRegister(Cog):
f"You are now registered for the event **{pycord_event.name}**.\n\nNew channel will be created for you and further instructions will be provided as soon as the event starts <t:{get_unix_timestamp(pycord_event.starts)}:R>. Good luck!"
)
if pycord_event.starts < datetime.now(tz=ZoneInfo("UTC")):
await user.setup_event_channel(self.bot, ctx.guild, guild, event, cache=self.bot.cache)
def setup(bot: PycordBot) -> None:
bot.add_cog(CogRegister(bot))