aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_base.py
diff options
context:
space:
mode:
authorGravatar Den4200 <[email protected]>2020-07-01 16:37:48 +0000
committerGravatar Den4200 <[email protected]>2020-07-01 16:37:48 +0000
commitbd041ef4363ad8750d619d97fb7e8f3a4c6ae757 (patch)
treea3336e27cc7aea31af80eab97d303d370c1316a7 /tests/test_base.py
parentAdd some logging for the Slowmode cog (diff)
Create DurationDelta converter and humanize timedelta output for Slowmode cog.
The DurationDelta converter will allow the Slowmode cog to use a formatted timestamp instead of an integer representing seconds. I created a new converter because the Duration converter returned a datetime.datetime object, instead of a time delta. Joe mentioned that I could just subtract the datetime.datetime object from datetime.utcnow(), but there is a small delay between conversion and when the function is actually executed. This caused something like `!slowmode set #python-general 5s` to set the slowmode delay to 4 seconds instead of 5. Now, with this new converter, the set command can be invoked using a formatted timestamp like so: `!slowmode set #python-general 4h23M19s`. This would set the slowmode delay in #python-general to 4 hours, 23 minutes, and 19 seconds. Of course that delay would be quite overkill for #python-general, but that's just for the sake of this example.
Diffstat (limited to 'tests/test_base.py')
0 files changed, 0 insertions, 0 deletions