Fixed event validation
This commit is contained in:
@@ -17,16 +17,16 @@ async def validate_event_validity(
|
||||
finish_date: datetime | None,
|
||||
guild_timezone: ZoneInfo,
|
||||
event_id: ObjectId | None = None,
|
||||
) -> None:
|
||||
) -> bool:
|
||||
if start_date > finish_date:
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Start date must be before finish date")
|
||||
return
|
||||
return False
|
||||
|
||||
if start_date < datetime.now(tz=guild_timezone):
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("Start date must not be in the past")
|
||||
return
|
||||
return False
|
||||
|
||||
# TODO Add validation for concurrent events.
|
||||
# Only one event can take place at the same time.
|
||||
@@ -43,4 +43,6 @@ async def validate_event_validity(
|
||||
if (await col_events.find_one(query)) is not None:
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("There can only be one active event with the same name")
|
||||
return
|
||||
return False
|
||||
|
||||
return True
|
||||
|
Reference in New Issue
Block a user