From 70c00a59d620f607d81c9ee4b49e443cbbe5950d Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 6 May 2024 14:40:14 -0400 Subject: [PATCH] fix(aurora): fixed the broken logging statement --- aurora/models.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/aurora/models.py b/aurora/models.py index b758bab..3304909 100644 --- a/aurora/models.py +++ b/aurora/models.py @@ -150,7 +150,7 @@ class Moderation(AuroraGuildModel): cls, bot: Red, guild_id: int, - author_id: int, + moderator_id: int, moderation_type: str, target_type: str, target_id: int, @@ -214,7 +214,7 @@ class Moderation(AuroraGuildModel): "moderation_type": moderation_type, "target_type": target_type, "target_id": target_id, - "moderator_id": author_id, + "moderator_id": moderator_id, "role_id": role_id, "duration": duration, "end_timestamp": end_timestamp, @@ -228,15 +228,14 @@ class Moderation(AuroraGuildModel): } case_safe = case.copy() + case_safe.pop("guild_id") case_safe["timestamp"] = case_safe["timestamp"].timestamp() case_safe["end_timestamp"] = case_safe["end_timestamp"].timestamp() if case_safe["end_timestamp"] else None case_safe["changes"] = dumps(case_safe["changes"]) case_safe["metadata"] = dumps(case_safe["metadata"]) - case_sql = case_safe.copy() - case_sql.pop("guild_id") sql = f"INSERT INTO `moderation_{guild_id}` (moderation_id, timestamp, moderation_type, target_type, target_id, moderator_id, role_id, duration, end_timestamp, reason, resolved, resolved_by, resolve_reason, expired, changes, metadata) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" - cursor.execute(sql, tuple(case_sql.values())) + cursor.execute(sql, tuple(case_safe.values())) cursor.close() database.commit() @@ -246,7 +245,23 @@ class Moderation(AuroraGuildModel): case_safe.update({"guild_id": guild_id}) logger.debug( "Row inserted into moderation_%s!\n%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s", - tuple(case_safe.values()) + guild_id, + case_safe["moderation_id"], + case_safe["timestamp"], + case_safe["moderation_type"], + case_safe["target_type"], + case_safe["target_id"], + case_safe["moderator_id"], + case_safe["role_id"], + case_safe["duration"], + case_safe["end_timestamp"], + case_safe["reason"], + case_safe["resolved"], + case_safe["resolved_by"], + case_safe["resolve_reason"], + case_safe["expired"], + case_safe["changes"], + case_safe["metadata"], ) return cls.from_dict(bot=bot, **case)