| Commit message (Collapse) | Author | Age | Lines | 
| ...                            |  | 
| | | | | | | | | | | | | | | |  | 
 | 
| |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
| | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | |  | 
Check infraction reason isn't None before shortening it
 | 
| | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | |  | 
The reason None check should be nested to avoid affecting the else/elif
statements that follow.
 | 
| | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | |  | 
 | 
| |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | |  | 
Add persistence to the help channel system
 | 
| | |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
| |/ / / / / / / / / / / / / / / /  
|/| | | | | | | | | | | | | | | |    | 
 | 
| | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | |  | 
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.
 | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | |  | 
Moving this code into a separate function reduces redundancy down the
line. This will also get used to re-scheduled cooldowns after a restart.
 | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | |  | 
Future code will also need to get this time, so moving it out to a
separate function reduces redundancy.
 | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | |  | 
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.
 | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | |  | 
Since help_channel_claimants.delete will never raise a KeyError, it's
not necessary to suppress one.
 | 
| | |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
| | | |/ / / / / / / / / / / / / /  
| | |/| | | | | | | | | | | | | |    | 
 | 
| | |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \   | 
 | 
| | | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | |  | 
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.
 | 
| | | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | |  | 
We're also switching from datetime.now() to datetime.utcnow().
 | 
| | | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | |  | 
This means we don't need to rely on strtobool, and is a cleaner
implementation overall. Thanks @MarkKoz.
 | 
| | | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | |  | 
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.
 | 
| | | |_|_|_|_|_|_|_|_|_|_|_|_|_|/ /  
| |/| | | | | | | | | | | | | | |   
| | | | | | | | | | | | | | | | |   
| | | | | | | | | | | | | | | | |   
| | | | | | | | | | | | | | | | |   
| | | | | | | | | | | | | | | | |    | 
We're gonna need this for the help channel handling, and it seems like a
reasonable type to support anyway. It requires a tiny bit of special
handling, but nothing outrageous.
 | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | |  | 
The function doesn't take the loop as an argument anymore
 | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | |  | 
Recent changes to the scheduler requires this line to be removed.
 | 
| | | | | | | |\ \ \ \ \ \ \ \ \ \ \   | 
 | 
| | | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | |  | 
It could have caused an issue later with a mix of naive and aware datetime
Co-Authored-By: Sebastiaan Zeeff <[email protected]>
 | 
| | | | | | | |\ \ \ \ \ \ \ \ \ \ \ \   | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | |\ \ \ \ \ \ \ \ \ \ \ \ \   | 
 | 
| | | | | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | | | | | |  | 
Co-Authored-By: Mark <[email protected]>
 | 
| | | | | | | |\ \ \ \ \ \ \ \ \ \ \ \ \ \   | 
 | 
| | | | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \   | 
 | 
| | | | | | | | | | | | | | | | | | | | | | |  | 
 | 
| | | | | | | | | | | | | | | | | | | | | | |  | 
 |