diff options
| author | 2022-08-18 15:14:02 -0400 | |
|---|---|---|
| committer | 2022-08-18 15:14:02 -0400 | |
| commit | 2e34dbd385b592b76f69c87154d412ba91c00901 (patch) | |
| tree | fd97dd64d6def851d29c2f24bc815bed464a568a | |
| parent | change: make unban require pardon reason (diff) | |
fix: add check to prevent NoneType from passing into str concatenation
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/moderation/infraction/_scheduler.py | 12 |
1 files 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_}", |