aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts
diff options
context:
space:
mode:
authorGravatar onerandomusername <[email protected]>2021-12-03 17:28:15 -0500
committerGravatar onerandomusername <[email protected]>2021-12-03 17:28:15 -0500
commit7cb5c5517043c0006b001c15373b664b86cc6b43 (patch)
tree3bb11a45c70882f532f9270b1ad362e6c2672e33 /bot/exts
parentMerge pull request #963 from python-discord/aoc-lb-multiword (diff)
feat: implement moving commands
add exceptions and handler for commands that move locations
Diffstat (limited to 'bot/exts')
-rw-r--r--bot/exts/core/error_handler.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/bot/exts/core/error_handler.py b/bot/exts/core/error_handler.py
index fd2123e7..676a1e70 100644
--- a/bot/exts/core/error_handler.py
+++ b/bot/exts/core/error_handler.py
@@ -12,7 +12,7 @@ from sentry_sdk import push_scope
from bot.bot import Bot
from bot.constants import Channels, Colours, ERROR_REPLIES, NEGATIVE_REPLIES, RedirectOutput
from bot.utils.decorators import InChannelCheckFailure, InMonthCheckFailure
-from bot.utils.exceptions import APIError, UserNotPlayingError
+from bot.utils.exceptions import APIError, MovedCommandError, UserNotPlayingError
log = logging.getLogger(__name__)
@@ -130,6 +130,14 @@ class CommandErrorHandler(commands.Cog):
)
return
+ if isinstance(error, MovedCommandError):
+ description = (
+ f"This command, `{ctx.prefix}{ctx.command.qualified_name}` has moved to `{error.new_command_name}`.\n"
+ f"Please use `{error.new_command_name}` instead."
+ )
+ await ctx.send(embed=self.error_embed(description, NEGATIVE_REPLIES))
+ return
+
with push_scope() as scope:
scope.user = {
"id": ctx.author.id,