From 94c4cdbf65c44eb9044df067388ce591e622309c Mon Sep 17 00:00:00 2001 From: profitroll Date: Sat, 26 Apr 2025 19:16:34 +0200 Subject: [PATCH] Registering after the event already began will now create a channel --- classes/pycord_bot.py | 3 +++ cogs/cog_register.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/classes/pycord_bot.py b/classes/pycord_bot.py index 5538ce2..4be5a39 100644 --- a/classes/pycord_bot.py +++ b/classes/pycord_bot.py @@ -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 diff --git a/cogs/cog_register.py b/cogs/cog_register.py index c61a77a..803f155 100644 --- a/cogs/cog_register.py +++ b/cogs/cog_register.py @@ -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 . 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))