From f6615746c96f4b9034125866607851c9ecc7bcc2 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 5 Oct 2023 13:28:55 -0400 Subject: [PATCH] fix(moderation): added timedelta variable to hopefully fix durations --- moderation/moderation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moderation/moderation.py b/moderation/moderation.py index bed5a36..dbee4ff 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -388,7 +388,8 @@ class Moderation(commands.Cog): embed.description = f"**Type:** {str.title(case['moderation_type'])}\n**Target:** {target_name} ({target.id})\n**Moderator:** {moderator_name} ({moderator.id})\n**Resolved:** {bool(case['resolved'])}\n**Timestamp:** | " if case['duration'] != 'NULL': expired = True if case["end_timestamp"] <= time.time() or case['resolved'] == 1 else False - embed.description = embed.description + f"\n**Duration:** {humanize.precisedelta(case['duration'])}\n**Expired:** {expired}" + timedelta = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case['duration'].split(":"))}) + embed.description = embed.description + f"\n**Duration:** {humanize.precisedelta(timedelta)}\n**Expired:** {expired}" embed.add_field(name='Reason', value=f"```{case['reason']}```", inline=False) if case['resolved'] == 1: embed.add_field(name='Resolve Reason', value=f"```{case['resolve_reason']}```", inline=False)