From 47d4675f52b44ee6c34ac8d735083d0f2e45273b Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Sun, 21 Apr 2024 00:27:40 +0200 Subject: [PATCH] Fix error message edge case in parse_timedelta (#6357) --- redbot/core/commands/converter.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/redbot/core/commands/converter.py b/redbot/core/commands/converter.py index 3acacbdfa..015a4c079 100644 --- a/redbot/core/commands/converter.py +++ b/redbot/core/commands/converter.py @@ -151,13 +151,19 @@ def parse_timedelta( raise BadArgument( _( "This amount of time is too large for this command. (Maximum: {maximum})" - ).format(maximum=humanize_timedelta(timedelta=maximum)) + ).format( + maximum=humanize_timedelta(seconds=math.floor(maximum.total_seconds())) + or _("0 seconds") + ) ) if delta < minimum: raise BadArgument( _( "This amount of time is too small for this command. (Minimum: {minimum})" - ).format(minimum=humanize_timedelta(timedelta=minimum)) + ).format( + minimum=humanize_timedelta(seconds=math.ceil(minimum.total_seconds())) + or _("0 seconds") + ) ) return delta return None