Audio Cog - v2.3.0 (#4446)

* First commit - Bring everything from dev cog minus NSFW support

* Add a toggle for auto deafen

* Add a one off Send to Owners

* aaaaaaa

* Update this to ensure `get_perms` is not called if the API is disabled

* Apply suggestions from code review

Co-authored-by: Vuks <51289041+Vuks69@users.noreply.github.com>

* silence any errors here (in case API is down so it doesnt affect audio)

* update the message to tell the mto join the Official Red server.

* remove useless sutff, and change dj check order to ensure bot doesnt join VC for non DJ's

* ffs

* Update redbot/cogs/audio/core/tasks/startup.py

Co-authored-by: Twentysix <Twentysix26@users.noreply.github.com>

* Aikas Review

* Add #3995 in here

* update

* *sigh*

* lock behind owner

* to help with debugging

* Revert "to help with debugging"

This reverts commit 8cbf17be

* resolve last review

Co-authored-by: Vuks <51289041+Vuks69@users.noreply.github.com>
Co-authored-by: Twentysix <Twentysix26@users.noreply.github.com>
This commit is contained in:
Draper
2020-10-12 19:39:39 +01:00
committed by GitHub
parent 29ebf0f060
commit 2da9b502d8
41 changed files with 1553 additions and 331 deletions

View File

@@ -54,6 +54,15 @@ __all__ = [
"LAVALINK_QUERY_LAST_FETCHED_RANDOM",
"LAVALINK_DELETE_OLD_ENTRIES",
"LAVALINK_FETCH_ALL_ENTRIES_GLOBAL",
# Persisting Queue statements
"PERSIST_QUEUE_DROP_TABLE",
"PERSIST_QUEUE_CREATE_TABLE",
"PERSIST_QUEUE_CREATE_INDEX",
"PERSIST_QUEUE_PLAYED",
"PERSIST_QUEUE_DELETE_SCHEDULED",
"PERSIST_QUEUE_FETCH_ALL",
"PERSIST_QUEUE_UPSERT",
"PERSIST_QUEUE_BULK_PLAYED",
]
# PRAGMA Statements
@@ -555,3 +564,83 @@ LAVALINK_FETCH_ALL_ENTRIES_GLOBAL: Final[
SELECT query, data
FROM lavalink
"""
# Persisting Queue statements
PERSIST_QUEUE_DROP_TABLE: Final[
str
] = """
DROP TABLE IF EXISTS persist_queue ;
"""
PERSIST_QUEUE_CREATE_TABLE: Final[
str
] = """
CREATE TABLE IF NOT EXISTS persist_queue(
guild_id INTEGER NOT NULL,
room_id INTEGER NOT NULL,
track JSON NOT NULL,
played BOOLEAN DEFAULT false,
track_id TEXT NOT NULL,
time INTEGER NOT NULL,
PRIMARY KEY (guild_id, room_id, track_id)
);
"""
PERSIST_QUEUE_CREATE_INDEX: Final[
str
] = """
CREATE INDEX IF NOT EXISTS track_index ON persist_queue (guild_id, track_id);
"""
PERSIST_QUEUE_PLAYED: Final[
str
] = """
UPDATE persist_queue
SET
played = true
WHERE
(
guild_id = :guild_id
AND track_id = :track_id
)
;
"""
PERSIST_QUEUE_BULK_PLAYED: Final[
str
] = """
UPDATE persist_queue
SET
played = true
WHERE guild_id = :guild_id
;
"""
PERSIST_QUEUE_DELETE_SCHEDULED: Final[
str
] = """
DELETE
FROM
persist_queue
WHERE
played = true;
"""
PERSIST_QUEUE_FETCH_ALL: Final[
str
] = """
SELECT
guild_id, room_id, track
FROM
persist_queue
WHERE played = false
ORDER BY time ASC;
"""
PERSIST_QUEUE_UPSERT: Final[
str
] = """
INSERT INTO
persist_queue (guild_id, room_id, track, played, track_id, time)
VALUES
(
:guild_id, :room_id, :track, :played, :track_id, :time
)
ON CONFLICT (guild_id, room_id, track_id) DO
UPDATE
SET
time = excluded.time
"""