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