aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2022-11-28fix: Correctly handle author being a UserGravatar mbaruh-2/+12
If an offending message is sent in DMs, infractions that require the user being on the server didn't work, and there was an error while trying to display the user embed from that object, since the user is on the server (and therefore should have a nick attribute).
2022-11-28fix: Remove hash prefix from filter IDsGravatar mbaruh-4/+4
2022-11-28fix setting nameGravatar mbaruh-1/+1
2022-11-27fix: Use existing filters webhook if foundGravatar mbaruh-6/+16
2022-11-27fix: Handle uncached messages in filter editingGravatar mbaruh-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.
2022-11-27fix: Validate filter list before initiating filter addGravatar mbaruh-2/+7
2022-11-27Add alert viewGravatar mbaruh-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.
2022-11-26Phishing filter add commandGravatar mbaruh-2/+26
A shortcut command to autoban a compromised account if it posts a given content.
2022-11-26Bring back snekbox result filteringGravatar mbaruh-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.
2022-11-25Add offending message deletion schedulingGravatar mbaruh-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.
2022-11-25Add nickname filterGravatar mbaruh-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.
2022-11-05Add message edit filteringGravatar mbaruh-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.
2022-11-05Handle threads in channel_scopeGravatar mbaruh-0/+2
2022-11-05Bring back auto-infraction reportingGravatar mbaruh-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)
2022-11-04Edit description on filter add/edit, bug fixesGravatar mbaruh-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.
2022-11-04Filter match now shows all triggers instead of messagesGravatar mbaruh-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).
2022-11-04Stop using None as a valid setting valueGravatar mbaruh-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.
2022-11-01Remove old filtering constantsGravatar mbaruh-133/+0
2022-11-01Prettify f and fl describe outputGravatar mbaruh-6/+8
2022-11-01Fix argument completion for al and blGravatar mbaruh-8/+10
2022-11-01Add the rest of the antispam rulesGravatar mbaruh-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.
2022-10-31Add antispam filter list and duplicates filterGravatar mbaruh-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.
2022-10-28Handle context message possibly being NoneGravatar mbaruh-18/+19
2022-10-27Use command prefix instead of hardcoded !Gravatar mbaruh-3/+7
2022-10-27Convert redundant filter setting group to commandGravatar mbaruh-14/+9
2022-10-27Suppress exceptions while actioning filtersGravatar mbaruh-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.
2022-10-26Add Discord token filterGravatar mbaruh-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.
2022-10-23Add rich embed filterGravatar mbaruh-19/+62
2022-10-23Add webhook filterGravatar mbaruh-5/+76
This adds a way to add custom coroutines to the context, to execute when the filtering result is actioned.
2022-10-22Move Security cog to backend extensionGravatar mbaruh-1/+1
2022-10-22Add everyone filter, fix invite filteringGravatar mbaruh-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.
2022-10-20remove int from search_value's type unionGravatar Amrou Bellalouna-6/+6
2022-10-20apply style guidelines to signatureGravatar Amrou Bellalouna-2/+7
2022-10-20update doc strings to reflect the usage of the new paramGravatar Amrou Bellalouna-2/+2
2022-10-20change the signature to include a "zen_rule_index"Gravatar Amrou Bellalouna-7/+9
2022-10-19Calculate 'now' once to ensure it is constant for scoring nominationsGravatar wookie184-4/+5
2022-10-18Resolve a serious grammatical problem in a commentGravatar Leon Sandøy-1/+1
A controversial comment, to be sure. I have solved this with a compromise I know in my heart we can all agree on, wholeassedly.
2022-10-17Add a command to query filters by settingsGravatar mbaruh-55/+563
2022-10-17Support the new SequenceProxy type in d.pyGravatar Chris Lovering-1/+2
This type is usd for a few attributes, including Guild.threads and guild.Channels. This type does not implement any of the add dunder methods, so we use itertools.chain to get a single iterator for both sequences. Fixes BOT-398 Fixees #2292
2022-10-16Change override handlingGravatar mbaruh-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.
2022-10-15More improvements to FilterListGravatar mbaruh-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.
2022-10-14enhancement(filters): use a stricter bot token regex (#2006)Gravatar arl-5/+5
Use a stricter bot token regex Co-authored-by: wookie184 <[email protected]> Co-authored-by: Hassan Abouelela <[email protected]>
2022-10-13`REPO_TOKEN` is no more. (#2289)Gravatar Xithrius-1/+0
2022-10-11Add filter matching commandGravatar mbaruh-51/+83
2022-10-11Better API error handlingGravatar mbaruh-13/+27
2022-10-11Add confirmation before filter deletionGravatar mbaruh-35/+39
2022-10-11Rearrange FilterList classGravatar mbaruh-99/+153
2022-10-11Filter list add commandGravatar mbaruh-25/+189
2022-10-10Use explicit mock channels in tests to remove warningGravatar Chris Lovering-2/+11
This is need due to the new behaviour of discord.utils.get supporting both iterables and async iterables by checking for the presence of the __aiter__ attr on the iterable. GuildChannelConverter._resolve_channel uses this get util under the hood which grabs the voice channels on the guild, which were previously Mocked by the MagicMock, meaning the __aiter__ attr was present, causing the util to think it should be ran asynchronously.
2022-10-10noqa an abstract class with no abstract methodsGravatar Chris Lovering-1/+1
This warning was added in the latest version of flake8-bugbear, but can be ignored in this instance.