Merge pull request #72 from warengroup/develop

Version 0.3.10
This commit is contained in:
Christer Warén 2021-09-17 23:41:31 +03:00 committed by GitHub
commit 0945c7c26c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 23 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "eximiabots-radiox",
"version": "0.3.9",
"version": "0.3.10",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "eximiabots-radiox",
"version": "0.3.9",
"version": "0.3.10",
"license": "MIT",
"dependencies": {
"@discordjs/builders": "^0.6.0",

View File

@ -1,6 +1,6 @@
{
"name": "eximiabots-radiox",
"version": "0.3.9",
"version": "0.3.10",
"description": "Internet Radio to your Discord guild",
"main": "index.js",
"scripts": {

View File

@ -65,18 +65,8 @@ module.exports = class Radio extends Map {
construct.connection = connection;
let date = new Date();
construct.startTime = date.getTime();
client.funcs.play(client, null, guild, station);
client.datastore.checkEntry(guild.id);
construct.datastore = client.datastore.getEntry(guild.id);
if (!construct.datastore.statistics[construct.station.name]) {
construct.datastore.statistics[construct.station.name] = {};
construct.datastore.statistics[construct.station.name].time = 0;
construct.datastore.statistics[construct.station.name].used = 0;
client.datastore.updateEntry(guild, construct.datastore);
}
client.funcs.play(client, null, guild, station);
} catch (error) {
console.log(error);
}

View File

@ -15,16 +15,18 @@ module.exports = class Stations extends Array {
.then(response => response.json());
if(list){
this.logger('Stations');
this.forEach(oldStation => {
if(list.findIndex(station => station.name == oldStation.name)) return;
delete this[this.findIndex(station => station.name == oldStation.name)];
});
this.length = 0;
list.forEach(station => {
console.log("- " + station.name);
this.push(station);
});
console.log("\n");
if(options.show){
this.logger('Stations');
list.forEach(station => {
console.log("- " + station.name);
});
console.log("\n");
}
}
this.logger('Stations', 'Successfully fetched list');

View File

@ -42,12 +42,14 @@ module.exports = {
client.stations = new Stations();
await client.stations.fetch({
url: client.config.stationslistUrl
url: client.config.stationslistUrl,
show: true
});
setInterval(async () => {
await client.stations.fetch({
url: client.config.stationslistUrl
url: client.config.stationslistUrl,
show: false
});
}, 3600000);

View File

@ -4,6 +4,8 @@ module.exports = function loadState(client, guild){
let state;
state = data.state;
if(!state) return;
data.state = {};
client.datastore.updateEntry(guild, data);
return state;