From 99386234ac3aa72d5f81f6104f5f5945bdd6c1e5 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sat, 19 Oct 2019 17:24:58 +0200 Subject: Pluralize "infractions" as necessary. --- bot/cogs/moderation/infractions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py index 592ead60f..e17a9844c 100644 --- a/bot/cogs/moderation/infractions.py +++ b/bot/cogs/moderation/infractions.py @@ -2,6 +2,7 @@ import logging import textwrap import typing as t from datetime import datetime +from gettext import ngettext import dateutil.parser import discord @@ -463,7 +464,8 @@ class Infractions(Scheduler, commands.Cog): "bot/infractions", params={"user__id": str(user.id)} ) - end_msg = f" ({len(infractions)} infractions total)" + total = len(infractions) + end_msg = f" ({total} infraction{ngettext('', 's', total)} total)" # Execute the necessary actions to apply the infraction on Discord. if action_coro: -- cgit v1.2.3 From 48a78deb42d5a96066d96f19e87e7b8586cd62bd Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sat, 19 Oct 2019 17:31:34 +0200 Subject: Do not display an expiry for notes or warnings. --- bot/cogs/moderation/infractions.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py index e17a9844c..f2ae7b95d 100644 --- a/bot/cogs/moderation/infractions.py +++ b/bot/cogs/moderation/infractions.py @@ -437,7 +437,13 @@ class Infractions(Scheduler, commands.Cog): # Default values for the confirmation message and mod log. confirm_msg = f":ok_hand: applied" - expiry_msg = f" until {expiry}" if expiry else " permanently" + + # Specifying an expiry for a note or warning makes no sense. + if infr_type in ("note", "warning"): + expiry_msg = "" + else: + expiry_msg = f" until {expiry}" if expiry else " permanently" + dm_result = "" dm_log_text = "" expiry_log_text = f"Expires: {expiry}" if expiry else "" -- cgit v1.2.3