2022-08-03 20:57:54 +05:00
|
|
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"),
|
|
|
|
{ QueueRepeatMode } = require("discord-player");
|
2022-08-02 17:18:47 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Nowplaying extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("nowplaying")
|
|
|
|
.setDescription(client.translate("music/nowplaying:DESCRIPTION")),
|
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
|
|
|
guildOnly: true,
|
|
|
|
ownerOnly: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
2022-08-09 23:48:33 +05:00
|
|
|
* @param {Object} data
|
2022-08-02 17:18:47 +05:00
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
2022-08-03 20:57:54 +05:00
|
|
|
await interaction.deferReply();
|
|
|
|
const queue = client.player.getQueue(interaction.guildId);
|
2022-08-02 17:18:47 +05:00
|
|
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
2022-08-03 20:57:54 +05:00
|
|
|
const progressBar = queue.createProgressBar();
|
|
|
|
const track = queue.current;
|
2022-08-02 17:18:47 +05:00
|
|
|
|
|
|
|
const embed = new EmbedBuilder()
|
|
|
|
.setAuthor({
|
2022-09-01 15:09:55 +05:00
|
|
|
name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING")
|
2022-08-02 17:18:47 +05:00
|
|
|
})
|
2022-08-28 16:45:05 +05:00
|
|
|
.setThumbnail(track.thumbnail)
|
2022-08-02 17:18:47 +05:00
|
|
|
.addFields([
|
|
|
|
{
|
|
|
|
name: interaction.translate("music/nowplaying:T_TITLE"),
|
2022-08-03 20:57:54 +05:00
|
|
|
value: `[${track.title}](${track.url})`
|
2022-08-02 17:18:47 +05:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 20:57:54 +05:00
|
|
|
name: interaction.translate("music/nowplaying:T_AUTHOR"),
|
|
|
|
value: track.author || interaction.translate("common:UNKNOWN")
|
2022-08-02 17:18:47 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: interaction.translate("music/nowplaying:T_DURATION"),
|
2022-08-03 20:57:54 +05:00
|
|
|
value: progressBar
|
2022-08-02 17:18:47 +05:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 20:57:54 +05:00
|
|
|
name: "\u200b",
|
|
|
|
value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${
|
2022-08-08 18:19:56 +05:00
|
|
|
queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") :
|
|
|
|
queue.repeatMode === QueueRepeatMode.QUEUE ? interaction.translate("music/nowplaying:QUEUE") :
|
|
|
|
queue.repeatMode === QueueRepeatMode.TRACK ? interaction.translate("music/nowplaying:TRACK") : interaction.translate("common:DISABLED")
|
2022-08-03 20:57:54 +05:00
|
|
|
}\``
|
2022-08-02 17:18:47 +05:00
|
|
|
}
|
|
|
|
])
|
|
|
|
.setColor(client.config.embed.color)
|
|
|
|
.setFooter({
|
|
|
|
text: client.config.embed.footer
|
|
|
|
})
|
|
|
|
.setTimestamp();
|
|
|
|
|
2022-08-03 20:57:54 +05:00
|
|
|
interaction.editReply({
|
2022-08-02 17:18:47 +05:00
|
|
|
embeds: [embed]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Nowplaying;
|