mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 06:33:18 +00:00
Update Streamer class
This commit is contained in:
parent
ffa9c8abb0
commit
7d479b4c5f
@ -29,7 +29,7 @@ module.exports = class {
|
|||||||
let streamers = this.map.keys();
|
let streamers = this.map.keys();
|
||||||
streamers.forEach(streamer => {
|
streamers.forEach(streamer => {
|
||||||
if(client.stations.findIndex(station => station.name == streamer)) return;
|
if(client.stations.findIndex(station => station.name == streamer)) return;
|
||||||
this.map.delete(streamer);
|
this.stop(streamer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +56,12 @@ module.exports = class {
|
|||||||
return audioPlayer;
|
return audioPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop(station){
|
||||||
|
let audioPlayer = this.map.get(station.name);
|
||||||
|
audioPlayer?.stop();
|
||||||
|
this.map.delete(station.name);
|
||||||
|
}
|
||||||
|
|
||||||
listen(station) {
|
listen(station) {
|
||||||
let audioPlayer = this.map.get(station.name);
|
let audioPlayer = this.map.get(station.name);
|
||||||
if(!audioPlayer){
|
if(!audioPlayer){
|
||||||
@ -68,9 +74,7 @@ module.exports = class {
|
|||||||
if(!client.stations) return;
|
if(!client.stations) return;
|
||||||
|
|
||||||
client.stations.forEach(station => {
|
client.stations.forEach(station => {
|
||||||
let streamer = this.map.get(station.name);
|
this.stop(station);
|
||||||
streamer?.stop();
|
|
||||||
this.map.delete(station.name);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user