The presence line was hard-coded, so advertising a different message meant editing the source and restarting the bot. Statuses now live in the database and are managed from Discord with /status — add, list, remove, pause and the rotation interval, which applies without a restart. An empty list falls back to a neutral "see the commands with /help" line, and the first status added shows up right away instead of waiting a full turn.
15 lines
602 B
SQL
15 lines
602 B
SQL
-- Rotating presence of the bot, editable from Discord (M15)
|
|
-- The presence is global to the bot, so these rows are not tied to a guild.
|
|
CREATE TABLE IF NOT EXISTS bot_statuses (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
text TEXT NOT NULL,
|
|
type TEXT NOT NULL DEFAULT 'watching',
|
|
url TEXT,
|
|
enabled INTEGER NOT NULL DEFAULT 1,
|
|
created_by TEXT,
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_bot_statuses_text ON bot_statuses (text);
|
|
CREATE INDEX IF NOT EXISTS idx_bot_statuses_enabled ON bot_statuses (enabled, id);
|