From 1deaba23769e4896bfeb9a170d5ca662b9026800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Mon, 9 Mar 2020 02:00:02 +0200 Subject: [PATCH] Changes --- commands/nowplaying.js | 4 +--- events/ready.js | 10 ++++++++++ struct/client.js | 4 ---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/commands/nowplaying.js b/commands/nowplaying.js index 715e92b..0e1d6f7 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -12,12 +12,10 @@ module.exports = { radio.time = radio.connection.dispatcher.streamTime; const completed = (radio.time.toFixed(0)); - const stations = await client.funcs.radiostations(); - const embed = new Discord.MessageEmbed() .setTitle(" Now Playing") .setColor(client.config.embedColor) - .setDescription(`**${stations[radio.station].name}** \n Owner: ${stations[radio.station].owner} \n\`${client.funcs.msToTime(completed, "hh:mm:ss")}\``) + .setDescription(`**${client.stations[radio.station].name}** \n Owner: ${client.stations[radio.station].owner} \n\`${client.funcs.msToTime(completed, "hh:mm:ss")}\``) .setFooter('EximiaBots by Warén Media'); return msg.channel.send(embed); } diff --git a/events/ready.js b/events/ready.js index 707ca8b..98ed8db 100644 --- a/events/ready.js +++ b/events/ready.js @@ -1,8 +1,18 @@ module.exports = { name: 'ready', async execute(client, Discord) { + const fetch = require('node-fetch'); + 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'); + + client.stations = await fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json') + .then(res => res.json()); + + setInterval(async () => { + client.stations = await fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json') + .then(res => res.json()); + }, 3600); } } \ No newline at end of file diff --git a/struct/client.js b/struct/client.js index 98ab055..8a364e5 100644 --- a/struct/client.js +++ b/struct/client.js @@ -2,7 +2,6 @@ const { Client, Collection } = require('discord.js'); const Discord = require('discord.js'); const fs = require('fs'); const path = require('path'); -const fetch = require('node-fetch'); const events = '../events/'; module.exports = class extends Client { @@ -30,9 +29,6 @@ module.exports = class extends Client { this.commandAliases.set(command.alias, command); } - client.stations = fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json') - .then(res => res.json()); - this.on('ready', () => { require(`${events}ready`).execute(this, Discord); });