Introduced i18n for /event, /guess, /register and /unregister. Prepared other commands for i18n too
This commit is contained in:
@@ -7,6 +7,7 @@ from zoneinfo import ZoneInfo
|
||||
from bson.errors import InvalidId
|
||||
from discord import ApplicationContext, Cog, option, slash_command, TextChannel, File
|
||||
from discord.utils import basic_autocomplete
|
||||
from libbot.i18n import in_every_locale, _
|
||||
|
||||
from classes import PycordEvent, PycordGuild, PycordUser, PycordEventStage
|
||||
from classes.pycord_bot import PycordBot
|
||||
@@ -24,11 +25,15 @@ class CogRegister(Cog):
|
||||
# TODO Introduce i18n
|
||||
@slash_command(
|
||||
name="register",
|
||||
description="Enter the selected event",
|
||||
description=_("description", "commands", "register"),
|
||||
description_localizations=in_every_locale("description", "commands", "register"),
|
||||
)
|
||||
@option(
|
||||
"event",
|
||||
description="Name of the event",
|
||||
description=_("description", "commands", "register", "options", "event"),
|
||||
description_localizations=in_every_locale(
|
||||
"description", "commands", "register", "options", "event"
|
||||
),
|
||||
autocomplete=basic_autocomplete(autocomplete_active_events),
|
||||
)
|
||||
async def command_register(self, ctx: ApplicationContext, event: str) -> None:
|
||||
@@ -49,7 +54,9 @@ class CogRegister(Cog):
|
||||
|
||||
if user.is_jailed:
|
||||
# TODO Make a nice message
|
||||
await ctx.respond("You are jailed and cannot interact with events. Please, contact the administrator.")
|
||||
await ctx.respond(
|
||||
"You are jailed and cannot interact with events. Please, contact the administrator."
|
||||
)
|
||||
return
|
||||
|
||||
if pycord_event._id in user.registered_event_ids:
|
||||
|
Reference in New Issue
Block a user