diff --git a/src/client/classes/Stations.js b/src/client/classes/Stations.js index 76493f5..fdd7668 100644 --- a/src/client/classes/Stations.js +++ b/src/client/classes/Stations.js @@ -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'); diff --git a/src/client/events/ready.js b/src/client/events/ready.js index 8ffcd6e..ccae145 100644 --- a/src/client/events/ready.js +++ b/src/client/events/ready.js @@ -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);