feat: Better message in music category #74

Merged
Anri merged 11 commits from prettify-music into main 2023-02-17 23:06:19 +01:00
3 changed files with 26 additions and 20 deletions
Showing only changes of commit 18638e1087 - Show all commits

View file

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from "@discordjs/builders"; import { SlashCommandBuilder } from "@discordjs/builders";
import { ChatInputCommandInteraction, Client } from "discord.js"; import { ChatInputCommandInteraction, Client, EmbedBuilder } from "discord.js";
import { getLocale, getLocalizations } from "../../utils/locales"; import { getLocale, getLocalizations } from "../../utils/locales";
import { getFilename } from "../../utils/misc"; import { getFilename } from "../../utils/misc";
@ -25,20 +25,20 @@ export default {
const queue = client.player.queues.get(interaction.guildId ?? ""); const queue = client.player.queues.get(interaction.guildId ?? "");
if (queue) { if (queue) {
const embed = new EmbedBuilder();
if (queue.paused) { if (queue.paused) {
queue.resume(); queue.resume();
// TODO: Pretty embed embed.setDescription(loc.get("c_pause1"));
return await interaction.reply(loc.get("c_pause1")); return await interaction.reply({ embeds: [embed] });
} else { } else {
queue.pause(); queue.pause();
// TODO: Pretty embed embed.setDescription(loc.get("c_pause2"));
return await interaction.reply(loc.get("c_pause2")); return await interaction.reply({ embeds: [embed] });
} }
} }
// TODO: Pretty embed return await interaction.reply(`❌ | ${loc.get("c_pause3")}`);
return await interaction.reply(loc.get("c_pause3"));
}, },
}; };

View file

@ -2,6 +2,7 @@ import { SlashCommandBuilder } from "@discordjs/builders";
import { import {
ChatInputCommandInteraction, ChatInputCommandInteraction,
Client, Client,
EmbedBuilder,
GuildResolvable, GuildResolvable,
VoiceBasedChannel, VoiceBasedChannel,
} from "discord.js"; } from "discord.js";
@ -48,7 +49,7 @@ export default {
if (!member?.voice.channelId) { if (!member?.voice.channelId) {
return await interaction.reply({ return await interaction.reply({
content: loc.get("c_play1"), content: `❌ | ${loc.get("c_play1")}`,
ephemeral: true, ephemeral: true,
}); });
} }
@ -58,7 +59,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: loc.get("c_play2"), content: `❌ | ${loc.get("c_play2")} ${interaction.guild.members.me.voice.channel}`,
ephemeral: true, ephemeral: true,
}); });
} }
@ -75,16 +76,21 @@ export default {
if (queue) { if (queue) {
const track = queue.nowPlaying(); const track = queue.nowPlaying();
if (track) { if (track) {
// TODO: Pretty embed const embed = new EmbedBuilder()
// Use: createProgressBar .setDescription(
return await interaction.reply( `${queue.createProgressBar()}\n\n${loc.get("c_play8")} ${track.requestedBy}`
`${loc.get("c_play7")} \`${track.title}\` - *${track.author}*` )
); .setTitle(track.title)
.setURL(track.url)
.setThumbnail(track.thumbnail)
.setFooter({ text: loc.get("c_play7") })
.setTimestamp();
return await interaction.reply({ embeds: [embed] });
} }
} }
// TODO: Pretty embed const embed = new EmbedBuilder().setDescription(`❌ | ${loc.get("c_play6")}`);
return await interaction.reply(loc.get("c_play6")); return await interaction.reply({ embeds: [embed] });
} }
const queue = client.player.createQueue(interaction.guild as GuildResolvable, { const queue = client.player.createQueue(interaction.guild as GuildResolvable, {
@ -99,7 +105,7 @@ export default {
} catch { } catch {
queue.destroy(); queue.destroy();
return await interaction.reply({ return await interaction.reply({
content: loc.get("c_play3"), content: `❌ | ${loc.get("c_play3")}`,
ephemeral: true, ephemeral: true,
}); });
} }
@ -112,8 +118,8 @@ export default {
.then((x) => x); .then((x) => x);
if (!result.tracks[0]) { if (!result.tracks[0]) {
// TODO: Pretty embed const embed = new EmbedBuilder().setDescription(`❌ | \`${query}\` ${loc.get("c_play4")}.`);
return await interaction.followUp({ content: `❌ | \`${query}\` ${loc.get("c_play4")}.` }); return await interaction.followUp({ embeds: [embed] });
} }
let title; let title;
@ -132,7 +138,6 @@ export default {
queue.play(); queue.play();
} }
// TODO: Pretty embed
return await interaction.followUp({ return await interaction.followUp({
content: `⏱️ | \`${title}\` ${loc.get("c_play5")}.`, content: `⏱️ | \`${title}\` ${loc.get("c_play5")}.`,
}); });

View file

@ -88,6 +88,7 @@
"c_play5": "ajouté à la file d'attente", "c_play5": "ajouté à la file d'attente",
"c_play6": "Le bot ne joue rien en ce moment.", "c_play6": "Le bot ne joue rien en ce moment.",
"c_play7": "Joue actuellement", "c_play7": "Joue actuellement",
"c_play8": "Demandé par",
"c_stop_name": "stop", "c_stop_name": "stop",
"c_stop_desc": "Stop la musique", "c_stop_desc": "Stop la musique",