Core - Add invoke error message customisation (#5894)

Co-authored-by: Jakub Kuczys <me@jacken.men>
This commit is contained in:
Predä
2022-12-30 04:43:37 +01:00
committed by GitHub
parent 88a348210c
commit 60a9d47003
5 changed files with 76 additions and 13 deletions

View File

@@ -266,16 +266,21 @@ def init_events(bot, cli_flags):
"Exception in command '{}'".format(ctx.command.qualified_name),
exc_info=error.original,
)
message = _(
"Error in command '{command}'. Check your console or logs for details."
).format(command=ctx.command.qualified_name)
exception_log = "Exception in command '{}'\n" "".format(ctx.command.qualified_name)
exception_log += "".join(
traceback.format_exception(type(error), error, error.__traceback__)
)
bot._last_exception = exception_log
await ctx.send(inline(message))
message = await bot._config.invoke_error_msg()
if not message:
if ctx.author.id in bot.owner_ids:
message = inline(
_("Error in command '{command}'. Check your console or logs for details.")
)
else:
message = inline(_("Error in command '{command}'."))
await ctx.send(message.replace("{command}", ctx.command.qualified_name))
elif isinstance(error, commands.CommandNotFound):
help_settings = await HelpSettings.from_context(ctx)
fuzzy_commands = await fuzzy_command_search(