aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| * | | | | | | | | | Remove AntiMalWare constants, use cache data.Gravatar Leon Sandøy2020-07-18-55/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also updates the tests for this cog.
| * | | | | | | | | | Remove Filtering constants, use cache data.Gravatar Leon Sandøy2020-07-18-135/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of fetching the guild invite IDs from config-default.yml, we will now be using the AllowDenyList cache to check these.
| * | | | | | | | | | Add more logging to AllowDenyLists cog.Gravatar Leon Sandøy2020-07-18-2/+11
| | | | | | | | | | |
| * | | | | | | | | | Add AllowDenyLists cog.Gravatar Leon Sandøy2020-07-18-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+.
| * | | | | | | | | | Make the cache more convenient to access.Gravatar Leon Sandøy2020-07-18-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.
| * | | | | | | | | | Bulletlist with valid file types in converter.Gravatar Leon Sandøy2020-07-18-2/+2
| | | | | | | | | | |
| * | | | | | | | | | Better BadArgument exception text.Gravatar Leon Sandøy2020-07-18-2/+3
| | | | | | | | | | |
| * | | | | | | | | | Kaizen: Make error_handler.py more embeddy.Gravatar Leon Sandøy2020-07-17-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.
| * | | | | | | | | | Add ValidAllowDenyListType converter.Gravatar Leon Sandøy2020-07-17-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.
| * | | | | | | | | | Cache AllowDenyList data at bot startup.Gravatar Leon Sandøy2020-07-17-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.
| * | | | | | | | | | Kaizen: Move OffTopicName to converters.py.Gravatar Leon Sandøy2020-07-17-29/+28
| | | | | | | | | | |
| | | | | | | | | | * Fix attribute docstring for LockedResourceErrorGravatar MarkKoz2020-09-09-1/+1
| | | | | | | | | | |
| | | | | | | | | | * Move lock decorators to utils/lock.pyGravatar MarkKoz2020-09-09-86/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `LockGuard` was lonely and the decorators were cluttering up decorators.py.
| | | | | | | | | | * Decorators: rename mutually_exclusive decoratorsGravatar MarkKoz2020-09-09-14/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A mutex is the same thing as a lock. The former is a relatively esoteric contraction, so the latter is preferred.
| | | | | | | | | | * Decorators: remove locked() decoratorGravatar MarkKoz2020-09-09-35/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was not being used anywhere.
| | | | | | | | | | * Decorators: replace asyncio.Lock with a custom objectGravatar MarkKoz2020-08-22-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Concerns were raised over possible race conditions due `asyncio.Lock` internally awaiting coroutines. Does a mere `await` suspend the current coroutine, or does it have to actually await something asynchronous, like a future? Avoid answering that question by doing away with the awaits, which aren't necessary but are there as a consequence of using `asyncio.Lock`. Instead, add a custom `LockGuard` object to replace the previous locks.
| | | | | | | | | | * Explicitly use kwarg with respect_role_hierarchyGravatar MarkKoz2020-08-01-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarify the significance of the argument being passed.
| | | | | | | | | | * Decorators: fix type annotations for checksGravatar MarkKoz2020-08-01-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The annotation was previously changed on the basis of an incorrect return annotation PyCharm inferred for `check()`.
| | | | | | | | | | * Reminders: use singular form for mutually exclusive namespaceGravatar MarkKoz2020-07-31-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The exception it raises reads better if the singular form of the word is used.
| | | | | | | | | | * Reminders: show error to users if reminder is in useGravatar MarkKoz2020-07-31-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Silent failure is confusing to users. Showing an error message clears up why nothing happened with their command.
| | | | | | | | | | * Send users an error message if command raises LockedResourceErrorGravatar MarkKoz2020-07-31-0/+3
| | | | | | | | | | |
| | | | | | | | | | * Decorators: optionally raise an exception if resource is lockedGravatar MarkKoz2020-07-31-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The exception will facilitate user feedback for commands which use the decorator.
| | | | | | | | | | * Decorators: add some trace loggingGravatar MarkKoz2020-07-31-0/+3
| | | | | | | | | | |
| | | | | | | | | | * Decorators: wrap mutually_exclusive to use get_arg_valueGravatar MarkKoz2020-07-31-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of taking a callable, this wrapper just takes a name or position to get the resource ID.
| | | | | | | | | | * Decorators: remove redundant word in docstringGravatar MarkKoz2020-07-31-1/+1
| | | | | | | | | | |
| | | | | | | | | | * Decorators: use type aliases from function moduleGravatar MarkKoz2020-07-31-4/+2
| | | | | | | | | | |
| | | | | | | | | | * Decorators: remove default value for respect_role_hierarchyGravatar MarkKoz2020-07-31-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Explicit is better than implicit, and this default value wasn't much of a convenience.
| | | | | | | | | | * Decorators: use new func utils in respect_role_hierarchyGravatar MarkKoz2020-07-31-30/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the `_get_arg_value` call with `function.get_arg_value` cause the latter makes use of bound arguments, which are more accurate.
| | | | | | | | | | * Add a function to get bound argsGravatar MarkKoz2020-07-31-4/+17
| | | | | | | | | | |
| | | | | | | | | | * Add a function to wrap a decorator to use get_arg_valueGravatar MarkKoz2020-07-31-1/+28
| | | | | | | | | | |
| | | | | | | | | | * Reminders: make operations mutually exclusiveGravatar MarkKoz2020-07-31-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes race conditions between editing, deleting, and sending a reminder. If one operation is already happening, the others will be aborted.
| | | | | | | | | | * Add util function to get value from argGravatar MarkKoz2020-07-31-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a more advanced version meant to eventually replace the `_get_arg_values` in decorators.py.
| | | | | | | | | | * Decorators: pass bound arguments to callableGravatar MarkKoz2020-07-31-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bound arguments are more convenient to work with than the raw args and kwargs.
| | | | | | | | | | * Decorators: clarify use of mutually_exclusive with commandsGravatar MarkKoz2020-07-31-0/+2
| | | | | | | | | | |
| | | | | | | | | | * Decorators: add logging for mutually_exclusiveGravatar MarkKoz2020-07-31-4/+12
| | | | | | | | | | |
| | | | | | | | | | * Decorators: fix lock creationGravatar MarkKoz2020-07-31-1/+1
| | | | | | | | | | |
| | | | | | | | | | * Decorators: support awaitables for resource IDGravatar MarkKoz2020-07-31-4/+11
| | | | | | | | | | |
| | | | | | | | | | * Decorators: drop arg pos/name support for mutually_exclusiveGravatar MarkKoz2020-07-31-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Supporting ID retrieval by arg name or position made for a confusing interface. I also doubt it would have been used much. A callable can achieve the same thing, albeit with a little more code. Now the decorator instead supports passing an ID directly or a callable.
| | | | | | | | | | * Decorators: add mutually exclusive decoratorGravatar MarkKoz2020-07-31-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will be used to prevent race conditions on a resource by stopping all other access to the resource once its been acquired.
| | | | | | | | | | * Decorators: create helper function to get arg valueGravatar MarkKoz2020-07-31-10/+24
| | | | | | | | | | |
| | | | | | | | | | * Decorators: clean up importsGravatar MarkKoz2020-07-31-28/+26
| | | | | | | | | | |
| | | | | | | | | | * Decorators: more accurate return type for checksGravatar MarkKoz2020-07-31-3/+3
| | | | | | | | | | |
| | | | | | | | | | * Reminders: fix reminder_id type annotationGravatar MarkKoz2020-07-31-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's fine to accept an int since it'll get converted to a string anyway.
| | | | | | | | | | * Reminders: remove _delete_reminder functionGravatar MarkKoz2020-07-31-21/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only one call was benefiting from that function also cancelling the task. Therefore, the function was redundant and has been replaced with a direct request to delete. This change has the consequence of also fixing reminder tasks cancelling themselves. That issue was potentially suppressing errors (such as the duplicate DELETE request which was fixed earlier). Under normal circumstances, the scheduler will automatically removed finished tasks so tasks won't need to cancel/remove themselves.
| | | | | | | | | | * Reminders: remove duplicate deletion in scheduled taskGravatar MarkKoz2020-07-31-9/+1
| |_|_|_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `send_reminder` already deletes the reminder so it's redundant to delete it in the scheduled task too.
* | | | | | | | | | Remove superfluous Available help channels.Gravatar Leon Sandøy2020-07-31-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a little bit of logic to the Help Channel `init_available` coroutine, which runs when the cog loads. This ensures that if there are more help channels in available than there should be, we remove the superfluos ones. Previously, if the bot started with too many channels, it would maintain and defend that excessive amount. This is because we never actually count the number of channels before adding in new available channels whenever one disappears. If we ever get too many available channels in the future, this can be solved by simply reloading this cog.
* | | | | | | | | | Merge pull request #1073 from python-discord/fix/webhook_removerGravatar Leon Sandøy2020-07-30-1/+1
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Change regex so it catches new discord URL
| * | | | | | | | | | Use full flag name for case-insensitivityGravatar Senjan212020-07-30-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | requested by lemon
| * | | | | | | | | | Missed `?` in regex.Gravatar Senjan212020-07-30-1/+1
| | | | | | | | | | |
| * | | | | | | | | | Use non-capturing group instead.Gravatar Senjan212020-07-30-1/+1
| | | | | | | | | | |