aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-06-14 21:38:42 +0100
committerGravatar Chris Lovering <[email protected]>2022-06-14 21:38:42 +0100
commitf5db715060791bc0ac52855a6bbdf80adbb2ccc6 (patch)
tree51ddf135cc9f42bcec998629ce0be54ac942ccf1
parentMerge pull request #2192 from python-discord/fix_invite_autoban (diff)
Only check for autoban filters if reason key is present and not None
Fixes bot#2194 Fixes BOT-35H
-rw-r--r--bot/exts/filters/filtering.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/bot/exts/filters/filtering.py b/bot/exts/filters/filtering.py
index 1289dfe41..13035c0c8 100644
--- a/bot/exts/filters/filtering.py
+++ b/bot/exts/filters/filtering.py
@@ -393,7 +393,9 @@ class Filtering(Cog):
autoban = reason and "[autoban]" in reason.lower()
if not autoban and filter_name == "filter_invites" and isinstance(result, dict):
autoban = any(
- "[autoban]" in invite_info.get("reason", "").lower() for invite_info in result.values()
+ "[autoban]" in invite_info["reason"].lower()
+ for invite_info in result.values()
+ if invite_info.get("reason")
)
if autoban:
# Create a new context, with the author as is the bot, and the channel as #mod-alerts.