Improved (still partial) i18n for /stage and /user
This commit is contained in:
110
cogs/cog_user.py
110
cogs/cog_user.py
@@ -5,6 +5,7 @@ from discord import (
|
||||
option,
|
||||
)
|
||||
from discord.ext.commands import Cog
|
||||
from libbot.i18n import _, in_every_locale
|
||||
|
||||
from classes import PycordUser
|
||||
from classes.pycord_bot import PycordBot
|
||||
@@ -17,58 +18,71 @@ class CogUser(Cog):
|
||||
def __init__(self, bot: PycordBot):
|
||||
self.bot: PycordBot = bot
|
||||
|
||||
# TODO Introduce i18n
|
||||
command_group: SlashCommandGroup = SlashCommandGroup("user", "User management")
|
||||
command_group: SlashCommandGroup = SlashCommandGroup(
|
||||
"user",
|
||||
description=_("description", "commands", "user"),
|
||||
description_localizations=in_every_locale("description", "commands", "user"),
|
||||
)
|
||||
|
||||
# TODO Implement the command
|
||||
@command_group.command(
|
||||
name="create_channel",
|
||||
description="Create channel for the user",
|
||||
)
|
||||
@option(
|
||||
"user",
|
||||
description="Selected user",
|
||||
)
|
||||
async def command_user_create_channel(self, ctx: ApplicationContext, user: User) -> None:
|
||||
await ctx.respond("Not implemented.")
|
||||
# @command_group.command(
|
||||
# name="create_channel",
|
||||
# description="Create channel for the user",
|
||||
# )
|
||||
# @option(
|
||||
# "user",
|
||||
# description="Selected user",
|
||||
# )
|
||||
# async def command_user_create_channel(self, ctx: ApplicationContext, user: User) -> None:
|
||||
# await ctx.respond("Not implemented.")
|
||||
|
||||
# TODO Implement the command
|
||||
@command_group.command(
|
||||
name="update_channel",
|
||||
description="Update user's channel",
|
||||
)
|
||||
@option(
|
||||
"user",
|
||||
description="Selected user",
|
||||
)
|
||||
async def command_user_update_channel(self, ctx: ApplicationContext, user: User) -> None:
|
||||
await ctx.respond("Not implemented.")
|
||||
# @command_group.command(
|
||||
# name="update_channel",
|
||||
# description="Update user's channel",
|
||||
# )
|
||||
# @option(
|
||||
# "user",
|
||||
# description="Selected user",
|
||||
# )
|
||||
# async def command_user_update_channel(self, ctx: ApplicationContext, user: User) -> None:
|
||||
# await ctx.respond("Not implemented.")
|
||||
|
||||
# TODO Implement the command
|
||||
@command_group.command(
|
||||
name="delete_channel",
|
||||
description="Delete user's channel",
|
||||
)
|
||||
@option(
|
||||
"user",
|
||||
description="Selected user",
|
||||
)
|
||||
@option("confirm", description="Confirmation of the operation", required=False)
|
||||
async def command_user_delete_channel(
|
||||
self, ctx: ApplicationContext, user: User, confirm: bool = False
|
||||
) -> None:
|
||||
await ctx.respond("Not implemented.")
|
||||
# @command_group.command(
|
||||
# name="delete_channel",
|
||||
# description="Delete user's channel",
|
||||
# )
|
||||
# @option(
|
||||
# "user",
|
||||
# description="Selected user",
|
||||
# )
|
||||
# @option("confirm", description="Confirmation of the operation", required=False)
|
||||
# async def command_user_delete_channel(
|
||||
# self, ctx: ApplicationContext, user: User, confirm: bool = False
|
||||
# ) -> None:
|
||||
# await ctx.respond("Not implemented.")
|
||||
|
||||
# TODO Introduce i18n
|
||||
@command_group.command(
|
||||
name="jail",
|
||||
description="Jail the user",
|
||||
description=_("description", "commands", "user_jail"),
|
||||
description_localizations=in_every_locale("description", "commands", "user_jail"),
|
||||
)
|
||||
@option(
|
||||
"user",
|
||||
description="Selected user",
|
||||
description=_("description", "commands", "user_jail", "options", "user"),
|
||||
description_localizations=in_every_locale(
|
||||
"description", "commands", "user_jail", "options", "user"
|
||||
),
|
||||
)
|
||||
@option(
|
||||
"confirm",
|
||||
description=_("description", "commands", "user_jail", "options", "confirm"),
|
||||
description_localizations=in_every_locale(
|
||||
"description", "commands", "user_jail", "options", "confirm"
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
@option("confirm", description="Confirmation of the operation", required=False)
|
||||
async def command_user_jail(self, ctx: ApplicationContext, user: User, confirm: bool = False) -> None:
|
||||
if not (await is_operation_confirmed(ctx, confirm)):
|
||||
return
|
||||
@@ -87,16 +101,26 @@ class CogUser(Cog):
|
||||
f"User **{user.display_name}** has been jailed and cannot interact with events anymore."
|
||||
)
|
||||
|
||||
# TODO Introduce i18n
|
||||
@command_group.command(
|
||||
name="unjail",
|
||||
description="Unjail the user",
|
||||
description=_("description", "commands", "user_unjail"),
|
||||
description_localizations=in_every_locale("description", "commands", "user_unjail"),
|
||||
)
|
||||
@option(
|
||||
"user",
|
||||
description="Selected user",
|
||||
description=_("description", "commands", "user_unjail", "options", "user"),
|
||||
description_localizations=in_every_locale(
|
||||
"description", "commands", "user_unjail", "options", "user"
|
||||
),
|
||||
)
|
||||
@option(
|
||||
"confirm",
|
||||
description=_("description", "commands", "user_unjail", "options", "confirm"),
|
||||
description_localizations=in_every_locale(
|
||||
"description", "commands", "user_unjail", "options", "confirm"
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
@option("confirm", description="Confirmation of the operation", required=False)
|
||||
async def command_user_unjail(self, ctx: ApplicationContext, user: User, confirm: bool = False) -> None:
|
||||
if not (await is_operation_confirmed(ctx, confirm)):
|
||||
return
|
||||
|
Reference in New Issue
Block a user