Initial version of Telegram admin bot

This commit is contained in:
root
2026-02-07 21:34:24 +03:00
commit 492e3bd3cf
9 changed files with 1027 additions and 0 deletions

21
artifacts.py Normal file
View File

@@ -0,0 +1,21 @@
import json
from datetime import datetime
from pathlib import Path
def artifact_last(state_file):
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"
)