aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2022-03-05 16:52:06 -0800
committerGravatar MarkKoz <[email protected]>2022-03-05 16:53:18 -0800
commit60c5762436dcacef5c67dfc266d3bbecf7349cfb (patch)
tree3fdd4c5b32b2262d1707faa6c62c18b8a9000f12
parentMerge main into feat/mod/1664/resend-infraction (diff)
Fix detection of expired infractions in DMs
-rw-r--r--bot/exts/moderation/infraction/_utils.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/bot/exts/moderation/infraction/_utils.py b/bot/exts/moderation/infraction/_utils.py
index e319f9d71..36e818ec6 100644
--- a/bot/exts/moderation/infraction/_utils.py
+++ b/bot/exts/moderation/infraction/_utils.py
@@ -181,17 +181,15 @@ async def notify_infraction(
duration = "Permanent"
else:
expiry = arrow.get(infraction["expires_at"])
- now = arrow.utcnow()
-
expires_at = time.format_relative(expiry)
duration = time.humanize_delta(infraction["inserted_at"], expiry, max_units=2)
- if expiry < now:
- expires_at += " (Expired)"
- else:
- remaining = time.humanize_delta(expiry, now, max_units=2)
+ if infraction["active"]:
+ remaining = time.humanize_delta(expiry, arrow.utcnow(), max_units=2)
if duration != remaining:
duration += f" ({remaining} remaining)"
+ else:
+ expires_at += " (Inactive)"
log.trace(f"Sending {user} a DM about their {infr_type} infraction.")