Improved some messages and prepared them for i18n

This commit is contained in:
2025-04-26 18:21:09 +02:00
parent a17b1cd768
commit ca1e47b55a
16 changed files with 167 additions and 172 deletions

View File

@@ -0,0 +1,33 @@
from datetime import datetime
from zoneinfo import ZoneInfo
from discord import ApplicationContext
async def is_operation_confirmed(ctx: ApplicationContext, confirm: bool) -> bool:
if confirm is None or not confirm:
await ctx.respond(ctx.bot._("operation_unconfirmed", "messages", locale=ctx.locale))
return False
return True
async def is_event_status_valid(
ctx: ApplicationContext,
event: "PycordEvent",
) -> bool:
if event.is_cancelled:
# TODO Make a nice message
await ctx.respond("This event was cancelled.")
return False
if (
event.starts.replace(tzinfo=ZoneInfo("UTC"))
<= datetime.now(tz=ZoneInfo("UTC"))
<= event.ends.replace(tzinfo=ZoneInfo("UTC"))
):
# TODO Make a nice message
await ctx.respond("Ongoing events cannot be modified.")
return False
return True