Initial commit: memo app with FastAPI, SQLite, APScheduler, Discord notifications

This commit is contained in:
2026-04-30 14:03:11 +02:00
commit 748ee8ae75
11 changed files with 727 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import requests
from .database import get_db
def get_webhook_url() -> str:
with get_db() as conn:
row = conn.execute("SELECT value FROM settings WHERE key = 'discord_webhook'").fetchone()
return row["value"] if row else ""
def send_reminder(memo: dict):
url = get_webhook_url()
if not url:
return
description = memo["description"] or ""
desc_line = f"\n> {description}" if description else ""
payload = {
"embeds": [{
"title": f"🔔 Rappel : {memo['title']}",
"description": f"{desc_line}\n📅 Créé le {memo['created_at'][:10]}",
"color": 0xf59e0b,
"footer": {"text": "memo.nas.percolouco.com"}
}]
}
try:
requests.post(url, json=payload, timeout=5)
except Exception:
pass