mirror of
				https://github.com/warengroup/eximiabots-radiox.git
				synced 2025-11-04 08:49:34 +00:00 
			
		
		
		
	Fix Stations class bug
This commit is contained in:
		@@ -15,17 +15,19 @@ module.exports = class Stations extends Array {
 | 
				
			|||||||
                .then(response => response.json());
 | 
					                .then(response => response.json());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(list){
 | 
					            if(list){
 | 
				
			||||||
                this.logger('Stations');
 | 
					                this.length = 0;
 | 
				
			||||||
                this.forEach(oldStation => {
 | 
					 | 
				
			||||||
                    if(list.findIndex(station => station.name == oldStation.name)) return;
 | 
					 | 
				
			||||||
                    delete this[this.findIndex(station => station.name == oldStation.name)];
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
                list.forEach(station => {
 | 
					                list.forEach(station => {
 | 
				
			||||||
                    console.log("- " + station.name);
 | 
					 | 
				
			||||||
                    this.push(station);
 | 
					                    this.push(station);
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if(options.show){
 | 
				
			||||||
 | 
					                    this.logger('Stations');
 | 
				
			||||||
 | 
					                    list.forEach(station => {
 | 
				
			||||||
 | 
					                        console.log("- " + station.name);
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
                    console.log("\n");
 | 
					                    console.log("\n");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.logger('Stations', 'Successfully fetched list');
 | 
					            this.logger('Stations', 'Successfully fetched list');
 | 
				
			||||||
        } catch (error) {
 | 
					        } catch (error) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,12 +42,14 @@ module.exports = {
 | 
				
			|||||||
        client.stations = new Stations();
 | 
					        client.stations = new Stations();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await client.stations.fetch({
 | 
					        await client.stations.fetch({
 | 
				
			||||||
            url: client.config.stationslistUrl
 | 
					            url: client.config.stationslistUrl,
 | 
				
			||||||
 | 
					            show: true
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        setInterval(async () => {
 | 
					        setInterval(async () => {
 | 
				
			||||||
            await client.stations.fetch({
 | 
					            await client.stations.fetch({
 | 
				
			||||||
                url: client.config.stationslistUrl
 | 
					                url: client.config.stationslistUrl,
 | 
				
			||||||
 | 
					                show: false
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }, 3600000);
 | 
					        }, 3600000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user