diff options
| author | 2021-09-11 20:34:50 +0300 | |
|---|---|---|
| committer | 2021-09-11 20:34:50 +0300 | |
| commit | e215fb03552f822e6e702e741956ee17d07f6117 (patch) | |
| tree | 5de615765ed47e23d5b7319e077b61be925d505e | |
| parent | Handle Regex converter errors (diff) | |
End clean on unexpected errors
Added a cog_command_error method that sets cleaning to False when a command ends on an exception.
I don't have anything in mind that might cause this, but it will ensure that in any case the cog will still be usable.
| -rw-r--r-- | bot/exts/moderation/clean.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py index af79d5a35..3fb2c2870 100644 --- a/bot/exts/moderation/clean.py +++ b/bot/exts/moderation/clean.py @@ -588,6 +588,10 @@ class Clean(Cog): """Only allow moderators to invoke the commands in this cog.""" return await has_any_role(*MODERATION_ROLES).predicate(ctx) + async def cog_command_error(self, ctx: Context, error: Exception) -> None: + """Safely end the cleaning operation on unexpected errors.""" + self.cleaning = False + def setup(bot: Bot) -> None: """Load the Clean cog.""" |