eximiabots-radiox/src/client/events/ready.js

50 lines
1.5 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');
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
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 {
client.stations = await fetch(client.config.stationslistUrl)
.then(client.funcs.checkFetchStatus)
.then(response => response.json());
} catch (error) {
console.error(error);
2020-03-11 20:46:42 +00:00
}
2020-03-09 00:00:02 +00:00
setInterval(async () => {
try {
client.stations = await fetch(client.config.stationslistUrl)
.then(client.funcs.checkFetchStatus)
.then(response => response.json());
} catch (error) {
console.error(error);
}
2020-03-09 11:17:47 +00:00
}, 3600000);
if(!client.stations) {
client.user.setStatus('dnd');
}
client.datastore.calculateGlobal(client);
2020-04-02 07:07:27 +00:00
require(`../emojis.js`).execute(client);
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
}