diff options
| author | 2022-06-14 22:52:52 +0100 | |
|---|---|---|
| committer | 2022-06-14 23:13:11 +0100 | |
| commit | adac8e8eb687f2c36c8d9ee55b25e51aa95a1d0b (patch) | |
| tree | 114e19b5969f2157c26ec508f046cd47b9b3acfc | |
| parent | Merge pull request #2195 from python-discord/fix/bot#2194 (diff) | |
Always prepend guild name to guild invite filters.
Some guild invites are autoban filters, which require the mod to set a comment which includes [autoban].
Having the guild name in the comment is still useful when reviewing filter list, so prepend it to the set comment in case some mod forgets.
Co-authored-by: Alex Noel <[email protected]>
| -rw-r--r-- | bot/exts/filters/filter_lists.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bot/exts/filters/filter_lists.py b/bot/exts/filters/filter_lists.py index fc9cfbeca..cc3a61212 100644 --- a/bot/exts/filters/filter_lists.py +++ b/bot/exts/filters/filter_lists.py @@ -55,17 +55,20 @@ class FilterLists(Cog): """Add an item to a filterlist.""" allow_type = "whitelist" if allowed else "blacklist" - # If this is a server invite, we gotta validate it. + # If this is a guild invite, we gotta validate it. if list_type == "GUILD_INVITE": guild_data = await self._validate_guild_invite(ctx, content) content = guild_data.get("id") - # Unless the user has specified another comment, let's - # use the server name as the comment so that the list - # of guild IDs will be more easily readable when we - # display it. - if not comment: - comment = guild_data.get("name") + # Some guild invites are autoban filters, which require the mod + # to set a comment which includes [autoban]. + # Having the guild name in the comment is still useful when reviewing + # filter list, so prepend it to the set comment in case some mod forgets. + comment = " - ".join( + comment_part + for comment_part in (guild_data.get("name", ""), comment) + if comment_part + ) # If it's a file format, let's make sure it has a leading dot. elif list_type == "FILE_FORMAT" and not content.startswith("."): |