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 12 additions and 6 deletions
Showing only changes of commit 6473d0769e - Show all commits

View file

@ -6,7 +6,7 @@ import {
VoiceBasedChannel, VoiceBasedChannel,
} from "discord.js"; } from "discord.js";
import { Metadata } from "../../modules/metadata"; import { Metadata } from "../../modules/metadata";
import { getLocalizations } from "../../utils/locales"; import { getLocale, getLocalizations } from "../../utils/locales";
import { getFilename } from "../../utils/misc"; import { getFilename } from "../../utils/misc";
export default { export default {
@ -38,6 +38,7 @@ export default {
}, },
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
const loc = getLocale(client, interaction.locale);
const loc_default = client.locales.get(client.config.default_lang); const loc_default = client.locales.get(client.config.default_lang);
const filename = getFilename(__filename); const filename = getFilename(__filename);
@ -47,7 +48,7 @@ export default {
if (!member?.voice.channelId) { if (!member?.voice.channelId) {
return await interaction.reply({ return await interaction.reply({
content: "Tu n'es dans aucun salon vocal.", content: loc.get("c_play1"),
ephemeral: true, ephemeral: true,
}); });
} }
@ -57,7 +58,7 @@ export default {
member.voice.channelId !== interaction.guild.members.me.voice.channelId member.voice.channelId !== interaction.guild.members.me.voice.channelId
) { ) {
return await interaction.reply({ return await interaction.reply({
content: "Je suis déjà en vocal.", content: loc.get("c_play2"),
ephemeral: true, ephemeral: true,
}); });
} }
@ -77,7 +78,7 @@ export default {
} catch { } catch {
queue.destroy(); queue.destroy();
return await interaction.reply({ return await interaction.reply({
content: "Impossible de rejoindre le salon vocal.", content: loc.get("c_play3"),
ephemeral: true, ephemeral: true,
}); });
} }
@ -90,13 +91,13 @@ export default {
.then((x) => x.tracks[0]); .then((x) => x.tracks[0]);
if (!track) { if (!track) {
return await interaction.followUp({ content: `❌ | \`${query}\` introuvable.` }); return await interaction.followUp({ content: `❌ | \`${query}\` ${loc.get("c_play4")}.` });
} }
queue.play(track); queue.play(track);
return await interaction.followUp({ return await interaction.followUp({
content: `⏱️ | \`${track.title}\` ajouté à la file d'attente`, content: `⏱️ | \`${track.title}\` ${loc.get("c_play5")}.`,
}); });
}, },
}; };

View file

@ -82,6 +82,11 @@
"c_play_desc": "Joue une chanson/playlist", "c_play_desc": "Joue une chanson/playlist",
"c_play_opt1_name": "requête", "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_play1": "Tu n'es dans aucun salon vocal.",
"c_play2": "Je suis déjà en vocal.",
"c_play3": "Impossible de rejoindre le salon vocal.",
"c_play4": "introuvable",
"c_play5": "ajouté à la file d'attente",
"c_stop_name": "stop", "c_stop_name": "stop",
"c_stop_desc": "Stop la musique", "c_stop_desc": "Stop la musique",
"c_stop1": "Le bot ne joue pas de musique.", "c_stop1": "Le bot ne joue pas de musique.",