aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2020-07-29Fix imports in converters.pyGravatar Leon Sandøy-5/+6
2020-07-29Refactor filtering: use non-compiled expressions.Gravatar Leon Sandøy-10/+6
2020-07-29Make a helper for validating guild invites.Gravatar Leon Sandøy-16/+18
2020-07-29Make a helper for inserting filter lists.Gravatar Leon Sandøy-21/+16
2020-07-29Kaizen - group private methods together.Gravatar Leon Sandøy-43/+43
2020-07-29Use a defaultdict(list) for filter_list_cache.Gravatar Leon Sandøy-6/+7
2020-07-29Expect status 400 for duplicates.Gravatar Leon Sandøy-2/+2
2020-07-27Bump flake8 version to 3.8Gravatar Leon Sandøy-173/+191
This is necessary to support walrus operators.
2020-07-27Rename AllowDenyList to FilterListsGravatar Leon Sandøy-45/+45
2020-07-24More explicit dict indexing Gravatar Leon Sandøy-3/+3
Addresses reviews from MarkKoz Co-authored-by: Mark <[email protected]>
2020-07-24Add sanity to partner and verification check in filtering.py.Gravatar Leon Sandøy-2/+2
2020-07-24No need for all() in cog_check for AllowDenyLists.Gravatar Leon Sandøy-4/+1
2020-07-24Put valid_types_list inside the conditional.Gravatar Leon Sandøy-1/+1
2020-07-24Catch ResponseCodeError in the ValidAllowDenyListType converter.Gravatar Leon Sandøy-7/+7
2020-07-19Implement new guild invite filtering logic.Gravatar Leon Sandøy-7/+19
We now filter guild invites the following way: - Whitelisted invites are always permitted. - Blacklisted invites are never permitted. - If the invite is not blacklisted, it is permitted only if it is a Verified or a Partnered server, otherwise not. This strategy was decided on during the June 7th staff meeting, see https://github.com/python-discord/organisation/issues/261
2020-07-19Validation of guild invites for delete.Gravatar Leon Sandøy-2/+14
We want to support deletion of both IDs and guild invites, so we need a bit of special handling for that.
2020-07-19Validation of guild invites.Gravatar Leon Sandøy-17/+78
We will now validate and convert any standard discord server invite to a guild ID, and automatically add the name of the server as a comment. This will ensure that the list of whitelisted guild IDs will be readable and nice. This also makes minor changes to list output aesthetics.
2020-07-19Support the new AllowDenyList field, 'comment'.Gravatar Leon Sandøy-10/+46
2020-07-19Include the guild ID in mod-log embed.Gravatar Leon Sandøy-3/+4
This gives easier access to the Guild ID in the place where you're most likely to want to use the whitelist command.
2020-07-19Fix an absolutely terrible comment.Gravatar Leon Sandøy-1/+1
2020-07-18Remove AntiMalWare constants, use cache data.Gravatar Leon Sandøy-55/+30
Also updates the tests for this cog.
2020-07-18Remove Filtering constants, use cache data.Gravatar Leon Sandøy-135/+32
Instead of fetching the guild invite IDs from config-default.yml, we will now be using the AllowDenyList cache to check these.
2020-07-18Add more logging to AllowDenyLists cog.Gravatar Leon Sandøy-2/+11
2020-07-18Add AllowDenyLists cog.Gravatar Leon Sandøy-0/+145
This includes commands to add, remove and show the items in the whitelists and blacklists for the different list types. Commands are limited to Moderators+.
2020-07-18Make the cache more convenient to access.Gravatar Leon Sandøy-1/+13
Instead of just dumping the JSON response from the site, we'll build a data structure that it will be convenient to access from our new cog, and from the Filtering cog.
2020-07-18Bulletlist with valid file types in converter.Gravatar Leon Sandøy-2/+2
2020-07-18Better BadArgument exception text.Gravatar Leon Sandøy-2/+3
2020-07-17Kaizen: Make error_handler.py more embeddy.Gravatar Leon Sandøy-7/+25
Currently, some types of errors are returning plain strings that repeat the input (which can be exploited to deliver stuff like mentions), and others are returning generic messages that don't give any exception information. This commit unifies our approach around putting as much information as we can (including the exception message), but always putting it inside an embed, so that stuff like pings will not fire. This, combined with the 1.4.0a `allowed_mentions` functionality, seems like a reasonable compromise between security and usability.
2020-07-17Add ValidAllowDenyListType converter.Gravatar Leon Sandøy-1/+27
We'll use this to ensure the input is valid when people try to whitelist or blacklist stuff. It will fetch its data from an Enum maintained on the site, so that the types of lists we support will only need to be maintained in a single place, instead of duplicating that data in the bot and the site.
2020-07-17Cache AllowDenyList data at bot startup.Gravatar Leon Sandøy-0/+7
We shouldn't be making an API call for every single message posted, so what we're gonna do is cache the data in the Bot, and then update the cache whenever we make changes to it via our new AllowDenyList cog. Since this cog will be the only way to make changes to this, this level of lazy caching should be enough to always keep the cache up to date.
2020-07-17Kaizen: Move OffTopicName to converters.py.Gravatar Leon Sandøy-29/+28
2020-07-16Bugfix: Show ID for embed DM relays, too.Gravatar Leon Sandøy-1/+1
2020-07-15Oops, these prints shouldn't be here.Gravatar Leon Sandøy-3/+0
https://github.com/python-discord/bot/issues/1041
2020-07-15How did that except except block get in?Gravatar Leon Sandøy-3/+0
Weird. https://github.com/python-discord/bot/issues/1041
2020-07-15Create a UserMentionOrID converter.Gravatar Leon Sandøy-1/+24
When we're using the !reply command, using a regular UserConverter is somewhat problematic. For example, if I wanted to send the message "lemon loves you", then I'd try to write `!reply lemon loves you` - however, the optional User converter would then try to convert `lemon` into a User, which it would successfully do since there's like 60 lemons on our server. As a result, the message "loves you" would be sent to a user called lemon.. god knows which one. To solve this bit of ambiguity, I introduce a new converter which only converts user mentions or user IDs into User, not strings that may be intended as part of the message you are sending. https://github.com/python-discord/bot/issues/1041
2020-07-15Ves' refactorGravatar Leon Sandøy-15/+16
Co-authored-by: Sebastiaan Zeeff <[email protected]>
2020-07-15Add some stats for DMs sent and received.Gravatar Leon Sandøy-0/+3
https://github.com/python-discord/bot/issues/1041
2020-07-15Add the user ID to the username in dm relays.Gravatar Leon Sandøy-1/+1
Without this, it is difficult to know precisely who the user that is DMing us is, which might be useful to us. https://github.com/python-discord/bot/issues/1041
2020-07-15Restore DM user caching.Gravatar Leon Sandøy-6/+22
This reverts commit 042f472a
2020-07-15Pass processed string to `extractBests`Gravatar kosayoda-2/+2
Fixes a regression where the string to be matched was not processed beforehand.
2020-07-15Document new kwarg in docstringGravatar kosayoda-0/+2
2020-07-14HelpChannels: remove cooldown info from available messageGravatar MarkKoz-3/+0
Users can no longer see available channels if they're on cooldown. They will instead see a special "cooldown" channel which will explain what's going on.
2020-07-14Suppress NotFound when removing help cmd reactionsGravatar MarkKoz-7/+6
The message may be deleted somehow before the wait_for times out. Fixes #1050 Fixes BOT-6X
2020-07-15Remove caching of last_dm_user.Gravatar Leon Sandøy-25/+20
If you're typing up a reply and the bot gets another DM while you're typing, you might accidentally send your reply to the wrong person. This could happen even if you're very attentive, because it might be a matter of milliseconds. The complexity to prevent this isn't worth the convenience of the feature, and it's nice to get rid of the caching as well, so I've decided to just make .reply require a user for every reply. https://github.com/python-discord/bot/issues/1041
2020-07-14Update bot/resources/tags/or-gotcha.mdGravatar ItsCinnabar-1/+1
Co-authored-by: Sebastiaan Zeeff <[email protected]>
2020-07-14Update or-gotcha.mdGravatar ItsCinnabar-1/+0
2020-07-14Update or-gotcha.mdGravatar ItsCinnabar-1/+1
2020-07-14Update or-gotcha.mdGravatar ItsCinnabar-1/+2
Adjust description and include link to docs
2020-07-14Remove redundant kwarg in !kick and !shadow_kickGravatar kosayoda-2/+2
The kwarg `active=False` is already being passed in `apply_kick`, therefore passing it in the parent callers result in a TypeError. Fixes #976 Fixes BOT-5P
2020-07-14Invoke fuzzywuzzy's processor before matchingGravatar kosayoda-1/+8
Trying to match a string with only non-alphanumeric characters results in a warning by fuzzywuzzy. Processing the string before matching lets us avoid the warning, which which uses the root logger and thus isn't supressible.