fix(moderation): only reduce length of reason in /history if it is actually below 150 characters
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 55s
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 55s
This commit is contained in:
parent
9cd63ce92b
commit
adbe4b4d85
1 changed files with 5 additions and 1 deletions
|
@ -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']}"
|
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']}"
|
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_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':
|
if case['duration'] != 'NULL':
|
||||||
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case["duration"].split(":"))})
|
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case["duration"].split(":"))})
|
||||||
duration_embed = f"{humanize.precisedelta(td)} | <t:{case['end_timestamp']}:R>" if bool(case['expired']) is False else f"{humanize.precisedelta(td)} | Expired"
|
duration_embed = f"{humanize.precisedelta(td)} | <t:{case['end_timestamp']}:R>" if bool(case['expired']) is False else f"{humanize.precisedelta(td)} | Expired"
|
||||||
|
|
Loading…
Reference in a new issue