Headers: - Every JavaScript file (sources, front, scripts, tests) starts with a /** @file … */ header, in the three levels used by sokko-g: a short description for simple files; Utilisé par / Attention / @see for shared modules; a full header (context, entry points, callers, dependencies, pitfalls) for index.js, the music queue, the web server, the storage manager and the jukebox page script. - No @author, @version or @since: git already knows. - test/fileHeaders.test.js fails `npm run check` when a header is missing or a central file's header is incomplete. Stylesheet (no visual change, checked by comparing every element's computed styles in Chromium at 1280, 800 and 400 px, hover included): - Role header and section comments. - Transparent shades derive from the colour variables with color-mix() instead of copied rgba() values; new tokens for repeated values (text, text on accent, accent gradient, white veils, shadow). - Native nesting for buttons, the live indicator, upload rows and home cards; drop the unused .hero__visual--large and redundant rules. - Utility classes move to the end so they win over components. The library list's u-mt-1, which never applied (.list reset it), is removed to keep the layout as it was. Docs: CONTRIBUTING.md describes the language, header and stylesheet conventions; CLAUDE.md points to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
/**
|
|
* @file Commande /queue : montre, à la seule personne qui la lance, le morceau en cours et les dix
|
|
* suivants.
|
|
*/
|
|
|
|
import { MessageFlags, SlashCommandBuilder, escapeMarkdown } from "discord.js";
|
|
import { trackLabel } from "../../features/formatTrack.js";
|
|
|
|
const SHOWN_TRACKS = 10;
|
|
|
|
function buildQueueMessage(queue) {
|
|
const lines = [];
|
|
lines.push(
|
|
queue.currentTrack
|
|
? `🎶 En cours : **${escapeMarkdown(trackLabel(queue.currentTrack))}**`
|
|
: "🎶 Rien en cours de lecture."
|
|
);
|
|
|
|
if (queue.queue.length === 0) {
|
|
lines.push("La file est vide. Ajoute un morceau avec `/play`.");
|
|
} else {
|
|
lines.push("", "__À suivre__ :");
|
|
queue.queue.slice(0, SHOWN_TRACKS).forEach((track, index) => {
|
|
lines.push(`${index + 1}. ${escapeMarkdown(trackLabel(track))}`);
|
|
});
|
|
const hidden = queue.queue.length - SHOWN_TRACKS;
|
|
if (hidden > 0) {
|
|
lines.push(`… et ${hidden} autre(s).`);
|
|
}
|
|
}
|
|
return lines.join("\n");
|
|
}
|
|
|
|
const command = {
|
|
data: new SlashCommandBuilder()
|
|
.setName("queue")
|
|
.setDescription("Affiche la file d'attente du jukebox"),
|
|
async execute(interaction) {
|
|
await interaction.reply({
|
|
content: buildQueueMessage(interaction.client.musicQueue),
|
|
flags: MessageFlags.Ephemeral,
|
|
});
|
|
},
|
|
};
|
|
|
|
export { buildQueueMessage, command };
|