aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2021-10-25 22:00:58 +0300
committerGravatar mbaruh <[email protected]>2021-10-25 22:00:58 +0300
commitb42f148955600d85260c43c50260333fe62b823e (patch)
treee19ee5a2a7d00dbebf2b873c788330903078696f
parentAdjust docstring to #1876 (diff)
Apply requested style changes
-rw-r--r--bot/exts/moderation/clean.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py
index c01430a04..65ffec88b 100644
--- a/bot/exts/moderation/clean.py
+++ b/bot/exts/moderation/clean.py
@@ -1,3 +1,4 @@
+import contextlib
import logging
import re
import time
@@ -46,7 +47,8 @@ class Regex(Converter):
async def convert(self, ctx: Context, argument: str) -> re.Pattern:
"""Strips the backticks from the string and compiles it to a regex pattern."""
- if not (match := re.fullmatch(r"`(.+?)`", argument)):
+ match = re.fullmatch(r"`(.+?)`", argument)
+ if not match:
raise BadArgument("Regex pattern missing wrapping backticks")
try:
return re.compile(match.group(1), re.IGNORECASE + re.DOTALL)
@@ -252,12 +254,8 @@ class Clean(Cog):
# Ensure that deletion was not canceled
if not self.cleaning:
return deleted
- try:
+ with contextlib.suppress(NotFound): # Message doesn't exist or was already deleted
await message.delete()
- except NotFound:
- # Message doesn't exist or was already deleted
- continue
- else:
deleted.append(message)
return deleted