2019-08-02 12:14:45 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'nowplaying',
|
|
|
|
description: 'Now playing command.',
|
|
|
|
cooldown: 5,
|
2019-10-10 13:43:04 +00:00
|
|
|
async execute(message, args, client, Discord, prefix) {
|
|
|
|
const ytdl = require('ytdl-core');
|
2019-08-02 12:14:45 +00:00
|
|
|
const serverQueue = client.queue.get(message.guild.id);
|
|
|
|
if (!serverQueue) return message.channel.send(':x: There is nothing playing.');
|
2019-08-14 12:26:33 +00:00
|
|
|
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
|
|
|
|
let songtime = (data.length_seconds * 1000).toFixed(0);
|
|
|
|
let completed = (serverQueue.connection.dispatcher.time).toFixed(0);
|
|
|
|
let barlength = 30;
|
|
|
|
let completedpercent = ((completed / songtime) * barlength).toFixed(0);
|
|
|
|
let array = []; for (let i = 0; i < completedpercent - 1; i++) { array.push('⎯'); } array.push('⭗'); for (let i = 0; i < barlength - completedpercent - 1; i++) { array.push('⎯'); }
|
2019-10-10 13:43:04 +00:00
|
|
|
const embed = new Discord.RichEmbed()
|
2019-08-14 12:26:33 +00:00
|
|
|
.setTitle("__Now playing__")
|
2019-10-10 13:43:04 +00:00
|
|
|
.setDescription(`🎶**Now playing:** ${serverQueue.songs[0].title}\n${array.join('')} | \`${client.funcs.msToTime(completed)} / ${client.funcs.msToTime(songtime)}\``)
|
2019-10-24 16:29:04 +00:00
|
|
|
.setFooter(`Queued by \`${serverQueue.songs[0].author.tag}\``)
|
2019-10-10 13:43:04 +00:00
|
|
|
.setURL(serverQueue.songs[0].url)
|
2019-08-14 12:26:33 +00:00
|
|
|
.setColor("#b50002")
|
|
|
|
return message.channel.send(embed);
|
2019-08-02 12:14:45 +00:00
|
|
|
}
|
|
|
|
};
|
2019-10-10 13:43:04 +00:00
|
|
|
|