mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-21 16:52:31 -05:00
Core - Add invoke error message customisation (#5894)
Co-authored-by: Jakub Kuczys <me@jacken.men>
This commit is contained in:
@@ -3646,7 +3646,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
||||
|
||||
@_set.command(name="usebuttons")
|
||||
@checks.is_owner()
|
||||
async def use_buttons(self, ctx: commands.Context, use_buttons: bool = None):
|
||||
async def _set_usebuttons(self, ctx: commands.Context, use_buttons: bool = None):
|
||||
"""
|
||||
Set a global bot variable for using buttons in menus.
|
||||
|
||||
@@ -3655,7 +3655,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
||||
This defaults to False.
|
||||
Using this without a setting will toggle.
|
||||
|
||||
**Examples:**
|
||||
**Examples:**
|
||||
- `[p]set usebuttons True` - Enables using buttons.
|
||||
- `[p]helpset usebuttons` - Toggles the value.
|
||||
|
||||
@@ -3670,6 +3670,35 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
||||
else:
|
||||
await ctx.send(_("I will not use buttons on basic menus."))
|
||||
|
||||
@_set.command(name="errormsg")
|
||||
@commands.is_owner()
|
||||
async def _set_errormsg(self, ctx: commands.Context, *, msg: str = None):
|
||||
"""
|
||||
Set the message that will be sent on uncaught bot errors.
|
||||
|
||||
To include the command name in the message, use the `{command}` placeholder.
|
||||
|
||||
If you omit the `msg` argument, the message will be reset to the default one.
|
||||
|
||||
**Examples:**
|
||||
- `[p]set errormsg` - Resets the error message back to the default: "Error in command '{command}'.". If the command invoker is one of the bot owners, the message will also include "Check your console or logs for details.".
|
||||
- `[p]set errormsg Oops, the command {command} has failed! Please try again later.` - Sets the error message to a custom one.
|
||||
|
||||
**Arguments:**
|
||||
- `[msg]` - The custom error message. Must be less than 1000 characters. Omit to reset to the default one.
|
||||
"""
|
||||
if msg is not None and len(msg) >= 1000:
|
||||
return await ctx.send(_("The message must be less than 1000 characters."))
|
||||
|
||||
if msg is not None:
|
||||
await self.bot._config.invoke_error_msg.set(msg)
|
||||
content = _("Succesfully updated the error message.")
|
||||
else:
|
||||
await self.bot._config.invoke_error_msg.clear()
|
||||
content = _("Successfully reset the error message back to the default one.")
|
||||
|
||||
await ctx.send(content)
|
||||
|
||||
@commands.group()
|
||||
@checks.is_owner()
|
||||
async def helpset(self, ctx: commands.Context):
|
||||
|
||||
Reference in New Issue
Block a user