From 17d6d80a78b8ab66d2f82060cb8334ccd8c62bca Mon Sep 17 00:00:00 2001 From: Daniel Brown Date: Wed, 18 Sep 2019 10:54:49 -0500 Subject: Infraction Date Humanization - Changed the date returned on infraction searches to use the `"%c"` strftime format instead of the standard ISO format. Signed-off-by: Daniel Brown --- bot/cogs/moderation.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bot/cogs/moderation.py b/bot/cogs/moderation.py index c631dd69d..898f053f5 100644 --- a/bot/cogs/moderation.py +++ b/bot/cogs/moderation.py @@ -1260,6 +1260,11 @@ class Moderation(Scheduler, Cog): active = infraction_object["active"] user_id = infraction_object["user"] hidden = infraction_object["hidden"] + created = datetime.fromisoformat(infraction_object["inserted_at"].strftime("%c")) + if not infraction_object["expires_at"]: + expires = "*Permanent*" + else: + expires = datetime.fromisoformat(infraction_object["expires_at"].strftime("%c")) lines = textwrap.dedent(f""" {"**===============**" if active else "==============="} @@ -1268,8 +1273,8 @@ class Moderation(Scheduler, Cog): Type: **{infraction_object["type"]}** Shadow: {hidden} Reason: {infraction_object["reason"] or "*None*"} - Created: {infraction_object["inserted_at"]} - Expires: {infraction_object["expires_at"] or "*Permanent*"} + Created: {created} + Expires: {expires} Actor: {actor.mention if actor else actor_id} ID: `{infraction_object["id"]}` {"**===============**" if active else "==============="} -- cgit v1.2.3