This commit is contained in:
Christer Warén 2020-03-09 02:00:02 +02:00
parent 148ce79316
commit 1deaba2376
3 changed files with 11 additions and 7 deletions

View File

@ -12,12 +12,10 @@ module.exports = {
radio.time = radio.connection.dispatcher.streamTime; radio.time = radio.connection.dispatcher.streamTime;
const completed = (radio.time.toFixed(0)); const completed = (radio.time.toFixed(0));
const stations = await client.funcs.radiostations();
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle("<a:aNotes:674602408105476106> Now Playing") .setTitle("<a:aNotes:674602408105476106> Now Playing")
.setColor(client.config.embedColor) .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'); .setFooter('EximiaBots by Warén Media');
return msg.channel.send(embed); return msg.channel.send(embed);
} }

View File

@ -1,8 +1,18 @@
module.exports = { module.exports = {
name: 'ready', name: 'ready',
async execute(client, Discord) { async execute(client, Discord) {
const fetch = require('node-fetch');
console.log('RadioX'); console.log('RadioX');
console.log('We will bring you finnish radio to your discord server'); 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'); 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);
} }
} }

View File

@ -2,7 +2,6 @@ const { Client, Collection } = require('discord.js');
const Discord = require('discord.js'); const Discord = require('discord.js');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const fetch = require('node-fetch');
const events = '../events/'; const events = '../events/';
module.exports = class extends Client { module.exports = class extends Client {
@ -30,9 +29,6 @@ module.exports = class extends Client {
this.commandAliases.set(command.alias, command); 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', () => { this.on('ready', () => {
require(`${events}ready`).execute(this, Discord); require(`${events}ready`).execute(this, Discord);
}); });