aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Shirayuki Nekomata <[email protected]>2019-11-27 17:16:43 +0700
committerGravatar Shirayuki Nekomata <[email protected]>2019-11-27 17:16:43 +0700
commit0898ce98b6b2a9ac59369d8665ff51a077405c03 (patch)
tree0a3fd82946baf66dbb1fbe9643d0a5fba5275930
parentChanged `get_duration_from_expiry()` to return the `time (duration)` or a `''` (diff)
Refactored `management.py` to use the new `get_duration_from_expiry()`
-rw-r--r--bot/cogs/moderation/management.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/bot/cogs/moderation/management.py b/bot/cogs/moderation/management.py
index 5c63b19ce..5221baa81 100644
--- a/bot/cogs/moderation/management.py
+++ b/bot/cogs/moderation/management.py
@@ -97,9 +97,8 @@ class ModManagement(commands.Cog):
confirm_messages.append("marked as permanent")
elif duration is not None:
request_data['expires_at'] = duration.isoformat()
- expiry = duration.strftime(time.INFRACTION_FORMAT)
- duration_string = time.get_duration(duration, datetime.utcnow())
- confirm_messages.append(f"set to expire on {expiry} ({duration_string})")
+ expiry = time.get_duration_from_expiry(request_data['expires_at'])
+ confirm_messages.append(f"set to expire on {expiry}")
else:
confirm_messages.append("expiry unchanged")
@@ -236,8 +235,8 @@ class ModManagement(commands.Cog):
if infraction["expires_at"] is None:
expires = "*Permanent*"
else:
- duration = time.get_duration_from_expiry(infraction["expires_at"])
- expires = f"{time.format_infraction(infraction['expires_at'])} ({duration})"
+ date_from = datetime.strptime(created, time.INFRACTION_FORMAT)
+ expires = time.get_duration_from_expiry(infraction["expires_at"], date_from)
lines = textwrap.dedent(f"""
{"**===============**" if active else "==============="}