mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 10:33:18 +00:00
Update Streamer class
This commit is contained in:
parent
a043cde46e
commit
095b6ad775
@ -2,14 +2,12 @@ const {
|
|||||||
createAudioPlayer,
|
createAudioPlayer,
|
||||||
createAudioResource
|
createAudioResource
|
||||||
} = require("@discordjs/voice");
|
} = require("@discordjs/voice");
|
||||||
const {
|
|
||||||
logger
|
|
||||||
} = require("../funcs/logger.js");
|
|
||||||
|
|
||||||
module.exports = class {
|
module.exports = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.map = new Map();
|
this.map = new Map();
|
||||||
this.stations = null;
|
this.stations = null;
|
||||||
|
this.logger = require("../funcs/logger.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
init(client){
|
init(client){
|
||||||
@ -27,15 +25,15 @@ module.exports = class {
|
|||||||
audioPlayer.play(resource);
|
audioPlayer.play(resource);
|
||||||
resource.playStream
|
resource.playStream
|
||||||
.on("readable", () => {
|
.on("readable", () => {
|
||||||
logger('Streamer', station.name + " / " + "Readable");
|
this.logger('Streamer', station.name + " / " + "Readable");
|
||||||
this.map.set(station.name, audioPlayer);
|
this.map.set(station.name, audioPlayer);
|
||||||
})
|
})
|
||||||
.on("finish", () => {
|
.on("finish", () => {
|
||||||
logger('Streamer', station.name + " / " + "Finished");
|
this.logger('Streamer', station.name + " / " + "Finished");
|
||||||
this.map.delete(station.name);
|
this.map.delete(station.name);
|
||||||
})
|
})
|
||||||
.on("error", error => {
|
.on("error", error => {
|
||||||
logger('Streamer', station.name + " / " + "Error");
|
this.logger('Streamer', station.name + " / " + "Error");
|
||||||
this.map.delete(station.name);
|
this.map.delete(station.name);
|
||||||
});
|
});
|
||||||
return audioPlayer;
|
return audioPlayer;
|
||||||
|
Loading…
Reference in New Issue
Block a user