aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Shirayuki Nekomata <[email protected]>2019-11-27 15:07:21 +0700
committerGravatar Shirayuki Nekomata <[email protected]>2019-11-27 15:07:21 +0700
commit91b213227bb83a3e4d8be1f526b45c3c6d73fbc0 (patch)
treefcf4949cd7f90444b6664ee607f1649e01f39190
parentUpdated `bot.utils.time.get_duration_from_expiry()` to accept an optional `da... (diff)
Added expiry duration when applying infraction ( including in the embed sent to user )
-rw-r--r--bot/cogs/moderation/scheduler.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/bot/cogs/moderation/scheduler.py b/bot/cogs/moderation/scheduler.py
index 49b61f35e..9e987d9ee 100644
--- a/bot/cogs/moderation/scheduler.py
+++ b/bot/cogs/moderation/scheduler.py
@@ -84,12 +84,15 @@ class InfractionScheduler(Scheduler):
icon = utils.INFRACTION_ICONS[infr_type][0]
reason = infraction["reason"]
expiry = infraction["expires_at"]
+ expiry_at = expiry
id_ = infraction['id']
log.trace(f"Applying {infr_type} infraction #{id_} to {user}.")
if expiry:
+ duration = time.get_duration_from_expiry(expiry)
expiry = time.format_infraction(expiry)
+ expiry_at = f"{expiry} ({duration})"
# Default values for the confirmation message and mod log.
confirm_msg = f":ok_hand: applied"
@@ -98,11 +101,11 @@ class InfractionScheduler(Scheduler):
if infr_type in ("note", "warning"):
expiry_msg = ""
else:
- expiry_msg = f" until {expiry}" if expiry else " permanently"
+ expiry_msg = f" until {expiry_at}" if expiry else " permanently"
dm_result = ""
dm_log_text = ""
- expiry_log_text = f"Expires: {expiry}" if expiry else ""
+ expiry_log_text = f"Expires: {expiry_at}" if expiry else ""
log_title = "applied"
log_content = None
@@ -112,7 +115,7 @@ class InfractionScheduler(Scheduler):
user = await self.bot.fetch_user(user.id)
# Accordingly display whether the user was successfully notified via DM.
- if await utils.notify_infraction(user, infr_type, expiry, reason, icon):
+ if await utils.notify_infraction(user, infr_type, expiry_at, reason, icon):
dm_result = ":incoming_envelope: "
dm_log_text = "\nDM: Sent"
else: