* add embed in commands
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
* add progress bar in nowplaying command
This commit is contained in:
parent
84df0d2395
commit
18638e1087
3 changed files with 26 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
|||
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 { getFilename } from "../../utils/misc";
|
||||
|
||||
|
@ -25,20 +25,20 @@ export default {
|
|||
const queue = client.player.queues.get(interaction.guildId ?? "");
|
||||
|
||||
if (queue) {
|
||||
const embed = new EmbedBuilder();
|
||||
if (queue.paused) {
|
||||
queue.resume();
|
||||
|
||||
// TODO: Pretty embed
|
||||
return await interaction.reply(loc.get("c_pause1"));
|
||||
embed.setDescription(loc.get("c_pause1"));
|
||||
return await interaction.reply({ embeds: [embed] });
|
||||
} else {
|
||||
queue.pause();
|
||||
|
||||
// TODO: Pretty embed
|
||||
return await interaction.reply(loc.get("c_pause2"));
|
||||
embed.setDescription(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")}`);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@ import { SlashCommandBuilder } from "@discordjs/builders";
|
|||
import {
|
||||
ChatInputCommandInteraction,
|
||||
Client,
|
||||
EmbedBuilder,
|
||||
GuildResolvable,
|
||||
VoiceBasedChannel,
|
||||
} from "discord.js";
|
||||
|
@ -48,7 +49,7 @@ export default {
|
|||
|
||||
if (!member?.voice.channelId) {
|
||||
return await interaction.reply({
|
||||
content: loc.get("c_play1"),
|
||||
content: `❌ | ${loc.get("c_play1")}`,
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
@ -58,7 +59,7 @@ export default {
|
|||
member.voice.channelId !== interaction.guild.members.me.voice.channelId
|
||||
) {
|
||||
return await interaction.reply({
|
||||
content: loc.get("c_play2"),
|
||||
content: `❌ | ${loc.get("c_play2")} ${interaction.guild.members.me.voice.channel}`,
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
@ -75,16 +76,21 @@ export default {
|
|||
if (queue) {
|
||||
const track = queue.nowPlaying();
|
||||
if (track) {
|
||||
// TODO: Pretty embed
|
||||
// Use: createProgressBar
|
||||
return await interaction.reply(
|
||||
`${loc.get("c_play7")} \`${track.title}\` - *${track.author}*`
|
||||
);
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(
|
||||
`${queue.createProgressBar()}\n\n${loc.get("c_play8")} ${track.requestedBy}`
|
||||
)
|
||||
.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
|
||||
return await interaction.reply(loc.get("c_play6"));
|
||||
const embed = new EmbedBuilder().setDescription(`❌ | ${loc.get("c_play6")}`);
|
||||
return await interaction.reply({ embeds: [embed] });
|
||||
}
|
||||
|
||||
const queue = client.player.createQueue(interaction.guild as GuildResolvable, {
|
||||
|
@ -99,7 +105,7 @@ export default {
|
|||
} catch {
|
||||
queue.destroy();
|
||||
return await interaction.reply({
|
||||
content: loc.get("c_play3"),
|
||||
content: `❌ | ${loc.get("c_play3")}`,
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
@ -112,8 +118,8 @@ export default {
|
|||
.then((x) => x);
|
||||
|
||||
if (!result.tracks[0]) {
|
||||
// TODO: Pretty embed
|
||||
return await interaction.followUp({ content: `❌ | \`${query}\` ${loc.get("c_play4")}.` });
|
||||
const embed = new EmbedBuilder().setDescription(`❌ | \`${query}\` ${loc.get("c_play4")}.`);
|
||||
return await interaction.followUp({ embeds: [embed] });
|
||||
}
|
||||
|
||||
let title;
|
||||
|
@ -132,7 +138,6 @@ export default {
|
|||
queue.play();
|
||||
}
|
||||
|
||||
// TODO: Pretty embed
|
||||
return await interaction.followUp({
|
||||
content: `⏱️ | \`${title}\` ${loc.get("c_play5")}.`,
|
||||
});
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
"c_play5": "ajouté à la file d'attente",
|
||||
"c_play6": "Le bot ne joue rien en ce moment.",
|
||||
"c_play7": "Joue actuellement",
|
||||
"c_play8": "Demandé par",
|
||||
|
||||
"c_stop_name": "stop",
|
||||
"c_stop_desc": "Stop la musique",
|
||||
|
|
Loading…
Reference in a new issue