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

View file

@ -0,0 +1,41 @@
import { SlashCommandBuilder } from "@discordjs/builders";
import { ChatInputCommandInteraction, Client, GuildResolvable } from "discord.js";
import { Metadata } from "../../modules/metadata";
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.createQueue(interaction.guild as GuildResolvable, {
metadata: {
channel: interaction.channel,
} as Metadata,
});
if (!(queue.connection || queue.playing)) {
return interaction.reply(loc.get("c_stop1"));
}
queue.destroy();
interaction.reply(loc.get("c_stop2"));
},
};

View file

@ -81,5 +81,9 @@
"c_play_name": "play",
"c_play_desc": "Joue une chanson/playlist",
"c_play_opt1_name": "requête",
"c_play_opt1_desc": "Ce que vous voulez écouter"
"c_play_opt1_desc": "Ce que vous voulez écouter",
"c_stop_name": "stop",
"c_stop_desc": "Stop la musique",
"c_stop1": "Le bot ne joue pas de musique.",
"c_stop2": "La musique à été arrêtée."
}