Feature 3: Devlog-Archiv — Live-Listener + /devlog-backfill

- Webhook-Nachrichten im Devlog-Kanal werden automatisch in SQLite archiviert
  (devlog.py im EcoGame-Repo bleibt unverändert)
- /devlog-backfill (Admin): scannt die komplette Kanal-Historie in 100er-Blöcken
- Dedupe über Discord-Message-ID, Embeds werden mit Titel+Beschreibung erfasst
- Neue Intents: GuildMessages + MessageContent, neue Env-Var DEVLOG_CHANNEL_ID

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 23:51:16 +02:00
co-authored by Claude Opus 4.8
parent 716268b1c1
commit 2c63c62e14
8 changed files with 152 additions and 5 deletions
+20
View File
@@ -23,6 +23,16 @@ db.exec(`
received_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_commits_repo_time ON commits (repo, committed_at DESC);
CREATE TABLE IF NOT EXISTS devlogs (
message_id TEXT PRIMARY KEY,
channel_id TEXT NOT NULL,
content TEXT NOT NULL,
author_name TEXT,
posted_at TEXT NOT NULL,
archived_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_devlogs_posted ON devlogs (posted_at DESC);
`);
const insertCommit = db.prepare(`
@@ -38,3 +48,13 @@ export const saveCommits = db.transaction((commits) => {
}
return inserted;
});
const insertDevlog = db.prepare(`
INSERT OR IGNORE INTO devlogs (message_id, channel_id, content, author_name, posted_at)
VALUES (@message_id, @channel_id, @content, @author_name, @posted_at)
`);
/** Devlog speichern — bereits bekannte Message-IDs werden ignoriert. Gibt true zurück, wenn neu. */
export function saveDevlog(devlog) {
return insertDevlog.run(devlog).changes > 0;
}