1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 18:03:12 +00:00

Changes to NotOwner error handling

This commit is contained in:
wlinator 2024-08-29 09:34:18 -04:00
parent aa9aae2657
commit 79d64f793c
2 changed files with 12 additions and 4 deletions

View file

@ -47,8 +47,13 @@ async def handle_error(
description = CONST.STRINGS["error_no_private_message_description"]
elif isinstance(error, commands.NotOwner):
author_text = CONST.STRINGS["error_not_owner_author"]
description = CONST.STRINGS["error_not_owner_description"]
logger.warning(
CONST.STRINGS["error_not_owner"].format(
ctx.author.name,
ctx.command.qualified_name if ctx.command else CONST.STRINGS["error_not_owner_unknown"],
),
)
return
elif isinstance(error, commands.PrivateMessageOnly):
author_text = CONST.STRINGS["error_private_message_only_author"]
@ -102,6 +107,9 @@ class ErrorHandler(commands.Cog):
if ctx.command is None:
return
if isinstance(error, commands.NotOwner | exceptions.Blacklisted):
return
log_msg = f"{ctx.author.name} executed {command_type}{ctx.command.qualified_name}"
log_msg += " in DMs" if ctx.guild is None else f" | guild: {ctx.guild.name} "

View file

@ -171,8 +171,8 @@
"error_no_private_message_author": "Guild Only",
"error_no_private_message_description": "this command can only be used in servers.",
"error_not_enough_cash": "you don't have enough cash.",
"error_not_owner_author": "Owner Only",
"error_not_owner_description": "this command requires Lumi ownership permissions.",
"error_not_owner": "{0} tried to use a bot admin command ({1})",
"error_not_owner_unknown": "Unknown",
"error_out_of_time": "you ran out of time.",
"error_out_of_time_economy": "you ran out of time. Your bet was forfeited.",
"error_private_message_only_author": "Private Message Only",