Fixed some event-related issues and guessing
This commit is contained in:
@@ -364,6 +364,12 @@ class PycordUser:
|
||||
cache, current_stage_id=stage_id if isinstance(stage_id, str) else ObjectId(stage_id)
|
||||
)
|
||||
|
||||
# TODO Add documentation
|
||||
async def set_event(self, event_id: str | ObjectId | None, cache: Optional[Cache] = None) -> None:
|
||||
await self._set(
|
||||
cache, current_event_id=event_id if isinstance(event_id, str) else ObjectId(event_id)
|
||||
)
|
||||
|
||||
# TODO Add documentation
|
||||
async def jail(self, cache: Optional[Cache] = None) -> None:
|
||||
await self._set(cache, is_jailed=True)
|
||||
|
@@ -101,7 +101,7 @@ class CogGuess(Cog):
|
||||
files=files,
|
||||
)
|
||||
|
||||
await user.set_event_stage(next_stage._id, cache=self.bot.cache)
|
||||
await user.set_event(next_stage._id, cache=self.bot.cache)
|
||||
|
||||
await self.bot.notify_admins(
|
||||
ctx.guild,
|
||||
|
@@ -72,6 +72,8 @@ class CogRegister(Cog):
|
||||
)
|
||||
|
||||
if pycord_event.starts.replace(tzinfo=ZoneInfo("UTC")) < datetime.now(tz=ZoneInfo("UTC")):
|
||||
await user.set_event(pycord_event._id, cache=self.bot.cache)
|
||||
|
||||
user_channel: TextChannel = await user.setup_event_channel(
|
||||
self.bot, ctx.guild, guild, pycord_event, cache=self.bot.cache
|
||||
)
|
||||
@@ -106,6 +108,8 @@ class CogRegister(Cog):
|
||||
|
||||
first_stage: PycordEventStage = await self.bot.find_event_stage(pycord_event.stage_ids[0])
|
||||
|
||||
await user.set_event_stage(first_stage._id, cache=self.bot.cache)
|
||||
|
||||
first_stage_files: List[File] | None = first_stage.get_media_files()
|
||||
|
||||
await user_channel.send(f"First stage...\n\n{first_stage.question}", files=first_stage_files)
|
||||
|
@@ -18,7 +18,7 @@ async def validate_event_validity(
|
||||
guild_timezone: ZoneInfo,
|
||||
event_id: ObjectId | None = None,
|
||||
) -> bool:
|
||||
if start_date > finish_date:
|
||||
if start_date >= finish_date:
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Start date must be before finish date")
|
||||
return False
|
||||
|
Reference in New Issue
Block a user