aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| | | | | * | | | | 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
| | | | | | | | | | |
| | | | | * | | | | | Prettify post/patch filter errorGravatar mbaruh2022-10-01-3/+21
| | | | | | | | | | |
| | | | | * | | | | | Show settings in sorted order in UIGravatar mbaruh2022-10-01-2/+2
| | | | | | | | | | |
| | | | | * | | | | | Add a warning if an added filter has content identicalto othersGravatar mbaruh2022-10-01-2/+15
| | | | | | | | | | |
| | | | | * | | | | | Bring back enabled categories, remove redundant validatorsGravatar mbaruh2022-10-01-26/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There needs to be a way to only enable a filter in a specific category, so this setting now fulfills that role. Disabled channels can be used to disable a filter in a specific channel within the category. Additionally the validators which maybe convert to int are now removed. As long as the int is the first in the Union, it will happen anyway.
| | | | | * | | | | | Stress that a filter was triggered in DMGravatar mbaruh2022-10-01-1/+1
| | | | | | | | | | |
| | | | | * | | | | | Fix channel_scope checking IDs and names separatelyGravatar mbaruh2022-10-01-16/+9
| | | | | | | | | | |
| | | | | * | | | | | Fix patching removed overrideGravatar mbaruh2022-10-01-3/+9
| | | | | | | | | | |
| | | | | * | | | | | Correctly handle DMsGravatar mbaruh2022-10-01-2/+8
| | | | | | | | | | |
| | | | | * | | | | | Properly remove items from sequence editGravatar mbaruh2022-10-01-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some items might not be stored as strings.
| | | | | * | | | | | Keep sequences as lists in editing UIGravatar mbaruh2022-10-01-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sequences such as sets are not serializable, and it's going to be converted to the right type when loaded to the cog anyway.
| | | | | * | | | | | Use try-except instead of is_digit in bypass_rolesGravatar mbaruh2022-10-01-3/+4
| | | | | | | | | | |
| | | | | * | | | | | Correct loggingGravatar mbaruh2022-10-01-1/+1
| | | | | | | | | | |
| | | | | * | | | | | Fix testsGravatar mbaruh2022-10-01-281/+44
| | | | | | | | | | |
| | | | | * | | | | | Split actions and validations to their own packcagesGravatar mbaruh2022-09-30-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a purely aesthetic choice. Additionally fixes a small bug where a missing entry type would repeatedly invoke a warning on cog load.
| | | | | * | | | | | 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.