diff options
author | 2022-06-13 20:02:08 +0300 | |
---|---|---|
committer | 2022-06-13 20:02:08 +0300 | |
commit | bc927c5eade36835c1877b3ed6ace5f826181a5c (patch) | |
tree | 66dbc07bac09aef0dd32708767935e2f9a1f3ab8 | |
parent | Add reroll command. (#1568) (diff) |
Fix autobans not working for invite filters
-rw-r--r-- | bot/exts/filters/filtering.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bot/exts/filters/filtering.py b/bot/exts/filters/filtering.py index 70f59c1ee..1289dfe41 100644 --- a/bot/exts/filters/filtering.py +++ b/bot/exts/filters/filtering.py @@ -390,7 +390,12 @@ class Filtering(Cog): await self._send_log(filter_name, _filter, msg, stats, reason) # If the filter reason contains `[autoban]`, we want to auto-ban the user - if reason and "[autoban]" in reason.lower(): + 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() + ) + if autoban: # Create a new context, with the author as is the bot, and the channel as #mod-alerts. # This sends the ban confirmation directly under watchlist trigger embed, to inform # mods that the user was auto-banned for the message. |