2020-03-02 19:38:42 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'nowplaying',
|
|
|
|
alias: 'np',
|
|
|
|
usage: '',
|
|
|
|
description: 'See the currently playing song position and length.',
|
|
|
|
permission: 'none',
|
|
|
|
category: 'music',
|
|
|
|
async execute(msg, args, client, Discord, prefix) {
|
|
|
|
const radio = client.radio.get(msg.guild.id);
|
2020-03-12 00:50:05 +00:00
|
|
|
if (!radio || !radio.playing) return msg.channel.send('There is nothing playing.');
|
2020-03-02 19:38:42 +00:00
|
|
|
radio.time = radio.connection.dispatcher.streamTime;
|
2020-03-08 15:03:39 +00:00
|
|
|
const completed = (radio.time.toFixed(0));
|
2020-03-08 23:26:24 +00:00
|
|
|
|
2020-03-02 19:38:42 +00:00
|
|
|
const embed = new Discord.MessageEmbed()
|
2020-03-09 11:29:19 +00:00
|
|
|
.setTitle("Now Playing")
|
2020-03-02 19:38:42 +00:00
|
|
|
.setColor(client.config.embedColor)
|
2020-03-12 09:59:05 +00:00
|
|
|
.setDescription(`**${radio.station.name}** \n Owner: ${radio.station.owner} \n\`${msToTime(completed, "hh:mm:ss")}\``)
|
2020-03-08 23:26:24 +00:00
|
|
|
.setFooter('EximiaBots by Warén Media');
|
2020-03-02 19:38:42 +00:00
|
|
|
return msg.channel.send(embed);
|
|
|
|
}
|
2020-03-12 09:59:05 +00:00
|
|
|
};
|
|
|
|
function msToTime(duration, format) {
|
|
|
|
var seconds = Math.floor((duration / 1000) % 60),
|
|
|
|
minutes = Math.floor((duration / (1000 * 60)) % 60),
|
|
|
|
hours = Math.floor((duration / (1000 * 60 * 60)) % 24);
|
|
|
|
days = Math.floor((duration / (1000 * 60 * 60 * 24)) % 24);
|
|
|
|
|
|
|
|
days = (days < 10) ? "0" + days : days;
|
|
|
|
hours = (hours < 10) ? "0" + hours : hours;
|
|
|
|
minutes = (minutes < 10) ? "0" + minutes : minutes;
|
|
|
|
seconds = (seconds < 10) ? "0" + seconds : seconds;
|
|
|
|
|
|
|
|
if (format === "hh:mm:ss") {
|
|
|
|
return `${hours}:${minutes}:${seconds}`;
|
|
|
|
} else if (format === "dd:hh:mm:ss") {
|
|
|
|
return `${days}:${hours}:${minutes}:${seconds}`;
|
|
|
|
}
|
|
|
|
}
|