Added i18n to the jailing mechanism
This commit is contained in:
@@ -191,8 +191,7 @@ class CogEvent(Cog):
|
|||||||
try:
|
try:
|
||||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||||
except (InvalidId, EventNotFoundError):
|
except (InvalidId, EventNotFoundError):
|
||||||
# TODO Make a nice message
|
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale), ephemeral=True)
|
||||||
await ctx.respond("Event was not found.")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if not guild.is_configured():
|
if not guild.is_configured():
|
||||||
@@ -287,8 +286,7 @@ class CogEvent(Cog):
|
|||||||
try:
|
try:
|
||||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||||
except (InvalidId, EventNotFoundError):
|
except (InvalidId, EventNotFoundError):
|
||||||
# TODO Make a nice message
|
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale), ephemeral=True)
|
||||||
await ctx.respond("Event was not found.")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if not guild.is_configured():
|
if not guild.is_configured():
|
||||||
@@ -333,8 +331,7 @@ class CogEvent(Cog):
|
|||||||
try:
|
try:
|
||||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||||
except (InvalidId, EventNotFoundError):
|
except (InvalidId, EventNotFoundError):
|
||||||
# TODO Make a nice message
|
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale), ephemeral=True)
|
||||||
await ctx.respond("Event was not found.")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
starts_date: datetime = pycord_event.get_start_date_utc()
|
starts_date: datetime = pycord_event.get_start_date_utc()
|
||||||
|
@@ -46,7 +46,7 @@ class CogRegister(Cog):
|
|||||||
try:
|
try:
|
||||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||||
except (InvalidId, EventNotFoundError):
|
except (InvalidId, EventNotFoundError):
|
||||||
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale))
|
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not guild.is_configured():
|
if not guild.is_configured():
|
||||||
|
@@ -94,8 +94,7 @@ class CogStage(Cog):
|
|||||||
try:
|
try:
|
||||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||||
except (InvalidId, EventStageNotFoundError):
|
except (InvalidId, EventStageNotFoundError):
|
||||||
# TODO Make a nice message
|
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale), ephemeral=True)
|
||||||
await ctx.respond("Event was not found.")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if not (await is_event_status_valid(ctx, pycord_event)):
|
if not (await is_event_status_valid(ctx, pycord_event)):
|
||||||
@@ -208,8 +207,7 @@ class CogStage(Cog):
|
|||||||
try:
|
try:
|
||||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||||
except (InvalidId, EventNotFoundError):
|
except (InvalidId, EventNotFoundError):
|
||||||
# TODO Make a nice message
|
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale), ephemeral=True)
|
||||||
await ctx.respond("Event was not found.")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if not (await is_event_status_valid(ctx, pycord_event)):
|
if not (await is_event_status_valid(ctx, pycord_event)):
|
||||||
@@ -293,8 +291,7 @@ class CogStage(Cog):
|
|||||||
try:
|
try:
|
||||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||||
except (InvalidId, EventNotFoundError):
|
except (InvalidId, EventNotFoundError):
|
||||||
# TODO Make a nice message
|
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale), ephemeral=True)
|
||||||
await ctx.respond("Event was not found.")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if not (await is_event_status_valid(ctx, pycord_event)):
|
if not (await is_event_status_valid(ctx, pycord_event)):
|
||||||
|
@@ -49,7 +49,7 @@ class CogUnregister(Cog):
|
|||||||
try:
|
try:
|
||||||
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
pycord_event: PycordEvent = await self.bot.find_event(event_id=event)
|
||||||
except (InvalidId, EventNotFoundError):
|
except (InvalidId, EventNotFoundError):
|
||||||
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale))
|
await ctx.respond(self.bot._("event_not_found", "messages", locale=ctx.locale), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not guild.is_configured():
|
if not guild.is_configured():
|
||||||
|
@@ -90,15 +90,20 @@ class CogUser(Cog):
|
|||||||
pycord_user: PycordUser = await self.bot.find_user(user, ctx.guild)
|
pycord_user: PycordUser = await self.bot.find_user(user, ctx.guild)
|
||||||
|
|
||||||
if pycord_user.is_jailed:
|
if pycord_user.is_jailed:
|
||||||
# TODO Introduce i18n
|
await ctx.respond(
|
||||||
await ctx.respond(f"User **{user.display_name}** is already jailed.")
|
self.bot._("user_jail_already_jailed", "messages", locale=ctx.locale).format(
|
||||||
|
display_name=user.display_name
|
||||||
|
),
|
||||||
|
ephemeral=True,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
await pycord_user.jail(self.bot.cache)
|
await pycord_user.jail(self.bot.cache)
|
||||||
|
|
||||||
# TODO Introduce i18n
|
|
||||||
await ctx.respond(
|
await ctx.respond(
|
||||||
f"User **{user.display_name}** has been jailed and cannot interact with events anymore."
|
self.bot._("user_jail_successful", "messages", locale=ctx.locale).format(
|
||||||
|
display_name=user.display_name
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@command_group.command(
|
@command_group.command(
|
||||||
@@ -128,15 +133,20 @@ class CogUser(Cog):
|
|||||||
pycord_user: PycordUser = await self.bot.find_user(user, ctx.guild)
|
pycord_user: PycordUser = await self.bot.find_user(user, ctx.guild)
|
||||||
|
|
||||||
if not pycord_user.is_jailed:
|
if not pycord_user.is_jailed:
|
||||||
# TODO Introduce i18n
|
await ctx.respond(
|
||||||
await ctx.respond(f"User **{user.display_name}** is not jailed.")
|
self.bot._("user_unjail_not_jailed", "messages", locale=ctx.locale).format(
|
||||||
|
display_name=user.display_name
|
||||||
|
),
|
||||||
|
ephemeral=True,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
await pycord_user.unjail(self.bot.cache)
|
await pycord_user.unjail(self.bot.cache)
|
||||||
|
|
||||||
# TODO Introduce i18n
|
|
||||||
await ctx.respond(
|
await ctx.respond(
|
||||||
f"User **{user.display_name}** has been unjailed and can interact with events again."
|
self.bot._("user_unjail_successful", "messages", locale=ctx.locale).format(
|
||||||
|
display_name=user.display_name
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -24,7 +24,11 @@
|
|||||||
"timezone_invalid": "Timezone **{timezone}** was not found. Please, select one of the timezones provided by the autocompletion.",
|
"timezone_invalid": "Timezone **{timezone}** was not found. Please, select one of the timezones provided by the autocompletion.",
|
||||||
"unexpected_error": "An unexpected error has occurred. Please, contact the administrator.",
|
"unexpected_error": "An unexpected error has occurred. Please, contact the administrator.",
|
||||||
"unregister_not_registered": "You are not registered for this event.",
|
"unregister_not_registered": "You are not registered for this event.",
|
||||||
"unregister_unregistered": "You are no longer registered for this event."
|
"unregister_unregistered": "You are no longer registered for this event.",
|
||||||
|
"user_jail_already_jailed": "User **{display_name}** is already jailed.",
|
||||||
|
"user_jail_successful": "User **{display_name}** has been jailed and cannot interact with events anymore.",
|
||||||
|
"user_unjail_not_jailed": "User **{display_name}** is not jailed.",
|
||||||
|
"user_unjail_successful": "User **{display_name}** has been unjailed and can interact with events again."
|
||||||
},
|
},
|
||||||
"commands": {
|
"commands": {
|
||||||
"config": {
|
"config": {
|
||||||
|
Reference in New Issue
Block a user