Add skip command

This commit is contained in:
Mylloon 2023-02-10 18:21:09 +01:00
parent 5414ff9f7b
commit fdf5f488ad
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 40 additions and 1 deletions

View 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"));
},
};

View file

@ -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."
} }