From adbe4b4d854a783d55482052976a3f530e29c2a2 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 14 Dec 2023 14:57:28 -0500 Subject: [PATCH] fix(moderation): only reduce length of reason in /history if it is actually below 150 characters --- moderation/moderation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/moderation/moderation.py b/moderation/moderation.py index 534bbe0..fdd4333 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -791,7 +791,11 @@ class Moderation(commands.Cog): target_name = target_user['name'] if target_user['discriminator'] == "0" else f"{target_user['name']}#{target_user['discriminator']}" moderator_name = moderator_user['name'] if moderator_user['discriminator'] == "0" else f"{moderator_user['name']}#{moderator_user['discriminator']}" field_name = f"Case #{case['moderation_id']} ({str.title(case['moderation_type'])})" - field_value = f"**Target:** `{target_name}` ({target_user['id']})\n**Moderator:** `{moderator_name}` ({moderator_user['id']})\n**Reason:** `{str(case['reason'])[:150]}`" + field_value = f"**Target:** `{target_name}` ({target_user['id']})\n**Moderator:** `{moderator_name}` ({moderator_user['id']})" + if len(case['reason']) > 150: + field_value += f"\n**Reason:** `{str(case['reason'])[:150]}...`" + else: + field_value += f"\n**Reason:** `{str(case['reason'])}`" if case['duration'] != 'NULL': td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case["duration"].split(":"))}) duration_embed = f"{humanize.precisedelta(td)} | " if bool(case['expired']) is False else f"{humanize.precisedelta(td)} | Expired"