Bug-Reports, Devlog-Threads und Watchdog
- /bug (alle Member): erstellt Gitea-Issue inkl. Screenshot-Upload als Asset; bug_reports-Tabelle für den Rückkanal — Issue geschlossen (issues-Webhook) → DM an den Reporter - Auto-Thread '💬 Devlog <Datum>' unter jedem Devlog-Post (Setting, Default an) - Watchdog: prüft Setting watchdog_urls alle 2 min, DM an Admin nach 2 Fails in Folge + Entwarnung mit Downtime-Dauer - Setup-Seite: Bug-Repo, Threads-Toggle, Watchdog-URLs; Env GITEA_API_TOKEN/GITEA_URL Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -79,6 +79,40 @@ db.exec(`
|
||||
}
|
||||
}
|
||||
|
||||
// Bug-Reports aus Discord (/bug) — für den Rückkanal (Issue geschlossen → DM)
|
||||
db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS bug_reports (
|
||||
repo TEXT NOT NULL,
|
||||
issue_number INTEGER NOT NULL,
|
||||
discord_user_id TEXT NOT NULL,
|
||||
title TEXT,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
PRIMARY KEY (repo, issue_number)
|
||||
);
|
||||
`);
|
||||
|
||||
const insertBugReport = db.prepare(`
|
||||
INSERT OR REPLACE INTO bug_reports (repo, issue_number, discord_user_id, title)
|
||||
VALUES (@repo, @issue_number, @discord_user_id, @title)
|
||||
`);
|
||||
const getBugReportStmt = db.prepare(
|
||||
'SELECT * FROM bug_reports WHERE repo = ? AND issue_number = ?'
|
||||
);
|
||||
const deleteBugReportStmt = db.prepare(
|
||||
'DELETE FROM bug_reports WHERE repo = ? AND issue_number = ?'
|
||||
);
|
||||
|
||||
export function saveBugReport(report) {
|
||||
insertBugReport.run(report);
|
||||
}
|
||||
|
||||
/** Report holen und direkt entfernen (einmalige Benachrichtigung) */
|
||||
export function takeBugReport(repo, issueNumber) {
|
||||
const row = getBugReportStmt.get(repo, issueNumber);
|
||||
if (row) deleteBugReportStmt.run(repo, issueNumber);
|
||||
return row ?? null;
|
||||
}
|
||||
|
||||
// Laufzeit-Einstellungen (Settings-Seite im Webinterface) — überschreiben Env-Defaults
|
||||
db.exec('CREATE TABLE IF NOT EXISTS settings (key TEXT PRIMARY KEY, value TEXT NOT NULL)');
|
||||
const getSettingStmt = db.prepare('SELECT value FROM settings WHERE key = ?');
|
||||
|
||||
Reference in New Issue
Block a user