Refactor bot and integrate services

This commit is contained in:
2026-02-07 22:10:08 +03:00
parent 492e3bd3cf
commit 588127c076
31 changed files with 1061 additions and 849 deletions

22
services/artifacts.py Normal file
View File

@@ -0,0 +1,22 @@
import json
from datetime import datetime
from pathlib import Path
def artifact_last(state_file: str) -> str:
data = json.loads(Path(state_file).read_text())
items = sorted(
data.items(),
key=lambda x: x[1]["updated_at"],
reverse=True
)
name, info = items[0]
t = datetime.fromisoformat(info["updated_at"])
age_h = int((datetime.now() - t).total_seconds() / 3600)
return (
"🧉 Last artifact\n\n"
f"{name}\n"
f"Updated: {t:%Y-%m-%d %H:%M}\n"
f"Age: {age_h}h"
)