feat(aurora): added imported_timestamp to metadata on new imports
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Successful in 36s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 51s

This commit is contained in:
Seaswimmer 2024-05-04 15:13:31 -04:00
parent 58303b8e9c
commit df87612055
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F
2 changed files with 8 additions and 5 deletions

View file

@ -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(":"))

View file

@ -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,