Added logger to play.js

This commit is contained in:
Christer Warén 2021-08-22 20:50:02 +03:00
parent 8168650f69
commit f18776ce1a

View File

@ -140,10 +140,10 @@ function play(interaction, guild, client, url) {
radio.audioPlayer.play(resource); radio.audioPlayer.play(resource);
resource.playStream resource.playStream
.on("readable", () => { .on("readable", () => {
console.log("[Radio] Stream started" + " / " + guild.id + " / " + radio.station.name); client.funcs.logger('Radio', 'Stream started' + " / " + guild.id + " / " + radio.station.name);
}) })
.on("finish", () => { .on("finish", () => {
console.log("[Radio] Stream finished" + " / " + guild.id); client.funcs.logger('Radio', 'Stream finished' + " / " + guild.id);
client.funcs.statisticsUpdate(client, guild, radio); client.funcs.statisticsUpdate(client, guild, radio);
radio.connection?.destroy(); radio.connection?.destroy();
radio.audioPlayer?.stop(); radio.audioPlayer?.stop();
@ -151,7 +151,7 @@ function play(interaction, guild, client, url) {
return; return;
}) })
.on("error", error => { .on("error", error => {
console.log("[Radio] Stream errored"); client.funcs.logger('Radio', 'Stream errored');
console.error(error); console.error(error);
radio.connection?.destroy(); radio.connection?.destroy();
radio.audioPlayer?.stop(); radio.audioPlayer?.stop();