2022-07-29 23:31:08 +05:00
|
|
|
const Command = require("../../base/Command"),
|
|
|
|
Discord = require("discord.js");
|
|
|
|
|
2022-07-31 17:08:00 +05:00
|
|
|
class Nowplaying extends Command {
|
2022-07-29 23:31:08 +05:00
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
2022-07-31 17:08:00 +05:00
|
|
|
name: "nowplaying",
|
2022-07-29 23:31:08 +05:00
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
2022-07-31 17:08:00 +05:00
|
|
|
aliases: [],
|
2022-07-29 23:31:08 +05:00
|
|
|
memberPermissions: [],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 3000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run(message, args, data) {
|
|
|
|
const voice = message.member.voice.channel;
|
|
|
|
const queue = this.client.player.getQueue(message);
|
|
|
|
|
|
|
|
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
|
|
|
|
if (!queue) return message.error("music/play:NOT_PLAYING");
|
|
|
|
|
|
|
|
const track = queue.songs[0];
|
|
|
|
|
|
|
|
const status = queue =>
|
|
|
|
`${message.translate("music/np:FILTERS")}: \`${
|
|
|
|
queue.filters.join(", ") || message.translate("music/np:DISABLED")
|
|
|
|
}\` | ${message.translate("music/np:REPEAT")}: \`${
|
|
|
|
queue.repeatMode
|
|
|
|
? queue.repeatMode === 2 ? message.translate("music/np:QUEUE") : message.translate("music/np:SONG")
|
|
|
|
: message.translate("music/np:DISABLED")
|
|
|
|
}\` | ${message.translate("music/np:AUTOPLAY")}: \`${
|
|
|
|
queue.autoplay
|
|
|
|
? message.translate("music/np:ENABLED")
|
|
|
|
: message.translate("music/np:DISABLED")
|
|
|
|
}\``;
|
|
|
|
|
2022-07-31 17:08:00 +05:00
|
|
|
const embed = new Discord.EmbedBuilder()
|
2022-07-29 23:31:08 +05:00
|
|
|
.setAuthor({
|
|
|
|
name: message.translate("music/queue:TITLE")
|
|
|
|
})
|
|
|
|
.setThumbnail(track.thumbnail)
|
2022-07-31 17:08:00 +05:00
|
|
|
.addFields([
|
|
|
|
{
|
|
|
|
name: message.translate("music/np:T_TITLE"),
|
|
|
|
value: `[${track.name}](${track.url})`
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: message.translate("music/np:T_CHANNEL"),
|
|
|
|
value: track.uploader.name || message.translate("common:UNKNOWN")
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: message.translate("music/np:T_DURATION"),
|
|
|
|
value: `${queue.formattedCurrentTime} / ${track.duration > 1 ? track.formattedDuration : message.translate("music/play:LIVE")}`
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: message.translate("music/np:T_CONF"),
|
|
|
|
value: status(queue)
|
|
|
|
}
|
|
|
|
])
|
2022-07-29 23:31:08 +05:00
|
|
|
.setColor(data.config.embed.color)
|
|
|
|
.setFooter({
|
|
|
|
text: data.config.embed.footer
|
|
|
|
})
|
|
|
|
.setTimestamp();
|
|
|
|
|
|
|
|
message.reply({
|
|
|
|
embeds: [embed]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-31 17:08:00 +05:00
|
|
|
module.exports = Nowplaying;
|