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 40 additions and 1 deletions
Showing only changes of commit fdf5f488ad - Show all commits

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