#How to handle multiple AudioPlayers' error?
13 messages · Page 1 of 1 (latest)
I‘m confused, AudioPlayer‘s are class instances, how can they be stored as JSON?
if (!bot.queue[inter.guild.id]) {
bot.queue[inter.guild.id] = {
player: createAudioPlayer(),
source: createAudioResource(stream, { inlineVolume: true }),
queue: [],
volume: 1.0,
loop: loop,
channel: inter.member.voice.channel.id
}
So not JSON but JS objects, understood
Attach handlers to the error event of the player then
i know you could do ```js
bot.queue[guild.id].player.on('error', error => {
console.log(error.message);
});
but how would you get the id that the player is erroring on
Include that in the log where you add the handler there.
For example ```js
bot.queue[guild.id].player.on('error', error => {
console.log([${guild.id}] => ${error.message});
});
that's not what I meant i meant the id in the []
Me too
bot.queue[guild.id]