WIP: Moderation type registry #26
1 changed files with 2 additions and 2 deletions
|
@ -360,10 +360,10 @@ class Change(AuroraBaseModel):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls, bot: Red, data: dict) -> "Change":
|
def from_dict(cls, bot: Red, data: dict) -> "Change":
|
||||||
logger.debug("Creating Change from dict (%s): %s", type(data), data)
|
logger.trace("Creating Change from dict (%s): %s", type(data), data)
|
||||||
if isinstance(data, str):
|
if isinstance(data, str):
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
logger.debug("Change data was a string, converted to dict: %s", data)
|
logger.trace("Change data was a string, converted to dict: %s", data)
|
||||||
if "duration" in data and data["duration"] and not isinstance(data["duration"], timedelta):
|
if "duration" in data and data["duration"] and not isinstance(data["duration"], timedelta):
|
||||||
hours, minutes, seconds = map(int, data["duration"].split(':'))
|
hours, minutes, seconds = map(int, data["duration"].split(':'))
|
||||||
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
||||||
|
|
Loading…
Reference in a new issue