Some changes

This commit is contained in:
Christer Warén
2020-03-08 16:22:00 +02:00
parent af44f182f6
commit 60cf8df203
16 changed files with 65 additions and 46 deletions

17
struct/funcs/msToTime.js Normal file
View File

@ -0,0 +1,17 @@
module.exports = 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}`;
}
}

View File

@ -13,7 +13,6 @@ module.exports = async function (guild, client, url) {
});
dispatcher.on('error', error => {
console.error(error);
client.channels.fetch(client.config.debug_channel).send('Error with the dispatcher: ' + error);
radio.voiceChannel.leave();
client.radio.delete(guild.id);
return radio.textChannel.send('<:redx:674263474704220182> An error has occured while playing radio!');