From 2e34dbd385b592b76f69c87154d412ba91c00901 Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 18 Aug 2022 15:14:02 -0400 Subject: fix: add check to prevent NoneType from passing into str concatenation --- bot/exts/moderation/infraction/_scheduler.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bot/exts/moderation/infraction/_scheduler.py b/bot/exts/moderation/infraction/_scheduler.py index 557fda25a..864aff9b2 100644 --- a/bot/exts/moderation/infraction/_scheduler.py +++ b/bot/exts/moderation/infraction/_scheduler.py @@ -443,11 +443,15 @@ class InfractionScheduler: try: # Mark infraction as inactive in the database. log.trace(f"Marking infraction #{id_} as inactive in the database.") - - data = {"active": False} - + + data = {"active": False, "reason": ""} + if pardon_reason is not None: - data["reason"] = infraction["reason"] + f" | Pardoned: {pardon_reason}" + # Append pardon reason to infraction in database. + if (punish_reason := infraction["reason"]) is not None: + data["reason"] = punish_reason + " | " + + data["reason"] += f"Pardoned: {pardon_reason}" await self.bot.api_client.patch( f"bot/infractions/{id_}", -- cgit v1.2.3