fix(moderation): time until duration expiry only appears now if the moderation hasn't expired yet
Some checks failed
Pylint / Pylint (push) Failing after 1m13s

This commit is contained in:
Seaswimmer 2023-10-05 16:37:01 -04:00
parent 696165239f
commit 613a267797
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -393,7 +393,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:** <t:{case['timestamp']}> | <t:{case['timestamp']}:R>"
if case['duration'] != 'NULL':
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case["duration"].split(":"))})
embed.description = embed.description + f"\n**Duration:** {humanize.precisedelta(td)} | <t:{case['end_timestamp']}:R>\n**Expired:** {bool(case['expired'])}"
duration_embed = f"{humanize.precisedelta(td)} | <t:{case['end_timestamp']}:R>" if case["expired"] == '0' else {humanize.precisedelta(td)}
embed.description = embed.description + f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case['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)