aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Boris Muratov <[email protected]>2022-10-18 20:16:34 +0300
committerGravatar GitHub <[email protected]>2022-10-18 20:16:34 +0300
commit4a3321bd486121628a2281f05e58802f709b593c (patch)
treedec397fa169dab19976b4c00e335a808e50533b7
parentMerge pull request #2283 from shtlrs/1379-tranform-urls-upon-rich-embed-filte... (diff)
parentMerge branch 'main' into fix-silence-and-tags-when-unloaded (diff)
Merge pull request #2274 from python-discord/fix-silence-and-tags-when-unloaded
Check for commands being None in try_get_tag and try_silence
-rw-r--r--bot/exts/backend/error_handler.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/bot/exts/backend/error_handler.py b/bot/exts/backend/error_handler.py
index 761991488..a23d7c9fc 100644
--- a/bot/exts/backend/error_handler.py
+++ b/bot/exts/backend/error_handler.py
@@ -116,9 +116,13 @@ class ErrorHandler(Cog):
* invoked with `unshh+` unsilence channel
Return bool depending on success of command.
"""
+ silence_command = self.bot.get_command("silence")
+ if not silence_command:
+ log.debug("Not attempting to parse message as `shh`/`unshh` as could not find `silence` command.")
+ return False
+
command = ctx.invoked_with.lower()
args = ctx.message.content.lower().split(" ")
- silence_command = self.bot.get_command("silence")
ctx.invoked_from_error_handler = True
try:
@@ -164,6 +168,10 @@ class ErrorHandler(Cog):
the context to prevent infinite recursion in the case of a CommandNotFound exception.
"""
tags_get_command = self.bot.get_command("tags get")
+ if not tags_get_command:
+ log.debug("Not attempting to parse message as a tag as could not find `tags get` command.")
+ return
+
ctx.invoked_from_error_handler = True
log_msg = "Cancelling attempt to fall back to a tag due to failed checks."