diff options
| author | 2022-08-06 13:11:36 -0400 | |
|---|---|---|
| committer | 2022-08-06 13:11:36 -0400 | |
| commit | 97b940a24ac90fd7ec8405b84e0b4f419c95d31a (patch) | |
| tree | 7f4aa1e826b31a13dafd6bebf57e5d7f5565f8f0 | |
| parent | Changed datetime.now to arrow.utcnow (diff) | |
Removed `inserted_at` fallback
Given API updates, the fallback is not needed
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/moderation/infraction/_scheduler.py | 11 | ||||
| -rw-r--r-- | bot/exts/moderation/infraction/_utils.py | 7 | 
2 files changed, 5 insertions, 13 deletions
| diff --git a/bot/exts/moderation/infraction/_scheduler.py b/bot/exts/moderation/infraction/_scheduler.py index cfb585bf5..cb3f7149f 100644 --- a/bot/exts/moderation/infraction/_scheduler.py +++ b/bot/exts/moderation/infraction/_scheduler.py @@ -138,13 +138,10 @@ class InfractionScheduler:          icon = _utils.INFRACTION_ICONS[infr_type][0]          reason = infraction["reason"]          id_ = infraction['id'] - -        if "last_applied" in infraction: -            origin = infraction["last_applied"] -        else:  # Fallback for previous API versions without `last_applied` -            log.trace(f"No last_applied for infraction {id_}, using inserted_at time.") -            origin = infraction["inserted_at"] -        expiry = time.format_with_duration(infraction["expires_at"], origin) +        expiry = time.format_with_duration( +            infraction["expires_at"], +            infraction["last_applied"] +        )          if user_reason is None:              user_reason = reason diff --git a/bot/exts/moderation/infraction/_utils.py b/bot/exts/moderation/infraction/_utils.py index eda56b97c..407c97251 100644 --- a/bot/exts/moderation/infraction/_utils.py +++ b/bot/exts/moderation/infraction/_utils.py @@ -188,12 +188,7 @@ async def notify_infraction(          expires_at = "Never"          duration = "Permanent"      else: -        if "last_applied" in infraction: -            origin = infraction["last_applied"] -        else:  # Fallback for previous API versions without `last_applied` -            log.trace(f"No last_applied for infraction {infraction}, using inserted_at time.") -            origin = infraction["inserted_at"] -        origin = arrow.get(origin) +        origin = arrow.get(infraction["last_applied"])          expiry = arrow.get(infraction["expires_at"])          expires_at = time.format_relative(expiry)          duration = time.humanize_delta(origin, expiry, max_units=2) | 
