aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-10-01 14:09:08 -0700
committerGravatar MarkKoz <[email protected]>2019-10-01 18:25:33 -0700
commit5d8559eac24cde0a73efae38973b94d741e0798c (patch)
tree94bdd1eb7fa24e0206fd3cdfa4b3ead44369e47e
parentAdd a generic function to pardon infractions (diff)
Add reason for pardons in audit log
-rw-r--r--bot/cogs/moderation/infractions.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py
index 59276279e..92b2b92f9 100644
--- a/bot/cogs/moderation/infractions.py
+++ b/bot/cogs/moderation/infractions.py
@@ -273,6 +273,7 @@ class Infractions(Scheduler, Cog):
user_id = infraction["user"]
_type = infraction["type"]
_id = infraction["id"]
+ reason = f"Infraction #{_id} expired or was pardoned."
log_text = {
"Member": str(user_id),
@@ -285,7 +286,7 @@ class Infractions(Scheduler, Cog):
if user:
# Remove the muted role.
self.mod_log.ignore(Event.member_update, user.id)
- await user.remove_roles(self._muted_role)
+ await user.remove_roles(self._muted_role, reason=reason)
# DM the user about the expiration.
notified = await self.notify_pardon(
@@ -302,7 +303,7 @@ class Infractions(Scheduler, Cog):
elif _type == "ban":
user = Object(user_id)
try:
- await guild.unban(user)
+ await guild.unban(user, reason=reason)
except NotFound:
log.info(f"Failed to unban user {user_id}: no active ban found on Discord")
log_text["Failure"] = "No active ban found on Discord."