aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| | | | | * | | | | | Voice ban -> voice mute in auto-infractionsGravatar mbaruh2022-09-30-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a remnant after the last rebase.
| | | | | * | | | | | Add filter delete commandGravatar mbaruh2022-09-30-0/+12
| | | | | | | | | | |
| | | | | * | | | | | Add filter edit commandGravatar mbaruh2022-09-30-19/+116
| | | | | | | | | | |
| | | | | * | | | | | Filter adding commands, simplify infractionGravatar mbaruh2022-09-29-122/+869
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds the mechanic to add new filters. The overrides of the settings can be provided in the command itself, but also through a UI made of Discord components. The UI adjusts itself to the data type of the setting, e.g a boolean setting will invoke a select with "True" and "False" options. This commit additionally gets rid of the mechanic to apply a superstar alongside another higher tier infraction for the same message. This is an edge case that isn't worth the complexity at the moment. Includes a small fix to the Ping setting which made the __or__ method malfunction.
| | | | | * | | | | | Merge branch 'main' into new-filtersGravatar mbaruh2022-09-24-1116/+1895
| | | | | |\ \ \ \ \ \
| | | | | * | | | | | | Convert all setting entries to pydnatic modelsGravatar mbaruh2022-09-10-150/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to facilitate this change, the init of all setting entries was removed, and as such the base SettingsEntry class doesn't count as abstract anymore, which broke the MUST_SET behavior. It was changed to not raise errors for MUST_SET values of attributes which were set in the current class. Additionally fixed a small bug where filters weren't listed properly in the list command. Despite the pydantic manual not writing it that way, I first made the validators class methods, otherwise it gave linting errors which couldn't be ignored with noqa (because then it complained about blanket noqas).
| | | | | * | | | | | | 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.
| | | | | | | | | | * | Fix: use nomination.user_id instead of id in get_or_fetch_memberGravatar wookie1842023-03-25-1/+1
| | | | | | | | | | | |
| | | | | | | | | | * | Merge branch 'main' into 2302-activity-in-reviewsGravatar wookie1842023-03-25-3221/+3818
| | | | | | | | | | |\ \ | | | | | |_|_|_|_|_|/ / | | | | |/| | | | | | |
| | | | | | | | | | * | Make show_* arguments to list_nominations keyword onlyGravatar wookie1842023-03-04-0/+1
| | | | | | | | | | | |
| | | | | | | | | | * | Split default nomination listing into groupsGravatar wookie1842023-03-04-37/+101
| | | | | | | | | | | |
| | | | | | | | | | * | Bump inactivity removal threshold and display in messageGravatar wookie1842023-03-04-2/+3
| | | | | | | | | | | |
| | | | | | | | | | * | Use get_or_fetch_channel instead of get_channelGravatar wookie1842023-03-02-2/+2
| | | | | | | | | | | |
| | | | | | | | | | * | Send a message when a user is unnominated due to being bannedGravatar wookie1842023-02-26-1/+6
| | | | | | | | | | | |
| | | | | | | | | | * | Update tp list command, making it sort by review order by defaultGravatar wookie1842023-02-26-33/+56
| | | | | | | | | | | |
| | | | | | | | | | * | Prune inactive users from the talentpoolGravatar wookie1842023-02-26-2/+45
| | | | | | | | | | | |
| | | | | | | | | | * | Add tests for new behaviourGravatar wookie1842023-02-26-3/+20
| | | | | | | | | | | |
| | | | | | | | | | * | Only review users with recent activityGravatar wookie1842023-02-26-32/+66
| | | | | | | | | | | |
| | | | | | | | | | * | Add nominations api method to get activityGravatar wookie1842023-02-26-0/+18
| | | | | | | | | | | |
| | | | | | | | | | * | Add nomination_discussion channel constantGravatar wookie1842023-02-26-0/+2
| | | | | | | | | | | |
| | | | | | | | | | | * Include jump URL in mod log embed for infraction editsGravatar vivekashok12212023-04-06-3/+12
| |_|_|_|_|_|_|_|_|_|/ |/| | | | | | | | | |
* | | | | | | | | | | Bump sentry-sdk from 1.17.0 to 1.18.0 (#2497)Gravatar dependabot[bot]2023-03-30-5/+5
| |/ / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bumps [sentry-sdk](https://github.com/getsentry/sentry-python) from 1.17.0 to 1.18.0. - [Release notes](https://github.com/getsentry/sentry-python/releases) - [Changelog](https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-python/compare/1.17.0...1.18.0) --- updated-dependencies: - dependency-name: sentry-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | | | | | | | | | Merge pull request #2388 from brodycritchlow/inplace-tagGravatar Boris Muratov2023-03-30-0/+22
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Add new inplace tag
| * \ \ \ \ \ \ \ \ \ Merge branch 'main' into inplace-tagGravatar Brody Critchlow2023-03-29-171/+194
| |\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / |/| | | | | | | | | |
* | | | | | | | | | | Bump regex from 2022.10.31 to 2023.3.23 (#2485)Gravatar dependabot[bot]2023-03-29-92/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bumps [regex](https://github.com/mrabarnett/mrab-regex) from 2022.10.31 to 2023.3.23. - [Release notes](https://github.com/mrabarnett/mrab-regex/releases) - [Commits](https://github.com/mrabarnett/mrab-regex/compare/2022.10.31...2023.3.23) --- updated-dependencies: - dependency-name: regex dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | | | | | | | | | | Merge pull request #2496 from python-discord/update-base-iamgeGravatar Boris Muratov2023-03-29-1/+1
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Update base image to new repo org
| * | | | | | | | | | | Update base image to new repo orgGravatar Chris Lovering2023-03-29-1/+1
|/ / / / / / / / / / /
* | | | | | | | | | | Merge pull request #2432 from shtlrs/bump-python-version-to-3-11Gravatar ChrisJL2023-03-29-76/+127
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Bump python version to 3 11
| * | | | | | | | | | | Replace mock._importer with pkgutil.resolve_name in test autospecGravatar shtlrs2023-03-29-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mock._importer was removed in 3.11
| * | | | | | | | | | | Upgrade to Python 3.11 in CI & DockerfileGravatar shtlrs2023-03-29-2/+2
| | | | | | | | | | | |
| * | | | | | | | | | | Upgrade to Python 3.11 in pyproject.tomlGravatar shtlrs2023-03-29-73/+123
|/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also bumps some dev deps to latest
* | | | | | | | | | | Merge pull request #2487 from python-discord/wookie184-botstrap-errorGravatar Boris Muratov2023-03-29-4/+4
|\ \ \ \ \ \ \ \ \ \ \ | |_|_|_|/ / / / / / / |/| | | | | | | | | | Improve wording in botstrap error
| * | | | | | | | | | Improve wording in botstrap errorGravatar wookie1842023-03-24-4/+4
|/ / / / / / / / / /
| * | | | | | | | | Fix InPlace precommit issuesGravatar brody critchlow2023-03-29-1/+1
| | | | | | | | | |
| * | | | | | | | | Merge branch 'main' into inplace-tagGravatar Brody Critchlow2023-03-28-3229/+3840
| |\ \ \ \ \ \ \ \ \ | |/ / / / / / / / / |/| | | | | | | | |
* | | | | | | | | | Bump beautifulsoup4 from 4.11.2 to 4.12.0 (#2480)Gravatar dependabot[bot]2023-03-24-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | | | | | | | | | Bump pre-commit from 3.1.1 to 3.2.0 (#2479)Gravatar dependabot[bot]2023-03-24-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | | | | | | | | | Bump pydantic from 1.10.6 to 1.10.7 (#2481)Gravatar dependabot[bot]2023-03-24-39/+39
| |_|/ / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | | | | | | | | Bump deepdiff from 6.2.3 to 6.3.0 (#2475)Gravatar dependabot[bot]2023-03-21-60/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | | | | | | | | Bump coverage from 7.2.1 to 7.2.2 (#2473)Gravatar dependabot[bot]2023-03-21-54/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>