aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| | | | | * | | | | fix: Use existing filters webhook if foundGravatar mbaruh2022-11-27-6/+16
| | | | | | | | | |
| | | | | * | | | | fix: Handle uncached messages in filter editingGravatar mbaruh2022-11-27-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also increases the cache size to increase the chances of ignoring filters. Since it's newest first and the antispam uses take_while, it doesn't slow down the antispam.
| | | | | * | | | | fix: Validate filter list before initiating filter addGravatar mbaruh2022-11-27-2/+7
| | | | | | | | | |
| | | | | * | | | | Add alert viewGravatar mbaruh2022-11-27-18/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The view provides info about the offending user. This change required changing the cog to generate a fresh webhook on startup so that it's authenticated to the bot. Only webhooks authenticated to the bot can send message components. In the future, this view might be used for more advanced usages such as having a button to pardon the user.
| | | | | * | | | | Phishing filter add commandGravatar mbaruh2022-11-26-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A shortcut command to autoban a compromised account if it posts a given content.
| | | | | * | | | | Bring back snekbox result filteringGravatar mbaruh2022-11-26-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the new system, some custom actions might be applied if any filters are triggered, for example message deletion or infraction. Those actions will be applied in the context of the command invocation.
| | | | | * | | | | Add offending message deletion schedulingGravatar mbaruh2022-11-25-5/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mostly a copy-paste from the old system. If there are any actions taken against the message, but deleting is not one of them - schedule the message for deletion after 7 days.
| | | | | * | | | | Add nickname filterGravatar mbaruh2022-11-25-60/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The nickname filter works in much the same way as the one in the old system, with the following changes: - The lock is per user, rather than a global lock. - The alert cooldown is one hour, instead of three days which seemed too much. The delete_messages setting was changed to the more generic remove_context. If it's a nickname event, the context will be removed by applying a superstar infraction to the user. In order to allow filtering nicknames in voice state events, the filter context can now have None in the channel field. Additionally: - Fixes a bug when ignoring filters in message edits. - Makes the invites list keep track of message edits. - The FakeContext class is moved to utils since it's now also needed by remove_context.
| | | | | * | | | | Add message edit filteringGravatar mbaruh2022-11-05-28/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This edit handler takes into account filters already triggered for the message and ignores them (as long as it's a denied type) To that end the message cache can now hold metadata to accompany each message in the cache.
| | | | | * | | | | Handle threads in channel_scopeGravatar mbaruh2022-11-05-0/+2
| | | | | | | | | |
| | | | | * | | | | Bring back auto-infraction reportingGravatar mbaruh2022-11-05-5/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - When a filter is set to infract, it will send a message in #filter-log (See PR #1893) - Once a week the cog will send a message of all auto-infractions sent in the last 7 days, with a way to trigger it manually (See PR #2267)
| | | | | * | | | | Edit description on filter add/edit, bug fixesGravatar mbaruh2022-11-04-29/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `process_content` was changed to `process_input` to also edit the description when necessary. Fixes unhandled filter_type being None on filter add/edit. Moves the missing filter type warning to a more appropriate location to not trigger during filter add/edit.
| | | | | * | | | | Filter match now shows all triggers instead of messagesGravatar mbaruh2022-11-04-41/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The purpose of this command is to be able to find any relevant filters. It was not possible to find whitelist filters in the previous method, as there are no alerts for whitelist triggers. Instead, each filterlist now additionally returns what filters were triggered while processing the context. Additionally, a `no_user` argument was added to `filter match` to allow checking for triggers on one's own messages (otherwise there's almost no filtering on a mod's messages).
| | | | | * | | | | Stop using None as a valid setting valueGravatar mbaruh2022-11-04-36/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A None value signifies that there's no override, and it shouldn't be used for anything else. Doing so is confusing and bug-prone.
| | | | | * | | | | Remove old filtering constantsGravatar mbaruh2022-11-01-133/+0
| | | | | | | | | |
| | | | | * | | | | Prettify f and fl describe outputGravatar mbaruh2022-11-01-6/+8
| | | | | | | | | |
| | | | | * | | | | Fix argument completion for al and blGravatar mbaruh2022-11-01-8/+10
| | | | | | | | | |
| | | | | * | | | | Add the rest of the antispam rulesGravatar mbaruh2022-11-01-35/+468
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mostly a copy-paste of the implementations in the old system into the new system's structure. The mentions rule required changing the `triggers_on` method to async.
| | | | | * | | | | Add antispam filter list and duplicates filterGravatar mbaruh2022-10-31-141/+479
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the antispam filterlist, which dispatches a set of messages sent in the last X seconds to its filters. Unlike other filter lists, it doesn't just return the actions to be taken, but rather splits them in two: any actions unrelated to alerting mods are returned as usual, while actions related to alerting are used in a delayed coroutine, from which the alert is sent. - Fixes `infraction_channel` not using the context channel when it's None. - Moves the `upload_log` function outside the ModLog cog, as it only needed it for the bot instance. - Any auto-deleted message with attachments will now have its attachments logged.
| | | | | * | | | | Handle context message possibly being NoneGravatar mbaruh2022-10-28-18/+19
| | | | | | | | | |
| | | | | * | | | | Use command prefix instead of hardcoded !Gravatar mbaruh2022-10-27-3/+7
| | | | | | | | | |
| | | | | * | | | | Convert redundant filter setting group to commandGravatar mbaruh2022-10-27-14/+9
| | | | | | | | | |
| | | | | * | | | | Suppress exceptions while actioning filtersGravatar mbaruh2022-10-27-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Filtering should not stop even if one type of action raised an exception. For example, if deleting the message raised somehow, it should still try to infract the user. Exceptions raised in actions are logged instead. Additionally adds a fix to the way actions are merged.
| | | | | * | | | | Add Discord token filterGravatar mbaruh2022-10-26-35/+255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also fix a bug with the cog trying to serialize a set when trying to modify the DB with no UI. Also fix a bug with the domain setting description having a mismatching name.
| | | | | * | | | | Add rich embed filterGravatar mbaruh2022-10-23-19/+62
| | | | | | | | | |
| | | | | * | | | | Merge branch 'main' into new-filtersGravatar mbaruh2022-10-23-609/+1142
| | | | | |\ \ \ \ \
| | | | | * | | | | | Add webhook filterGravatar mbaruh2022-10-23-5/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a way to add custom coroutines to the context, to execute when the filtering result is actioned.
| | | | | * | | | | | Add everyone filter, fix invite filteringGravatar mbaruh2022-10-22-110/+285
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add the everyone filter, from a new class of filters - UniqueFilter. These filters should only be run once per context. These filters can modify any part of their behavior, including which events they respond to. - The invite filtering had a bug where it could exit early when the context wasn't a valid whitelisting context (which usually means that any unkown filters are allowed), despite there possibly being blocked filters which require addressing.
| | | | | * | | | | | Add a command to query filters by settingsGravatar mbaruh2022-10-17-55/+563
| | | | | | | | | | |
| | | | | * | | | | | Change override handlingGravatar mbaruh2022-10-16-114/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Settings class is now a subclass of dict as well. SettingsEntry's now store which fields are overrides in case the entry is not empty. If there is a overridden value and a non-overridden value in the same entry, the non-overridden value will now correctly be the default instead of staying empty. Additionally fixes bugs with free list input parsing.
| | | | | * | | | | | More improvements to FilterListGravatar mbaruh2022-10-15-89/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Methods that work with only a specific list type are moved to AtomicList. FilterList is now a subclass of dict, since that's what it is.
| | | | | * | | | | | Add filter matching commandGravatar mbaruh2022-10-11-51/+83
| | | | | | | | | | |
| | | | | * | | | | | Better API error handlingGravatar mbaruh2022-10-11-13/+27
| | | | | | | | | | |
| | | | | * | | | | | Add confirmation before filter deletionGravatar mbaruh2022-10-11-35/+39
| | | | | | | | | | |
| | | | | * | | | | | Rearrange FilterList classGravatar mbaruh2022-10-11-99/+153
| | | | | | | | | | |
| | | | | * | | | | | Filter list add commandGravatar mbaruh2022-10-11-25/+189
| | | | | | | | | | |
| | | | | * | | | | | Add filter list edit commandGravatar mbaruh2022-10-10-144/+393
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UI is a simplified version of the filter UI. In fact the two views now use the same base class. Also fixes a bug in filters with displaying the correct value in the embed for filter settings.
| | | | | * | | | | | Rearrange UI into several modulesGravatar mbaruh2022-10-10-326/+344
| | | | | | | | | | |
| | | | | * | | | | | Added filter list deletion command.Gravatar mbaruh2022-10-10-3/+84
| | | | | | | | | | |
| | | | | * | | | | | Add filter template optionGravatar mbaruh2022-10-09-26/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An option is added to filter add and edit to copy the overrides over from another filter.
| | | | | * | | | | | Ignore overrides that are equal to their defaultsGravatar mbaruh2022-10-08-23/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an override is added that is equal to the default, it is ignored instead. If an override is read from a Filter object that is equal to its default, it is ignored instead. This is done because otherwise when a setting shares an entry with an overriden setting (e.g infraction_type with infraction_duration), there's no way of knowing whether it was truly overridden, since None values are not preserved for filters on loading (that is because the same pydantic models are used for both the filter and filter-list settings). This seems like an acceptable trade-off since overrides which are equal to their defaults don't have a practical use. Addiotionally, this commit fixes not being able to set an empty string as an override to a non-empty default.
| | | | | * | | | | | Fix pings validationGravatar mbaruh2022-10-08-3/+3
| | | | | | | | | | |
| | | | | * | | | | | Add infraction channel settingGravatar mbaruh2022-10-08-10/+9
| | | | | | | | | | |
| | | | | * | | | | | Prevent the duplicate filter warning from mentioning itselfGravatar mbaruh2022-10-07-4/+7
| | | | | | | | | | |
| | | | | * | | | | | Add more spacing in mod alertGravatar mbaruh2022-10-07-4/+4
| | | | | | | | | | |
| | | | | * | | | | | Make auto-infraction actually workGravatar mbaruh2022-10-07-16/+66
| | | | | | | | | | |
| | | | | * | | | | | domain/exact -> domain/subdomainsGravatar mbaruh2022-10-06-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original plan was to have a field which only matches subdomains and not the domain itself, I got confused when I wrote the /exact field. This fixes a bug where the matches would be updated even if it didn't meet the criteria of the extra field. Also fixes some issues in the UI dealing with filter overrides.
| | | | | * | | | | | Fix bug with setting domain to notifyGravatar mbaruh2022-10-06-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately the filter doesn't know its full effect, only its overrides, so it might not know whether it's going to delete the message or not. This commit prevents errors, but might lead to unwanted behavior if there are two domains in a message, one that causes deletion and one that doesn't, and the second one gets evaluated last. This is basically a 'I hope no one notices' fix until I can think of something better. In practice this shouldn't be an issue.
| | | | | * | | | | | Add filter content processing before posting/patchingGravatar mbaruh2022-10-04-5/+89
| | | | | | | | | | |
| | | | | * | | | | | Handle invalid UI editsGravatar mbaruh2022-10-01-4/+8
| | | | | | | | | | |