Add tracks from a direct link and from Discord with /play, /skip, /queue

- Download direct audio links server side (web page and /play), refusing
  internal and special addresses at connection time and after every
  redirect, with size and time limits.
- /play takes an attachment, a direct link or a library track
  (autocomplete), and can keep the file in the library; /skip and /queue
  control and show the shared queue.
- Share one ingest path between uploads, links and Discord attachments.
- Answer 413 instead of 500 when the library is full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-29 12:13:12 +01:00
parent 98f4d29ac7
commit 39d2b6acfb
14 changed files with 715 additions and 54 deletions

View file

@ -31,7 +31,7 @@ async function loadCommands() {
test("all Discord commands expose valid command data", async () => {
const modules = await loadCommands();
assert.equal(modules.length, 10);
assert.equal(modules.length, 13);
for (const module of modules) {
assert.doesNotThrow(() => module.command.data.toJSON());
assert.equal(typeof module.command.execute, "function");
@ -57,3 +57,13 @@ test("administrative commands require Discord permissions", async () => {
}
}
});
test("/queue lists the current track and what comes next", async () => {
const { buildQueueMessage } = await import("../src/commands/jukebox/queue.js");
const message = buildQueueMessage({
currentTrack: { title: "Thème *principal*", duration: 187 },
queue: [{ title: "Suite", duration: 3909 }],
});
assert.match(message, /En cours : \*\*Thème \\\*principal\\\* \(3:07\)\*\*/);
assert.match(message, /1\. Suite \(1:05:09\)/);
});