diff --git a/redbot/core/commands/converter.py b/redbot/core/commands/converter.py index 51948fa2ec1..68c023aa3a9 100644 --- a/redbot/core/commands/converter.py +++ b/redbot/core/commands/converter.py @@ -334,6 +334,7 @@ class TimedeltaConverter(dpy_commands.Converter): If provided, any parsed value higher than this will raise an exception minimum : Optional[datetime.timedelta] If provided, any parsed value lower than this will raise an exception + Defaults to 0 seconds, pass None explicitly to allow negative values allowed_units : Optional[List[str]] If provided, you can constrain a user to expressing the amount of time in specific units. The units you can choose to provide are the same as the @@ -344,7 +345,14 @@ class TimedeltaConverter(dpy_commands.Converter): apply. """ - def __init__(self, *, minimum=None, maximum=None, allowed_units=None, default_unit=None): + def __init__( + self, + *, + minimum=timedelta(seconds=0), + maximum=None, + allowed_units=None, + default_unit=None, + ): self.allowed_units = allowed_units self.default_unit = default_unit self.minimum = minimum @@ -372,7 +380,7 @@ def get_timedelta_converter( *, default_unit: Optional[str] = None, maximum: Optional[timedelta] = None, - minimum: Optional[timedelta] = None, + minimum: Optional[timedelta] = timedelta(seconds=0), allowed_units: Optional[List[str]] = None, ) -> Type[timedelta]: ... @@ -383,7 +391,7 @@ def get_timedelta_converter( *, default_unit: Optional[str] = None, maximum: Optional[timedelta] = None, - minimum: Optional[timedelta] = None, + minimum: Optional[timedelta] = timedelta(seconds=0), allowed_units: Optional[List[str]] = None, ) -> Type[timedelta]: """ @@ -398,6 +406,7 @@ def get_timedelta_converter( If provided, any parsed value higher than this will raise an exception minimum : Optional[datetime.timedelta] If provided, any parsed value lower than this will raise an exception + Defaults to 0 seconds, pass None explicitly to allow negative values allowed_units : Optional[List[str]] If provided, you can constrain a user to expressing the amount of time in specific units. The units you can choose to provide are the same as the