aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
* | | | Add settings display for individual filters and filter listsGravatar mbaruh2022-07-16-108/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The filterlist describe command is changed to include the default settings it contains. The filters group can now take a filter ID, and it will display embed detailing the filter data and settings. The mechanic is similar to how individual infractions can be displayed with `!infraction <id>`. - To be able to quickly find whether the filter with the provided ID is in a specific list, the data structure was changed to a dictionary. - To be able to mark which settings have the default values and which are overrides, resolving the full actions of a filter is deferred to when the filter is actually triggered. This wasn't possible in the beginning of development, but now that each filterlist can resolve the action to be taken with its own internal logic, it is. - Some attribute names of SettingsEntry subclasses were changed to match the name under which they're stored in the DB. This allows displaying the settings with the names that need to be used to edit them. - Each filterlist now contains all settings, even if they're empty, so that they can be displayed. While this is slightly less efficient, I considered it too negligible to make displaying the settings messier than it already is. - Some additional refactoring in the cog was done to avoid code repetition.
* | | | Add system description commandsGravatar mbaruh2022-07-16-22/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The system is fairly complex, and to avoid having to delve into the source code, this commit adds several commands to show descriptions for various components of the system: - Filters - Filter lists - Settings (both from the DB schema and filter-type-specific) The names that can be described are the ones which are actually being used in the system. So if no tokens list was loaded, it can't be described even if there is an implementation for it. If no name is relayed to the commands, the list of options will be shown instead.
* | | | Add filter-type-specific settingsGravatar mbaruh2022-07-16-93/+899
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pydantic is added to the bot's dependencies, allowing easily setting up settings that are specific to a filter type (e.g for domains). The data for those settings is loaded from the "additional_field" JSON field in the Filter table. This commit specifically adds an option to match a domain exactly, without matching subdomains. There are several benefits to using Pydantic: - Built-in serialization to, and de-serialization from JSON, which is useful for reading and writing to the DB. - Type validation on initialization. - By default ignores extra fields when de-serializing, which can prevent things breaking if the extra fields change.
* | | | Add domain filteringGravatar mbaruh2022-07-16-12/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The domain filtering works very similarly to the token filtering, and the domain matching itself is based on the implementation in the old system. The deletion setting is accessed explicitly in the domain filter in order to allow DMing the user the domain the message got deleted for. This is fine, since practical uses are more important than the theory this system was designed with. Of course, breaking the design should still be avoided whenever possible.
* | | | Fix argument completion for non-last argsGravatar mbaruh2022-07-16-32/+54
| | | | | | | | | | | | | | | | | | | | Previously the completed arg would be appended to the end of the message, which didn't work if the missing argument wasn't the last one (for example, a value was given to a following argument because of a failed conversion for previous ones). The select now employs a different strategy of storing the provided args, and the position where the new are should be inserted.
* | | | Add guild invite filteringGravatar mbaruh2022-07-16-19/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds the invite filtering implementation to the new system. This also fixes an issue with the implementation of the extension filtering, where there was no way to tell the bot to ignore a user when they posted a non-whitelisted file extension, since there's no relevant filter in this scenario. Instead the extensions and invites filters now use the whitelist validation defaults to dictate when filtering should be done at all. For example, if the list validations are to ignore Helpers, then no invite filtering will occur no matter what. The meaning of this is that the system is somewhat less configurable, because settings overrides in filters belonging to a whitelist are meaningless. Additionally this commit contains the following fixes: - If the user tries to show the filters in a list which doesn't exist, it says it doesn't exist instead of saying there are 0 filters. - The filter context content is `Union[str, set]` instead of `Union[str, set[str]]`. - An empty embed will no longer be created when `dm_embed` is empty.
* | | | Add file extension filteringGravatar mbaruh2022-07-16-49/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commmit migrates the AntiMalware cog to a new filter list which goes over a message's attachments. Some changes were needed to accomodate the new list, primarily what a filter list returns for a given context: Instead of returning a list of filters, it will return the action itself that should be taken. This adds the flexibility of not needing existing filters to dictate the action. For example, in the case of the extensions list, an action should be taken when filters were *not* triggered. Or more precisely, when not all attachment extensions are whitelisted. Therefore, the action in that case is dictated by the filter list (stored as the list's default actions). Additionally each filter list can now return its own message for the alert embed, instead of the cog formatting it according to the filters raised. Because again, an action might be taken without any deny filters being triggered. This is going to be especially relevant for the invites list. Additionally, the infraction_and_notification action now doesn't redirect the notification to the context channel when the DM fails, since this can be incredibly noisy in cases of spam. If we want this functionality, a more suitable solution should be found.
* | | | Accept strings in channel scope and change role string interpretationGravatar mbaruh2022-07-16-38/+48
| | | | | | | | | | | | | | | | | | | | The channel scope settings were changed to accomodate strings. That means that if a string is specified, the bot will look whether the context channel's name matches. If it's a number, it will match the ID. Accordingly the same changed was applied to the bypass roles and pings settings: if it's a non-numeric string, it will look for a role with that name.
* | | | Add listing commandsGravatar mbaruh2022-07-16-29/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For legacy purposes, separate command groups were re-added for blacklists and whitelists. There's a new command group for filters. Not specifying a list type for the `filter list` command will cause the bot to try to infer whether there's only one kind of list, for example `!filter list tokens` will pull up the blacklist since there's no whitelist. If a required field is missing, the user will be prompted to complete it from a selection. Some level of flexibility was added for the list type in the `filter list` command. For example, a list type can be "DENY", but it will also match "blacklist", "denylist", "deny", "denied", "blacklisted" etc.
* | | | New filtering backbone and regex filtering migrationGravatar mbaruh2022-07-16-0/+1494
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit provides the basis of the new filtering system: - The filtering cog consists of several filter lists loaded from the database (filtering.py). - Each filter list contains a list of filters, which are run in response to events (message posting, reaction, thread creation). Each filter list may choose to respond to different events (the subscribe method in filtering.py). - Each filter has settings (settings.py) which decide when it is going to be run (e.g it might be disabled in a specific channel), and what will happen if it triggers (e.g delete the offending message). - Not every filter has a value for every setting (the _settings_types package) . It will use the default settings specified by its filter list as a fallback. - Since each filter might have a different effect when triggered, we must check all relevant filters even if we found a triggered filter already, unlike in the old system. - Two triggered filters may specify different values for the same setting, therefore each entry has a rule for combining two different values (the __or__ method in each file in _settings_types). To avoid having to prefix each file with an underscore (or the bot will try to load it as a cog), the loading script was changed to ignore packages with names starting with an underscore. Alert sending is done via a webhook so that several embeds can be sent in the same message (will be useful for example for guild invite alerts). Filter lists and setting entries classes are loaded dynamically from their respective packages. In order to be able to test the new features, this commit also includes a migration of the regex-based filtering.
* | | | Tear down the old filtering systemGravatar mbaruh2022-07-15-3702/+1
|/ / / | | | | | | | | | Tests and dependent functionality in other extensions will be re-added later on.
* | | Merge pull request #2215 from python-discord/revival-of-code-roleGravatar ChrisJL2022-07-12-0/+3
|\ \ \ | | | | | | | | Add revival of code role to self-assignable
| * | | Add revival of code role to self-assignableGravatar Cam Caswell2022-07-12-0/+3
|/ / /
* | | Merge pull request #2214 from python-discord/mbaruh/regex-tag-fixGravatar Hassan Abouelela2022-07-12-2/+2
|\ \ \ | | | | | | | | Fix wrong var name in regex tag
| * | | Fix wrong var name in regex tagGravatar Boris Muratov2022-07-12-2/+2
|/ / /
* / / Add Aliases for Tags Support (#2213)Gravatar Janine vN2022-07-11-1/+11
|/ / | | | | Also added aliases for the f-string tag and the "minusmpip"
* | Limit the ext cog to 1 action at a time (#2205)Gravatar ChrisJL2022-07-10-15/+26
| |
* | Bump urllib3 from 1.24.3 to 1.26.5 (#2210)Gravatar dependabot[bot]2022-07-09-18/+10
| | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | Bump lxml from 4.8.0 to 4.9.1 (#2208)Gravatar dependabot[bot]2022-07-09-1236/+100
| | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | Bump requests from 2.15.1 to 2.20.0 (#2202)Gravatar dependabot[bot]2022-07-09-14/+32
| | | | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Xithrius <[email protected]>
* | Merge pull request #2209 from python-discord/tag-dashmpipGravatar D0rs4n2022-07-09-0/+11
|\ \ | | | | | | Add tag to use `python -m pip` to install packages
| * | Add tag to use `python -m pip` to install packagesGravatar Janine vN2022-07-08-0/+11
|/ /
* | Merge pull request #2207 from python-discord/shenanigansd-patch-1Gravatar ChrisJL2022-07-04-1/+1
|\ \
| * | Capitalize the "D" in "Discord"Gravatar Bradley Reynolds2022-07-04-1/+1
|/ / | | | | | | | | "Discord" is a proper noun, and should be capitalized. Signed-off-by: Bradley Reynolds <[email protected]>
* | Merge pull request #2201 from Numerlor/timeit_setup_helpGravatar Hassan Abouelela2022-07-03-2/+5
|\ \ | | | | | | Improve help of eval and timeit
| * \ Merge branch 'main' into timeit_setup_helpGravatar Hassan Abouelela2022-07-03-167/+177
| |\ \ | |/ / |/| |
* | | Merge pull request #2196 from ↵Gravatar ChrisJL2022-06-30-11/+21
|\ \ \ | | | | | | | | | | | | | | | | python-discord/always-prepend-guild-name-to-guild-invite-filters Enhance guild_invite based autobans
| * \ \ Merge branch 'main' into always-prepend-guild-name-to-guild-invite-filtersGravatar ChrisJL2022-06-30-172/+179
| |\ \ \ | |/ / / |/| | |
* | | | Merge pull request #2203 from python-discord/fix-trigger_typingGravatar ChrisJL2022-06-29-4/+4
|\ \ \ \
| * | | | Use the new Messageable.typing instead of the removed Messageable.trigger_typingGravatar Chris Lovering2022-06-29-4/+4
|/ / / /
* | | | Merge pull request #2200 from python-discord/ignore-auto-mod-notificaitonsGravatar Hassan Abouelela2022-06-28-152/+152
|\ \ \ \ | | | | | | | | | | Ignore auto mod notificaitons
| * | | | Pin fakeredis to 1.7.5 due to breaking aioredis changeGravatar Chris Lovering2022-06-28-14/+16
| | | | | | | | | | | | | | | | | | | | This can be unpinned once https://github.com/SebastiaanZ/async-rediscache/pull/18 is merged
| * | | | Use new application format for message data in test helperGravatar Chris Lovering2022-06-28-1/+1
| | | | |
| * | | | Ignore auto_moderation_action messages when applying anti-spam rulesGravatar Chris Lovering2022-06-28-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a message triggers an auto_moderation_action notification, Discord re-writes the author field for the system message to look as if it's from the original author. This means those messages counted towards our anti-spam filter. This both triggered the filter too early, and also resulted in those auto mod messages being deleted when the filter was hit.
| * | | | Bump botcore to get latest d.py changesGravatar Chris Lovering2022-06-28-164/+161
|/ / / /
| * | | Rename filtering send log kwarg for consistency with where it's sent fromGravatar Chris Lovering2022-06-22-2/+2
| | | |
| * | | Improved output format of guild autoban notificationsGravatar Chris Lovering2022-06-22-1/+3
| | | |
| * | | Don't ping mods for autoban filtersGravatar Chris Lovering2022-06-15-3/+7
| | | |
| * | | Include the list type when telling mods a new autoban filter was addedGravatar Chris Lovering2022-06-15-1/+2
| | | |
| * | | Always prepend guild name to guild invite filters.Gravatar Chris Lovering2022-06-14-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
| | * | document eval command accepting multiple codeblocksGravatar Numerlor2022-06-28-0/+3
| | | |
| | * | improve usage hint of timeit and eval commandGravatar Numerlor2022-06-28-2/+2
| |/ / |/| |
* | | Merge pull request #2197 from python-discord/fix_return_buttonGravatar ChrisJL2022-06-22-11/+4
|\ \ \
| * \ \ Merge branch 'main' into fix_return_buttonGravatar ChrisJL2022-06-22-5/+19
| |\ \ \ | |/ / / |/| | |
* | | | Merge pull request #2199 from Numerlor/doc-description-headerlinkGravatar ChrisJL2022-06-22-5/+19
|\ \ \ \ | |_|/ / |/| | |
| * | | filter out source code tags, remove unnecessary regexGravatar Numerlor2022-06-19-5/+14
| | | |
| * | | filter out headerlinks for descriptionsGravatar Numerlor2022-06-19-0/+5
|/ / /
| * / Fix help embed viewsGravatar mbaruh2022-06-17-11/+4
|/ / | | | | | | | | | | | | Due to various breaking changes in the discord.py library the views of the help embed stopped working properly. - Use `add_item` in `CommandView`. This was done in GroupView but was apparently missed in `CommandView`, and the former (hacky) method no longer works. - Instead of editing the help message normally (which required to then defer the response), the message edit is made to be the response itself. It seems like the callback would automatically defer the response if none was made, but that no longer happens.
* | Merge pull request #2195 from python-discord/fix/bot#2194Gravatar ChrisJL2022-06-14-1/+3
|\ \ | | | | | | Only check for autoban filters if reason key is present and not None
| * \ Merge branch 'main' into fix/bot#2194Gravatar ChrisJL2022-06-14-2/+2
| |\ \ | |/ / |/| |