Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bot/exts/moderation/infraction/_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ async def apply_infraction(
total = len(infractions)
end_msg = f" (#{id_} ; {total} infraction{ngettext('', 's', total)} total)"

purge = infraction['purge']

# Execute the necessary actions to apply the infraction on Discord.
if action_coro:
log.trace(f"Awaiting the infraction #{id_} application action coroutine.")
Expand Down Expand Up @@ -210,7 +212,7 @@ async def apply_infraction(
log.error(f"Deletion of {infr_type} infraction #{id_} failed with error code {e.status}.")
infr_message = ""
else:
infr_message = f" **{' '.join(infr_type.split('_'))}** to {user.mention}{expiry_msg}{end_msg}"
infr_message = f" **{purge}{' '.join(infr_type.split('_'))}** to {user.mention}{expiry_msg}{end_msg}"

# Send a confirmation message to the invoking context.
log.trace(f"Sending infraction #{id_} confirmation message.")
Expand All @@ -234,7 +236,7 @@ async def apply_infraction(
footer=f"ID {infraction['id']}"
)

log.info(f"Applied {infr_type} infraction #{id_} to {user}.")
log.info(f"Applied {purge}{infr_type} infraction #{id_} to {user}.")
return not failed

async def pardon_infraction(
Expand Down
2 changes: 2 additions & 0 deletions bot/exts/moderation/infraction/infractions.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ async def apply_ban(
if infraction is None:
return

infraction["purge"] = "purge " if purge_days else ""

self.mod_log.ignore(Event.member_remove, user.id)

if reason:
Expand Down
2 changes: 1 addition & 1 deletion tests/bot/exts/moderation/infraction/test_infractions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def test_apply_ban_reason_truncation(self, post_infraction_mock, get_activ
delete_message_days=0
)
self.cog.apply_infraction.assert_awaited_once_with(
self.ctx, {"foo": "bar"}, self.target, self.ctx.guild.ban.return_value
self.ctx, {"foo": "bar", "purge": ""}, self.target, self.ctx.guild.ban.return_value
)

@patch("bot.exts.moderation.infraction._utils.post_infraction")
Expand Down