diff options
author | 2022-06-13 22:31:29 +0100 | |
---|---|---|
committer | 2022-06-13 22:31:29 +0100 | |
commit | f47d686abb10da15745ecbdc60f54b9bdbfb6094 (patch) | |
tree | abb56e624cfe71601fc3fe4c85df5c4f3bbc97c8 | |
parent | Merge pull request #2191 from python-discord/auto-bump-nomination-threads (diff) | |
parent | Merge branch 'main' into fix_invite_autoban (diff) |
Merge pull request #2192 from python-discord/fix_invite_autoban
-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. |