aboutsummaryrefslogtreecommitdiffstats
path: root/tests/base.py (unfollow)
Commit message (Collapse)AuthorLines
2020-06-08Help channels: use cache to remove cooldowns or re-schedule themGravatar MarkKoz-7/+20
Using the cache is more efficient since it can check only the users it expects to have a cooldown rather than searching all guild members. Furthermore, re-scheduling the cooldowns ensures members experience the full duration of the cooldown. Previously, all cooldowns were removed, regardless of whether they were expired.
2020-06-08Help channels: add a function to schedule cooldown expirationGravatar MarkKoz-4/+7
Moving this code into a separate function reduces redundancy down the line. This will also get used to re-scheduled cooldowns after a restart.
2020-06-08Help channels: add a function to get in use timeGravatar MarkKoz-5/+12
Future code will also need to get this time, so moving it out to a separate function reduces redundancy.
2020-06-08Help channels: fix claim timestamp being localGravatar MarkKoz-4/+7
The datetime module returns a local timestamp for naïve datetimes. It has to be timezone-aware to ensure it will always be in UTC.
2020-06-07Remove pointless suppress.Gravatar Leon Sandøy-3/+3
Since help_channel_claimants.delete will never raise a KeyError, it's not necessary to suppress one.
2020-06-06Enable the 'redis' / 'aiohttp' Sentry integrationsGravatar Leon Sandøy-1/+7
This will provide breadcrumbs for these systems in all our Sentry events, if applicable. Closes #989.
2020-06-06Fix potential race condition.Gravatar Leon Sandøy-5/+5
Instead of first checking if the channel.id exists and then checking what it is, we just do a single API call, to prevent cases where something fucky might happen inbetween the first and the second call.
2020-06-06Store epoch timestamps instead of strings.Gravatar Leon Sandøy-5/+4
We're also switching from datetime.now() to datetime.utcnow().
2020-06-06Store booleans as integers instead of strings.Gravatar Leon Sandøy-2/+7
This means we don't need to rely on strtobool, and is a cleaner implementation overall. Thanks @MarkKoz.
2020-06-06Refactor help_channels.py to use RedisCache.Gravatar Leon Sandøy-28/+32
More specifically, we're turning three dicts into RedisCaches: - help_channel_claimants - unanswered - claim_times These will still work the same way, but will now persist their contents across restarts.
2020-06-05Stats: Implement rules statsGravatar ks129-0/+3
Increase every shown rule uses count when command called.
2020-06-05Send infraction DM before applying infractionGravatar Sebastiaan Zeeff-20/+21
I've "reverted" the change that reversed the order of DM'ing a user about their infraction and applying the actual infraction. A recent PR reversed the order to stop us from sending DMs when applying the infraction failed. However, in order to DM a user, the bot has to share a guild with the recipient and kicking them off of our server first does not help with that. That's why I reverted the change and reverted some other minor changes made in relation to this change. Note: I did not change the code sending the DM itself; I merely moved it back to where it belongs and added a comment about the necessity of doing the DM'ing first. I couldn't cleanly revert a commit to do this, as changes were spread out over and included in multiple commits that also contained changes not related to the `DM->apply infraction` order.