diff options
| -rw-r--r-- | bot/exts/moderation/infraction/_utils.py | 15 | ||||
| -rw-r--r-- | bot/exts/moderation/infraction/management.py | 2 | 
2 files changed, 7 insertions, 10 deletions
| diff --git a/bot/exts/moderation/infraction/_utils.py b/bot/exts/moderation/infraction/_utils.py index 02e3ae1aa..c03081b07 100644 --- a/bot/exts/moderation/infraction/_utils.py +++ b/bot/exts/moderation/infraction/_utils.py @@ -44,8 +44,8 @@ LONGEST_EXTRAS = max(len(INFRACTION_APPEAL_SERVER_FOOTER), len(INFRACTION_APPEAL  INFRACTION_DESCRIPTION_TEMPLATE = (      "**Type:** {type}\n" -    "**Expires:** {expires}\n"      "**Duration:** {duration}\n" +    "**Expires:** {expires}\n"      "**Reason:** {reason}\n"  ) @@ -170,16 +170,13 @@ async def send_active_infraction_message(ctx: Context, infraction: Infraction) -  async def notify_infraction(          infraction: Infraction,          user: MemberOrUser, -        reason: t.Optional[str] = None, -        resend: bool = False +        reason: t.Optional[str] = None  ) -> bool:      """      DM a user about their new infraction and return True if the DM is successful.      `reason` can be used to override what is in `infraction`. Otherwise, this data will      be retrieved from `infraction`. - -    If `resend` is True, the DM will include both the duration and remaining time.      """      infr_id = infraction["id"]      infr_type = infraction["type"].replace("_", " ").title() @@ -194,12 +191,12 @@ async def notify_infraction(          expires_at = time.format_relative(expiry)          duration = time.humanize_delta(origin, expiry, max_units=2) -        if infraction["active"] and resend: -            remaining = time.humanize_delta(expiry, arrow.utcnow(), max_units=2) -            duration += f" ({remaining} remaining)" -        elif not infraction["active"]: +        if not infraction["active"]:              expires_at += " (Inactive)" +        if infraction["inserted_at"] != infraction["last_applied"]: +            duration += " (Edited)" +      log.trace(f"Sending {user} a DM about their {infr_type} infraction.")      if reason is None: diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py index 090fbcdbd..6ef382119 100644 --- a/bot/exts/moderation/infraction/management.py +++ b/bot/exts/moderation/infraction/management.py @@ -79,7 +79,7 @@ class ModManagement(commands.Cog):          reason = infraction["reason"] or "No reason provided."          reason += "\n\n**This is a re-sent message for a previously applied infraction which may have been edited.**" -        if await _utils.notify_infraction(infraction, member, reason, resend=True): +        if await _utils.notify_infraction(infraction, member, reason):              await ctx.send(f":incoming_envelope: Resent DM for infraction `{id_}`.")          else:              await ctx.send(f"{constants.Emojis.failmail} Failed to resend DM for infraction `{id_}`.") | 
