eximiabots-radiox/events/ready.js

35 lines
1.2 KiB
JavaScript
Raw Normal View History

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');
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 11:17:47 +00:00
client.developers = "";
2020-03-09 11:17:47 +00: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 20:46:42 +00:00
try {
client.stations = await fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json')
.then(res => res.json());
} catch (err) {
client.stations = null;
console.error(err);
}
2020-03-09 11:17:47 +00:00
2020-03-09 00:00:02 +00:00
setInterval(async () => {
client.stations = await fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json')
.then(res => res.json());
2020-03-09 11:17:47 +00:00
}, 3600000);
2020-03-02 19:38:42 +00:00
}
2020-03-08 14:22:00 +00:00
}