aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-02-15 19:00:20 -0800
committerGravatar MarkKoz <[email protected]>2020-02-15 19:00:20 -0800
commit9f3bcc57d06db73b0aeeeb0959431531ceafd46a (patch)
treec99eb21ceff6a84a827f4a769066801726fff5e9
parentModeration: add creation date & duration to expired infraction log (diff)
Moderation: show correct actor in expired infraction log
The bot user was always being used instead of using the actor field of the infraction.
-rw-r--r--bot/cogs/moderation/scheduler.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bot/cogs/moderation/scheduler.py b/bot/cogs/moderation/scheduler.py
index 6a0ed71a0..e3edc960b 100644
--- a/bot/cogs/moderation/scheduler.py
+++ b/bot/cogs/moderation/scheduler.py
@@ -309,20 +309,21 @@ class InfractionScheduler(Scheduler):
guild = self.bot.get_guild(constants.Guild.id)
mod_role = guild.get_role(constants.Roles.moderator)
user_id = infraction["user"]
+ actor = infraction["actor"]
type_ = infraction["type"]
id_ = infraction["id"]
inserted_at = infraction["inserted_at"]
expiry = infraction["expires_at"]
+ log.info(f"Marking infraction #{id_} as inactive (expired).")
+
expiry = dateutil.parser.isoparse(expiry).replace(tzinfo=None) if expiry else None
created = time.format_infraction_with_duration(inserted_at, expiry)
- log.info(f"Marking infraction #{id_} as inactive (expired).")
-
log_content = None
log_text = {
"Member": str(user_id),
- "Actor": str(self.bot.user),
+ "Actor": str(self.bot.get_user(actor) or actor),
"Reason": infraction["reason"],
"Created": created,
}