aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
* Merge branch 'master' into redis_persistenceGravatar Leon Sandøy2020-05-26-24/+97
|\
| * Merge pull request #866 from python-discord/restricted_tagsGravatar Shirayuki Nekomata2020-05-26-17/+42
| |\ | | | | | | feature to restrict tags to specific role(s)
| | * Merge branch 'master' into restricted_tagsGravatar Shirayuki Nekomata2020-05-26-955/+2577
| | |\ | | |/ | |/|
| * | [stats] Do not report modmail channels to statsGravatar Joseph Banks2020-05-26-1/+11
| | |
| * | Merge pull request #936 from python-discord/bug/filters/929/invalid-invitesGravatar kwzrd2020-05-25-1/+3
| |\ \ | | | | | | | | Filtering: don't attempt to send additional embeds for invalid invites
| | * \ Merge branch 'master' into bug/filters/929/invalid-invitesGravatar kwzrd2020-05-25-594/+833
| | |\ \ | | |/ / | |/| |
| * | | Add discord.gift to URL blacklist, closes #958Gravatar Joseph Banks2020-05-24-0/+1
| | | |
| * | | Merge pull request #956 from ks129/help-channels-deleteGravatar Sebastiaan Zeeff2020-05-24-5/+40
| |\ \ \ | | | | | | | | | | Help System: Move dormant faster if help channel is empty
| | * \ \ Merge branch 'master' into help-channels-deleteGravatar Sebastiaan Zeeff2020-05-24-8/+64
| | |\ \ \ | | |/ / / | |/| | |
| | * | | HelpChannels: remove `is_dormant_message`Gravatar MarkKoz2020-05-22-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | At this point, it's just a thin wrapper to call another function. It's redundant.
| | * | | HelpChannels: move message None check inside `match_bot_embed`Gravatar MarkKoz2020-05-22-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | It was being done repeatedly outside the function so let's move it in to reduce redundancy.
| | * | | HelpChannels: rename `embed_description_match`Gravatar MarkKoz2020-05-22-5/+5
| | | | |
| | * | | HelpChannels: fix `is_empty` not being awaitedGravatar MarkKoz2020-05-22-2/+5
| | | | |
| | * | | Help: Create `embed_description_match`Gravatar ks1292020-05-22-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Created function `embed_description_match`. - Implemented this to `is_empty` - Implemented this to `is_dormant_message`
| | * | | Help: Fix docstrings of `is_empty` and `on_message_delete`Gravatar ks1292020-05-22-2/+6
| | | | | | | | | | | | | | | Co-authored-by: Mark <[email protected]>
| | * | | Help: Implemented faster close when claimant delete msg no more messagesGravatar ks1292020-05-21-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Created function `is_empty` that check is there any message in channel after bot own available message. - `on_message_delete` that reschedule task when message is on correct channel and is empty. - In `move_idle_channel` function, implemented choosing right cooldown, based on is channel empty or not.
| | * | | Config: Added new `HelpChannels` config `deleted_idle_minutes`Gravatar ks1292020-05-21-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This show how much minutes should this wait before making channel dormant when no messages in channel (original message deleted).
| | | * | Filtering: don't attempt to send additional embeds for invalid invitesGravatar MarkKoz2020-05-10-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Invalid invites won't have data available to put in the embeds. Fixes #929 Fixes BOT-3Z
| | | | * Tags: always use top-most folder for role restrictionsGravatar MarkKoz2020-04-18-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Ensures that nested directories aren't used as the value for the role name.
| | | | * simplGravatar Rohan Reddy Alleti2020-04-14-3/+1
| | | | | | | | | | | | | | | Co-Authored-By: Mark <[email protected]>
| | | | * simplify if statementGravatar Rohan Reddy Alleti2020-04-14-4/+2
| | | | | | | | | | | | | | | Co-Authored-By: Mark <[email protected]>
| | | | * Feature now is cross-platformGravatar rohanjnr2020-04-14-7/+10
| | | | | | | | | | | | | | | | | | | | Instead of using string methods to split the file path at `/` which is not cross-platform, I am now entirely using pathlib methods to get the parent folder and restrict the tags.
| | | | * Remove unnecessary variable creation and join two if statementsGravatar rohanjnr2020-04-05-5/+6
| | | | |
| | | | * Add feature to restrict tags to specific role(s)Gravatar rohanjnr2020-04-05-15/+37
| | | | |
* | | | | Add a test for RuntimeErrors.Gravatar Leon Sandøy2020-05-26-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This just tests that the various RuntimeErrors are reachable - that includes the error about not having a bot instance, the one about not being a class attribute, and the one about not having instantiated the class. This test addresses a concern raised by @MarkKoz in a review. I've decided not to test that actual contents of these RuntimeErrors, because I believe that sort of testing is a bit too brittle. It shouldn't break a test just to change the content of an error string.
* | | | | Swap the order for the validate_cache checks.Gravatar Leon Sandøy2020-05-26-8/+8
| | | | |
* | | | | Improve some docstrings for RedisCache.Gravatar Leon Sandøy2020-05-26-5/+3
| | | | | | | | | | | | | | | | | | | | Thanks @MarkKoz!
* | | | | Make self.increment_lock private.Gravatar Leon Sandøy2020-05-26-2/+2
| | | | |
* | | | | Add better docstring for RedisCache.updateGravatar Leon Sandøy2020-05-26-2/+12
| | | | |
* | | | | Fix edge case where pop might not delete.Gravatar Leon Sandøy2020-05-26-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you passed a key for a value that was the same as your optional, it would just return it but not delete it. This edge case isn't worth it, so I'm just removing that condition and letting the extra API call fly.
* | | | | Turn log.exception into log.errorGravatar Leon Sandøy2020-05-26-17/+22
| | | | | | | | | | | | | | | | | | | | | | | | | Also, refactor error messages to be consistent and DRY throughout the file.
* | | | | Expose the redis port to the hostGravatar MarkKoz2020-05-25-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Useful for those that run redis with docker-compose but not the bot. The bot on the host won't have access to the Docker network in such case so the port must be exposed.
* | | | | Improve output of section name in config validation subtestsGravatar MarkKoz2020-05-25-1/+1
| | | | |
* | | | | Support validating collection types for constantsGravatar MarkKoz2020-05-25-8/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a simple validation that only check the type of the collection. It does not validate the types inside the collection because that has proven to be quite complex.
* | | | | Add support for Union type annotations for constantsGravatar MarkKoz2020-05-24-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that `Optional[x]` is just an alias for `Union[None, x]` so this effectively supports `Optional` too. This was especially troublesome because the redis password must be unset/None in order to avoid authentication, but the test would complain that `None` isn't a `str`. Setting to an empty string would pass the test but then make redis authenticate and fail.
* | | | | Improve error and error testing for incrementGravatar Leon Sandøy2020-05-24-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changed a RuntimeError to a KeyError (thanks @MarkKoz), and also added some tests to ensure that the right errors are raised whenever this method is used incorrectly.
* | | | | Add an option to use fakeredis in Bot.Gravatar Leon Sandøy2020-05-24-48/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this option, all contributors would need to set up a Redis server in order to run the bot. But with use_fakeredis set to True, this is no longer necessary because it will just set up a fakeredis redis pool instead of trying to contact an actual server. This is more than good enough for most local testing purposes, since data persistence across restarts isn't really relevant for them. This also means we need to move fakeredis into our real dependency list instead of having it as a dev dependency, so there's a minor change for that as well. I also made a small kaizen change to sort all the dependencies in the Pipfile alphabetically.
* | | | | MockBot needs to be aware of redis_readyGravatar Leon Sandøy2020-05-24-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Forgot to update the additional_spec_asyncs when changing the name of this Bot attribute to be public.
* | | | | Add logging to the RedisCache.Gravatar Leon Sandøy2020-05-24-3/+39
| | | | | | | | | | | | | | | | | | | | Mostly trace and exception logging.
* | | | | Rename Bot._redis_ready to Bot.redis_readyGravatar Leon Sandøy2020-05-24-4/+4
| | | | | | | | | | | | | | | | | | | | It's a public attribute, we're accessing it from RedisCache.
* | | | | Add .increment and .decrement methods.Gravatar Leon Sandøy2020-05-24-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes, we just want to store a counter in the cache. In this case, it is convenient to have a single method that will allow us to increment or decrement this counter. These methods allow you to decrement or increment floats and integers by an specified amount. By default, it'll increment or decrement by 1. Since this involves several API requests, we create an asyncio.Lock so that we don't end up with race conditions.
* | | | | Make .items return ItemsView instead of AsyncIterGravatar Leon Sandøy2020-05-24-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There really was no compelling reason why this method should return an AsyncIterator or than that `async for items in cache.items()` has nice readability, but there were a few concerns. One is a concern about race conditions raised by @SebastiaanZ, and @MarkKoz raised a concern that it was misleading to have an AsyncIterator that only "pretended" to be lazy. To address these concerns, I've refactored it to return a regular ItemsView instead. I also improved the docstring, and fixed the relevant tests.
* | | | | Better RuntimeErrors.Gravatar Leon Sandøy2020-05-24-2/+14
| | | | | | | | | | | | | | | | | | | | We provide suggestions for how to solve these problems now.
* | | | | Improves various docstrings and comments.Gravatar Leon Sandøy2020-05-24-10/+27
| | | | | | | | | | | | | | | | | | | | Thanks to @MarkKoz for suggesting most of these in their code review.
* | | | | Refactor the nice prefix/type strings to constantsGravatar Leon Sandøy2020-05-24-31/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's leaner to just move that code out of the class and up to the module level as constants. This commit also renames ValidRedisType to RedisType.
* | | | | len(prefix) instead of hardcoding 2Gravatar Leon Sandøy2020-05-24-1/+1
| | | | | | | | | | | | | | | Co-authored-by: Mark <[email protected]>
* | | | | use __name__ for type list Gravatar Leon Sandøy2020-05-24-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of relying on __str__ representation, we'll use the __name__ dunder. Co-authored-by: Mark <[email protected]>
* | | | | Merge branch 'master' into redis_persistenceGravatar Leon Sandøy2020-05-23-4/+6
|\| | | |
| * | | | Merge pull request #934 from python-discord/bug/filters/933/dont-delete-in-dmsGravatar Dennis Pham2020-05-23-4/+6
| |\ \ \ \ | | | | | | | | | | | | Filtering: don't delete messages in DMs
| | * \ \ \ Merge branch 'master' into bug/filters/933/dont-delete-in-dmsGravatar Dennis Pham2020-05-23-585/+786
| | |\ \ \ \ | | |/ / / / | |/| | | |