JaBa/commands/Music/np.js

49 lines
1.7 KiB
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Np extends Command {
constructor (client) {
super(client, {
name: "np",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: [ "nowplaying", "now-playing" ],
memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ],
nsfw: false,
ownerOnly: false,
cooldown: 3000
2021-12-10 21:39:54 +05:00
});
}
async run (message, args, data) {
const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel;
2021-12-11 01:11:50 +05:00
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
2021-12-10 21:39:54 +05:00
2021-12-11 01:11:50 +05:00
if (!queue) return message.error("music/play:NOT_PLAYING");
2021-12-10 21:39:54 +05:00
// Gets the current song
const track = await this.client.player.nowPlaying(message);
// Generate discord embed to display song informations
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("music/np:CURRENTLY_PLAYING"))
.setThumbnail(track.thumbnail)
.addField(message.translate("music/np:T_TITLE"), track.title, true)
.addField(message.translate("music/np:T_CHANNEL"), track.author, true)
.addField(message.translate("music/np:T_DURATION"), message.convertTime(Date.now()+track.durationMS, "to", true), true)
2021-12-24 20:52:27 +05:00
.addField(message.translate("music/np:T_DESCRIPTION"), track.description ? (track.description.substring(0, 150) + "\n" + (message.translate("common:AND_MORE").toLowerCase())) : message.translate("music/np:NO_DESCRIPTION"), true)
2021-12-10 21:39:54 +05:00
.addField("\u200B", this.client.player.createProgressBar(message, { timecodes: true }))
.setTimestamp()
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
2021-12-11 01:11:50 +05:00
2021-12-10 21:39:54 +05:00
// Send the embed in the current channel
message.channel.send(embed);
}
2021-12-11 01:11:50 +05:00
};
2021-12-10 21:39:54 +05:00
module.exports = Np;