From 0386cb346ef1f06500b7499dc8c9d93e98035b9f Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 6 May 2024 14:35:02 -0400 Subject: [PATCH] fix(aurora): finally fixed the debug logging statement (maybe) --- aurora/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/aurora/models.py b/aurora/models.py index cae9d23..b758bab 100644 --- a/aurora/models.py +++ b/aurora/models.py @@ -1,6 +1,5 @@ import sqlite3 from datetime import datetime, timedelta -from itertools import chain from time import time from typing import Any, Dict, List, Literal, Optional, Union @@ -229,23 +228,25 @@ 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_safe.values())) + cursor.execute(sql, tuple(case_sql.values())) cursor.close() database.commit() if close_db: database.close() + 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(chain({"guild_id": guild_id}.values(), case_safe.values())) + tuple(case_safe.values()) ) return cls.from_dict(bot=bot, **case)