Open astariul opened 3 years ago
Note : it happens only when the use leave the channel first.
When the user stay in the channel and send the command, it work properly.
To reproduce :
-> Cmd "enter" -> Connect to discord voice channel -> Say something -> Disconnect from voice channel -> Cmd "exit"
Ok I changed :
const { channel: voiceChannel, connection: conn } = msg.guild.voiceStates.cache.last();
into
var { channel: voiceChannel, connection: conn } = msg.guild.voiceStates.cache.last();
if (voiceChannel == null){
var { channel: voiceChannel, connection: conn } = msg.guild.voiceStates.cache.first();
}
and it seems to work. I don't know enough javascript to find the actual solution, but this dirty work-around is fine for my usage.
Turned out my fix does not work all the time...
When leaving a channel, I'm meeting the following error :
Any idea where it comes from and how to fix it ?