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 36 additions and 10 deletions
Showing only changes of commit 3a871a3350 - Show all commits

View file

@ -13,21 +13,44 @@ export default {
return; return;
} }
return new SlashCommandBuilder() return (
.setName(filename.toLowerCase()) new SlashCommandBuilder()
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "") .setName(filename.toLowerCase())
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)); .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
// Command option
.addNumberOption((option) =>
option
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
)
);
}, },
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
const loc_default = client.locales.get(client.config.default_lang);
const filename = getFilename(__filename);
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 ?? "");
if (queue) { const id = interaction.options.getNumber(loc_default?.get(`c_${filename}_opt1_name`) as string);
queue.skip();
return await interaction.reply(loc.get("c_skip1")); if (queue) {
let msg;
if (id) {
queue.skipTo(id - 1);
msg = loc.get("c_skip3") + " #" + id + "...";
} else {
queue.skip();
msg = loc.get("c_skip1") + "...";
}
return await interaction.reply(msg);
} }
return await interaction.reply(loc.get("c_skip2")); return await interaction.reply(loc.get("c_skip2"));

View file

@ -104,6 +104,9 @@
"c_queue2": "La liste est vide.", "c_queue2": "La liste est vide.",
"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_skip1": "Passe la chanson...", "c_skip_opt1_name": "id",
"c_skip2": "Le bot ne joue rien en ce moment." "c_skip_opt1_desc": "ID de la chanson que vous voulez écouter",
"c_skip1": "Passe la chanson",
"c_skip2": "Le bot ne joue rien en ce moment.",
"c_skip3": "Passe à la chanson"
} }