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

View File

@ -15,7 +15,7 @@ module.exports = class extends Client {
this.radio = new Map();
this.funcs = {};
this.dispatcher = {};
this.config = require('./config/config.js');
this.config = require('../config.js');
fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {
this.funcs[filename.slice(0, -3)] = require(`./funcs/${filename}`);

View File

@ -1,22 +0,0 @@
require('dotenv/config');
module.exports = {
//credentials
token: process.env.TOKEN,
devToken: process.env.DEVTOKEN,
//support guild
supportGuild: "https://discord.gg/rRA65Mn",
//channels
debug_channel: "634718645188034560",
primary_test_channel: "617633098296721409",
secondary_test_channel: "570531724002328577",
devId: "360363051792203779",
//misc
embedColor: "",
invite: "https://discordapp.com/api/oauth2/authorize?client_id=684109535312609409&permissions=3427328&scope=bot",
//Settings
devMode: false,
prefix: "rx>",
devPrefix: "-",
volume: 5,
}

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!');