fix(aurora): fixed an issue with dictionary values not being converted to a tuple
This commit is contained in:
parent
e591b2c4a5
commit
65bb9af7a6
1 changed files with 3 additions and 9 deletions
|
@ -167,7 +167,6 @@ class Moderation(AuroraGuildModel):
|
|||
metadata: dict = None,
|
||||
) -> "Moderation":
|
||||
from aurora.utilities.database import connect
|
||||
from aurora.utilities.json import dumps
|
||||
if not timestamp:
|
||||
timestamp = datetime.fromtimestamp(time())
|
||||
elif not isinstance(timestamp, datetime):
|
||||
|
@ -229,16 +228,11 @@ class Moderation(AuroraGuildModel):
|
|||
|
||||
case_safe = case.copy()
|
||||
case_safe.pop("guild_id")
|
||||
case_safe["timestamp"] = int(case_safe["timestamp"].timestamp())
|
||||
case_safe["end_timestamp"] = int(case_safe["end_timestamp"].timestamp()) if case_safe["end_timestamp"] else None
|
||||
case_safe["duration"] = str(case_safe["duration"])
|
||||
case_safe["resolved"] = int(case_safe["resolved"])
|
||||
case_safe["expired"] = int(case_safe["expired"])
|
||||
case_safe["changes"] = dumps(case_safe["changes"])
|
||||
case_safe["metadata"] = dumps(case_safe["metadata"])
|
||||
case_safe["timestamp"] = case_safe["timestamp"].timestamp()
|
||||
case_safe["end_timestamp"] = case_safe["end_timestamp"].timestamp() if case_safe["end_timestamp"] else None
|
||||
|
||||
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, case_safe.values())
|
||||
cursor.execute(sql, tuple(case_safe.values()))
|
||||
|
||||
cursor.close()
|
||||
database.commit()
|
||||
|
|
Loading…
Reference in a new issue