diff options
author | 2024-04-27 11:31:37 +0100 | |
---|---|---|
committer | 2024-04-27 10:31:37 +0000 | |
commit | 161370e61f1003a5316eb2be2c44e2b4bd8cd9f1 (patch) | |
tree | e09e482c02c639d02a40355224cf03082253816c | |
parent | Bump ruff from 0.4.1 to 0.4.2 (#3030) (diff) |
Use correct key to check if infraction has expiry (#3021)
-rw-r--r-- | bot/exts/moderation/infraction/infractions.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bot/exts/moderation/infraction/infractions.py b/bot/exts/moderation/infraction/infractions.py index e435035f2..a09568b4f 100644 --- a/bot/exts/moderation/infraction/infractions.py +++ b/bot/exts/moderation/infraction/infractions.py @@ -471,13 +471,16 @@ class Infractions(InfractionScheduler, commands.Cog): log.trace("Tempban ignored as it cannot overwrite an active ban.") return None - if active_infraction.get("duration_or_expiry") is None: + if active_infraction.get("expires_at") is None: log.trace("Permaban already exists, notify.") await ctx.send(f":x: User is already permanently banned (#{active_infraction['id']}).") - return None + else: + log.trace("Tempban exists, notify.") + await ctx.send( + f":x: Can't permanently ban user with existing temporary ban (#{active_infraction['id']}). " + ) - log.trace("Old tempban is being replaced by new permaban.") - await self.pardon_infraction(ctx, "ban", user, send_msg=is_temporary) + return None infraction = await _utils.post_infraction(ctx, user, "ban", reason, active=True, **kwargs) if infraction is None: |