feat: Music support #62
2 changed files with 40 additions and 1 deletions
35
src/commands/music/skip.ts
Normal file
35
src/commands/music/skip.ts
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
|
import { ChatInputCommandInteraction, Client } from "discord.js";
|
||||||
|
import { getLocale, getLocalizations } from "../../utils/locales";
|
||||||
|
import { getFilename } from "../../utils/misc";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
scope: () => [],
|
||||||
|
|
||||||
|
data: (client: Client) => {
|
||||||
|
const filename = getFilename(__filename);
|
||||||
|
const loc_default = client.locales.get(client.config.default_lang);
|
||||||
|
if (!loc_default) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SlashCommandBuilder()
|
||||||
|
.setName(filename.toLowerCase())
|
||||||
|
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||||
|
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||||
|
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
|
||||||
|
},
|
||||||
|
|
||||||
|
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
|
||||||
|
const loc = getLocale(client, interaction.locale);
|
||||||
|
const queue = client.player.queues.get(interaction.guildId ?? "");
|
||||||
|
|
||||||
|
if (queue) {
|
||||||
|
queue.skip();
|
||||||
|
|
||||||
|
return await interaction.reply(loc.get("c_skip1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return await interaction.reply(loc.get("c_skip2"));
|
||||||
|
},
|
||||||
|
};
|
|
@ -101,5 +101,9 @@
|
||||||
"c_queue_name": "queue",
|
"c_queue_name": "queue",
|
||||||
"c_queue_desc": "Affiche la file d'attente des musiques",
|
"c_queue_desc": "Affiche la file d'attente des musiques",
|
||||||
"c_queue1": "File d'attente",
|
"c_queue1": "File d'attente",
|
||||||
"c_queue2": "La liste est vide."
|
"c_queue2": "La liste est vide.",
|
||||||
|
"c_skip_name": "skip",
|
||||||
|
"c_skip_desc": "Passe la chanson en cours",
|
||||||
|
"c_skip1": "Passe la chanson...",
|
||||||
|
"c_skip2": "Le bot ne joue rien en ce moment."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue