* 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 { 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"));
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -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")}.`,
|
||||||
});
|
});
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in a new issue