feat(music): add /music toggle and gate playback behind it
Music could be started and controlled with no way to turn it off for a server. Adds a music_settings table (mirrors the same one velox-dashboard-api's dashboard toggle reads/writes), a /music toggle command gated to Manage Server, and checks in /play, /queue, and /volume so they refuse to run when a server has music turned off.
This commit is contained in:
+39
@@ -133,3 +133,42 @@ CREATE TABLE IF NOT EXISTS user_settings (
|
||||
user_id BIGINT PRIMARY KEY,
|
||||
timezone TEXT NOT NULL
|
||||
);
|
||||
|
||||
--
|
||||
-- Music (dashboard queue view/control - see velox-dashboard-api's
|
||||
-- 000010_music migration, this file mirrors it)
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS music_settings (
|
||||
guild_id BIGINT PRIMARY KEY,
|
||||
is_enabled BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS music_now_playing (
|
||||
guild_id BIGINT PRIMARY KEY,
|
||||
track_title TEXT NOT NULL,
|
||||
track_url TEXT NOT NULL,
|
||||
duration_seconds INT NOT NULL,
|
||||
started_at TIMESTAMPTZ NOT NULL,
|
||||
paused BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
volume INT NOT NULL DEFAULT 100
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS music_queue (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
guild_id BIGINT NOT NULL,
|
||||
position INT NOT NULL,
|
||||
track_title TEXT NOT NULL,
|
||||
track_url TEXT NOT NULL,
|
||||
requested_by BIGINT NOT NULL,
|
||||
added_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS music_commands (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
guild_id BIGINT NOT NULL,
|
||||
command_type TEXT NOT NULL CHECK (command_type IN ('skip', 'pause', 'resume', 'set_volume', 'remove_track', 'reorder')),
|
||||
payload JSONB,
|
||||
requested_by BIGINT NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
processed_at TIMESTAMPTZ
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user