WIP: Moderation type registry #26
1 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
|||
import json
|
||||
import sqlite3
|
||||
from datetime import datetime, timedelta
|
||||
from time import time
|
||||
|
@ -106,7 +107,7 @@ class Moderation(AuroraGuildModel):
|
|||
))
|
||||
cursor.close()
|
||||
|
||||
logger.info("Row updated in moderation_%s!\n%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s",
|
||||
logger.debug("Row updated in moderation_%s!\n%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s",
|
||||
self.moderation_id,
|
||||
self.guild_id,
|
||||
self.timestamp.timestamp(),
|
||||
|
@ -278,6 +279,9 @@ class Change(AuroraBaseModel):
|
|||
@classmethod
|
||||
def from_dict(cls, bot: Red, data: dict) -> "Change":
|
||||
logger.debug("Creating Change from dict (%s): %s", type(data), data)
|
||||
if isinstance(data, str):
|
||||
data = json.loads(data)
|
||||
logger.debug("Change data was a string, converted to dict: %s", data)
|
||||
if "duration" in data and data["duration"] and not isinstance(data["duration"], timedelta):
|
||||
hours, minutes, seconds = map(int, data["duration"].split(':'))
|
||||
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
||||
|
|
Loading…
Reference in a new issue