diff options
author | 2022-01-05 14:29:15 +0530 | |
---|---|---|
committer | 2022-01-05 14:29:15 +0530 | |
commit | 5f48d63d035fc7010755fd5595374459e060f1c6 (patch) | |
tree | d471a2078c779e06b65994f33f8a5f45259ffe50 | |
parent | modlog: wait for guild init before using channel cache (diff) |
disallow editing infraction durations into the past
-rw-r--r-- | bot/exts/moderation/infraction/management.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py index 9649ff852..66ce698ee 100644 --- a/bot/exts/moderation/infraction/management.py +++ b/bot/exts/moderation/infraction/management.py @@ -150,6 +150,10 @@ class ModManagement(commands.Cog): request_data['expires_at'] = None confirm_messages.append("marked as permanent") elif duration is not None: + now_datetime = datetime.now(duration.tzinfo) if duration.tzinfo else datetime.utcnow() + if duration < now_datetime: + await ctx.send(":x: Expiration is in the past.") + return request_data['expires_at'] = duration.isoformat() expiry = time.format_infraction_with_duration(request_data['expires_at']) confirm_messages.append(f"set to expire on {expiry}") |