[Mod] Fix + more info for modset defaultduration (#4525)

* [Mod] Fix + more info for modset defaultduration

* Update settings.py

* Duration must be greater than zero

* Don't need the extra parens here
This commit is contained in:
aikaterna 2020-10-25 12:43:44 -07:00 committed by GitHub
parent ce6c17debc
commit 18986bcc42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -377,9 +377,20 @@ class ModSettings(MixinMeta):
async def defaultduration( async def defaultduration(
self, self,
ctx: commands.Context, ctx: commands.Context,
duration: Optional[commands.TimedeltaConverter] = timedelta(days=0), *,
duration: commands.TimedeltaConverter(
minimum=timedelta(seconds=1), default_unit="seconds"
),
): ):
"""Set the default time to be used when a user is tempbanned.""" """Set the default time to be used when a user is tempbanned.
Accepts: seconds, minutes, hours, days, weeks
`duration` must be greater than zero.
Examples:
`[p]modset defaultduration 7d12h10m`
`[p]modset defaultduration 7 days 12 hours 10 minutes`
"""
guild = ctx.guild guild = ctx.guild
await self.config.guild(guild).default_tempban_duration.set(duration.total_seconds()) await self.config.guild(guild).default_tempban_duration.set(duration.total_seconds())
await ctx.send( await ctx.send(