feat: Music support #62

Merged
Anri merged 43 commits from feat/music into main 2023-02-12 01:11:10 +01:00
2 changed files with 34 additions and 3 deletions
Showing only changes of commit 336d18d810 - Show all commits

View file

@ -71,6 +71,7 @@ export default {
.setDescriptionLocalizations( .setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_sub3_opt1_desc`) getLocalizations(client, `c_${filename}_sub3_opt1_desc`)
) )
.setRequired(true)
) )
) )
); );
@ -83,13 +84,15 @@ export default {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const queue = client.player.queues.get(interaction.guildId ?? ""); const queue = client.player.queues.get(interaction.guildId ?? "");
const embed = new EmbedBuilder().setAuthor({ name: loc.get("c_queue1") }); const embed = new EmbedBuilder();
if (queue) { if (queue) {
const subcommand = interaction.options.getSubcommand(); const subcommand = interaction.options.getSubcommand();
switch (subcommand) { switch (subcommand) {
// Show the queue // Show the queue
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": {
embed.setAuthor({ name: loc.get("c_queue1") });
const tracks = queue.tracks; const tracks = queue.tracks;
// TODO: Add pages for +25 tracks on a queue // TODO: Add pages for +25 tracks on a queue
// Limit of discord is 25 // Limit of discord is 25
@ -103,8 +106,32 @@ export default {
break; break;
} }
default: // Shuffle Queue
return await interaction.reply("Not yet implemented."); case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": {
queue.shuffle();
embed.setDescription(loc.get("c_queue3"));
break;
}
// Remove <ID>
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": {
const id = interaction.options.getNumber(
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string
) as number;
const track = queue.remove(id - 1);
if (track) {
embed.setDescription(
`${loc.get("c_queue4")} #${id} \`${track.title}\` ${loc.get("c_queue5")}`
);
} else {
embed.setDescription(loc.get("c_queue6"));
}
break;
}
} }
} else { } else {
embed.setDescription(loc.get("c_queue2")); embed.setDescription(loc.get("c_queue2"));

View file

@ -112,6 +112,10 @@
"c_queue_sub3_opt1_desc": "ID de la chanson a retirer", "c_queue_sub3_opt1_desc": "ID de la chanson a retirer",
"c_queue1": "File d'attente", "c_queue1": "File d'attente",
"c_queue2": "La liste est vide.", "c_queue2": "La liste est vide.",
"c_queue3": "Liste d'attente mélangée",
"c_queue4": "Musique",
"c_queue5": "supprimée",
"c_queue6": "Cette ID n'existe pas.",
"c_skip_name": "skip", "c_skip_name": "skip",
"c_skip_desc": "Passe la chanson en cours", "c_skip_desc": "Passe la chanson en cours",
"c_skip_opt1_name": "id", "c_skip_opt1_name": "id",