2020-03-09 00:03:19 +00:00
|
|
|
const fetch = require('node-fetch');
|
|
|
|
|
2020-03-02 19:38:42 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'ready',
|
|
|
|
async execute(client, Discord) {
|
2020-03-09 11:17:47 +00:00
|
|
|
|
2020-03-08 14:22:00 +00:00
|
|
|
console.log('RadioX');
|
2021-01-07 03:29:42 +00:00
|
|
|
console.log('Internet Radio to your Discord guild');
|
|
|
|
console.log('(c)2020-2021 EximiaBots by Warén Group');
|
2020-03-09 11:17:47 +00:00
|
|
|
|
2020-03-11 23:19:11 +00:00
|
|
|
client.developers = "";
|
2020-03-09 11:17:47 +00:00
|
|
|
let user = "";
|
2021-06-08 09:01:56 +00:00
|
|
|
for (let i = 0; i < client.config.devId.length; i++) {
|
2020-03-09 11:17:47 +00:00
|
|
|
user = await client.users.fetch(client.config.devId[i]);
|
|
|
|
if (i == client.config.devId.length - 1) {
|
|
|
|
client.developers += user.tag;
|
|
|
|
} else {
|
|
|
|
client.developers += user.tag + " & ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-11 20:46:42 +00:00
|
|
|
try {
|
2020-08-15 00:16:58 +00:00
|
|
|
client.stations = await fetch(client.config.stationslistUrl)
|
2020-04-04 23:29:39 +00:00
|
|
|
.then(client.funcs.checkFetchStatus)
|
|
|
|
.then(response => response.json());
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error);
|
2020-03-11 20:46:42 +00:00
|
|
|
}
|
2020-04-04 23:29:39 +00:00
|
|
|
|
2020-03-09 00:00:02 +00:00
|
|
|
setInterval(async () => {
|
2020-04-04 23:29:39 +00:00
|
|
|
try {
|
2020-08-15 00:16:58 +00:00
|
|
|
client.stations = await fetch(client.config.stationslistUrl)
|
2020-04-04 23:29:39 +00:00
|
|
|
.then(client.funcs.checkFetchStatus)
|
|
|
|
.then(response => response.json());
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error);
|
|
|
|
}
|
2020-03-09 11:17:47 +00:00
|
|
|
}, 3600000);
|
2020-03-22 15:10:46 +00:00
|
|
|
|
2020-04-04 03:53:17 +00:00
|
|
|
if(!client.stations) {
|
|
|
|
client.user.setStatus('dnd');
|
|
|
|
}
|
|
|
|
|
|
|
|
client.datastore.calculateGlobal(client);
|
2020-04-02 07:07:27 +00:00
|
|
|
require(`../emojis.js`).execute(client);
|
2020-04-04 03:53:17 +00:00
|
|
|
|
2021-08-21 14:55:52 +00:00
|
|
|
require(`../commands.js`).execute(client);
|
2021-08-18 22:52:55 +00:00
|
|
|
|
2020-03-02 19:38:42 +00:00
|
|
|
}
|
2020-03-08 14:22:00 +00:00
|
|
|
}
|