diff options
| author | 2022-09-10 18:09:04 +0100 | |
|---|---|---|
| committer | 2022-09-10 18:09:04 +0100 | |
| commit | c8eb0abc9a9427945019cef6d582fa9a55a1f4e7 (patch) | |
| tree | 4c1c7e45847d9f1f08dd830d8d3c9453839ec018 | |
| parent | Merge pull request #2234 from python-discord/infraction-durations (diff) | |
Check for commands being None in try_get_tag and try_silence
| -rw-r--r-- | bot/exts/backend/error_handler.py | 10 |
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..0321134ea 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 False + ctx.invoked_from_error_handler = True log_msg = "Cancelling attempt to fall back to a tag due to failed checks." |