Update [p]economyset slottime&paydaytime to use TimedeltaConverter and not accept negative integers (#4807)

* add a time converter, as well as not allowing negative integers

* timedeltaconverter

* styling and unused imports

* update docstrings

* update param name to "duration" instead of seconds

* make timedelta default_unit seconds

* better descriptions & docstrings

* docs for updated paydaytime & slottime

* Fix style

* Few minor fixes

* Cast `total_seconds()` return type to `int`

* Fix one of my own issues

* Make the duration argument catch-rest for convenience

* One more fix for the docs

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Andy
2021-02-15 13:25:03 -08:00
committed by GitHub
parent 1a9ce2040a
commit 5b670c074f
2 changed files with 27 additions and 12 deletions

View File

@@ -302,18 +302,20 @@ economyset paydaytime
.. code-block:: none
[p]economyset paydaytime <seconds>
[p]economyset paydaytime <duration>
**Description**
Set the cooldown for the payday command.
Example:
Examples:
- ``[p]economyset paydaytime 86400``
- ``[p]economyset paydaytime 1d``
**Arguments**
- ``<seconds>`` The new number of seconds to wait in between uses of payday. Default is 300.
- | ``<duration>`` The new duration to wait in between uses of payday. Default is 5 minutes.
| Accepts: seconds, minutes, hours, days, weeks (if no unit is specified, the duration is assumed to be given in seconds)
.. _economy-command-economyset-registeramount:
@@ -436,18 +438,20 @@ economyset slottime
.. code-block:: none
[p]economyset slottime <seconds>
[p]economyset slottime <duration>
**Description**
Set the cooldown for the slot machine.
Example:
Examples:
- ``[p]economyset slottime 10``
- ``[p]economyset slottime 10m``
**Arguments**
- ``<seconds>`` The new number of seconds to wait in between uses of the slot machine. Default is 5.
- | ``<duration>`` The new duration to wait in between uses of the slot machine. Default is 5 seconds.
| Accepts: seconds, minutes, hours, days, weeks (if no unit is specified, the duration is assumed to be given in seconds)
.. _economy-command-leaderboard: