WIP: Refactor Aurora (3.0.0) #29
2 changed files with 8 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
# pylint: disable=duplicate-code
|
||||
import json
|
||||
from datetime import timedelta
|
||||
from time import time
|
||||
from typing import Dict
|
||||
|
||||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
|
@ -78,6 +79,7 @@ class ImportAuroraView(ui.View):
|
|||
metadata: Dict[str, any] = json.loads(case["metadata"])
|
||||
if not metadata.get("imported_from"):
|
||||
metadata.update({"imported_from": "Aurora"})
|
||||
metadata.update({"imported_timestamp": int(time())})
|
||||
|
||||
if case["duration"] != "NULL" and case["duration"] is not None:
|
||||
hours, minutes, seconds = map(int, case["duration"].split(":"))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# pylint: disable=duplicate-code
|
||||
import json
|
||||
from datetime import timedelta
|
||||
from time import time
|
||||
|
||||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
from redbot.core import commands
|
||||
|
@ -67,12 +68,12 @@ class ImportGalacticBotView(ui.View):
|
|||
if case["duration"] is not None and float(case["duration"]) != 0:
|
||||
duration = timedelta(seconds=round(float(case["duration"]) / 1000))
|
||||
else:
|
||||
duration = "NULL"
|
||||
duration = None
|
||||
except OverflowError:
|
||||
failed_cases.append(case["case"])
|
||||
continue
|
||||
|
||||
metadata = {"imported_from": "GalacticBot"}
|
||||
metadata = {"imported_from": "GalacticBot", "imported_timestamp": int(time())}
|
||||
|
||||
if case["type"] == "SLOWMODE":
|
||||
metadata["seconds"] = case["data"]["seconds"]
|
||||
|
@ -113,14 +114,14 @@ class ImportGalacticBotView(ui.View):
|
|||
]
|
||||
else:
|
||||
resolved = 0
|
||||
resolved_by = "NULL"
|
||||
resolved_reason = "NULL"
|
||||
resolved_by = None
|
||||
resolved_reason = None
|
||||
changes = []
|
||||
|
||||
if case["reason"] and case["reason"] != "N/A":
|
||||
reason = case["reason"]
|
||||
else:
|
||||
reason = "NULL"
|
||||
reason = None
|
||||
|
||||
await mysql_log(
|
||||
self.ctx.guild.id,
|
||||
|
|
Loading…
Reference in a new issue