From f5db715060791bc0ac52855a6bbdf80adbb2ccc6 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 14 Jun 2022 21:38:42 +0100 Subject: Only check for autoban filters if reason key is present and not None Fixes bot#2194 Fixes BOT-35H --- bot/exts/filters/filtering.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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. -- cgit v1.2.3