2020-03-09 02:03:19 +02:00
|
|
|
const fetch = require('node-fetch');
|
|
|
|
|
2020-03-02 21:38:42 +02:00
|
|
|
module.exports = {
|
|
|
|
name: 'ready',
|
|
|
|
async execute(client, Discord) {
|
2020-03-09 13:17:47 +02:00
|
|
|
|
2020-03-08 16:22:00 +02:00
|
|
|
console.log('RadioX');
|
|
|
|
console.log('We will bring you finnish radio to your discord server');
|
|
|
|
console.log('(c)2020 EximiaBots by Warén Media / Christer Warén & MatteZ02');
|
2020-03-09 13:17:47 +02:00
|
|
|
|
2020-03-12 01:19:11 +02:00
|
|
|
client.developers = "";
|
2020-03-09 13:17:47 +02:00
|
|
|
let user = "";
|
|
|
|
for (i = 0; i < client.config.devId.length; i++) {
|
|
|
|
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 22:46:42 +02:00
|
|
|
try {
|
|
|
|
client.stations = await fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json')
|
2020-04-05 02:29:39 +03:00
|
|
|
.then(client.funcs.checkFetchStatus)
|
|
|
|
.then(response => response.json());
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error);
|
2020-03-11 22:46:42 +02:00
|
|
|
}
|
2020-04-05 02:29:39 +03:00
|
|
|
|
2020-03-09 02:00:02 +02:00
|
|
|
setInterval(async () => {
|
2020-04-05 02:29:39 +03:00
|
|
|
try {
|
|
|
|
client.stations = await fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json')
|
|
|
|
.then(client.funcs.checkFetchStatus)
|
|
|
|
.then(response => response.json());
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error);
|
|
|
|
}
|
2020-03-09 13:17:47 +02:00
|
|
|
}, 3600000);
|
2020-03-22 17:10:46 +02:00
|
|
|
|
2020-04-04 06:53:17 +03:00
|
|
|
if(!client.stations) {
|
|
|
|
client.user.setStatus('dnd');
|
|
|
|
}
|
|
|
|
|
|
|
|
client.datastore.calculateGlobal(client);
|
2020-04-02 10:07:27 +03:00
|
|
|
require(`../emojis.js`).execute(client);
|
2020-04-04 06:53:17 +03:00
|
|
|
|
2020-03-02 21:38:42 +02:00
|
|
|
}
|
2020-03-08 16:22:00 +02:00
|
|
|
}
|