diff options
| author | 2021-09-07 20:07:02 +0300 | |
|---|---|---|
| committer | 2021-09-07 20:07:02 +0300 | |
| commit | ed30eae8b29ad9863a297db541bb1b9fdaf9ab1e (patch) | |
| tree | c27256c50c9d9d3e23144cd566df3d060547c177 | |
| parent | Code and comments polish (diff) | |
Fix regex search
The regex was lowercased, even though regex patterns are case sensitive.
Also adds the DOTALL flag.
| -rw-r--r-- | bot/exts/moderation/clean.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py index a9f936d88..ca458f066 100644 --- a/bot/exts/moderation/clean.py +++ b/bot/exts/moderation/clean.py @@ -144,10 +144,7 @@ class Clean(Cog): content = "\n".join(attr for attr in content if attr) # Now let's see if there's a regex match - if not content: - return False - else: - return bool(re.search(regex.lower(), content.lower())) + return bool(re.search(regex, content, re.IGNORECASE + re.DOTALL)) def predicate_range(message: Message) -> bool: """Check if the message age is between the two limits.""" |