diff --git a/docs/cog_guides/economy.rst b/docs/cog_guides/economy.rst index fd20f7398..0a173ffb1 100644 --- a/docs/cog_guides/economy.rst +++ b/docs/cog_guides/economy.rst @@ -302,18 +302,20 @@ economyset paydaytime .. code-block:: none - [p]economyset paydaytime + [p]economyset paydaytime **Description** Set the cooldown for the payday command. -Example: +Examples: - ``[p]economyset paydaytime 86400`` + - ``[p]economyset paydaytime 1d`` **Arguments** -- ```` The new number of seconds to wait in between uses of payday. Default is 300. +- | ```` 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 + [p]economyset slottime **Description** Set the cooldown for the slot machine. -Example: +Examples: - ``[p]economyset slottime 10`` + - ``[p]economyset slottime 10m`` **Arguments** -- ```` The new number of seconds to wait in between uses of the slot machine. Default is 5. +- | ```` 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: diff --git a/redbot/cogs/economy/economy.py b/redbot/cogs/economy/economy.py index fcb4d53e5..81d8a36e3 100644 --- a/redbot/cogs/economy/economy.py +++ b/redbot/cogs/economy/economy.py @@ -11,6 +11,7 @@ import discord from redbot.cogs.bank import is_owner_if_bank_global from redbot.cogs.mod.converters import RawUserIds from redbot.core import Config, bank, commands, errors, checks +from redbot.core.commands.converter import TimedeltaConverter from redbot.core.bot import Red from redbot.core.i18n import Translator, cog_i18n from redbot.core.utils import AsyncIter @@ -904,16 +905,21 @@ class Economy(commands.Cog): ) @economyset.command() - async def slottime(self, ctx: commands.Context, seconds: int): + async def slottime( + self, ctx: commands.Context, *, duration: TimedeltaConverter(default_unit="seconds") + ): """Set the cooldown for the slot machine. - Example: + Examples: - `[p]economyset slottime 10` + - `[p]economyset slottime 10m` **Arguments** - - `` The new number of seconds to wait in between uses of the slot machine. Default is 5. + - `` 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) """ + seconds = int(duration.total_seconds()) guild = ctx.guild if await bank.is_global(): await self.config.SLOT_TIME.set(seconds) @@ -922,16 +928,21 @@ class Economy(commands.Cog): await ctx.send(_("Cooldown is now {num} seconds.").format(num=seconds)) @economyset.command() - async def paydaytime(self, ctx: commands.Context, seconds: int): + async def paydaytime( + self, ctx: commands.Context, *, duration: TimedeltaConverter(default_unit="seconds") + ): """Set the cooldown for the payday command. - Example: + Examples: - `[p]economyset paydaytime 86400` + - `[p]economyset paydaytime 1d` **Arguments** - - `` The new number of seconds to wait in between uses of payday. Default is 300. + - `` 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) """ + seconds = int(duration.total_seconds()) guild = ctx.guild if await bank.is_global(): await self.config.PAYDAY_TIME.set(seconds)