Bot joint not the voice
After removing the bot by right-clicking and disconnecting, it will no longer join the voice the next time. However,
player.connect({ setDeaf: true })
still returns true.5 Replies
I will investigate this and fix it, thanks for the report
Hey!
soo you can fix that by adding a onvoicestateupdate thing to your main bot code like this
client.on('voiceStateUpdate', (oldState, newState) => {
if (oldState.member.id !== client.user.id) return;
if (oldState.channelId && !newState.channelId) {
const guildId = oldState.guild.id;
const player = client.manager.players.get(guildId);
if (player) {
const textChannel = client.channels.cache.get(player.textChannelId);
if (textChannel) {
textChannel.send({
embeds: [
new EmbedBuilder()
.setColor(0x808080)
.setTitle('Disconnected')
.setDescription('I was disconnected from the voice channel. Player destroyed.')
]
});
}
player.destroy();
}
}
});
this will destroy the lavalink player if the bot gets disconencted from vc , it was not getting destroyed in your case which was causing the bot to not join vc after u disconnected it from the vc
@BastiGameツ try this and ping me if it worked 😄
one thing, when the player is forced to disconnect, the voiceChannelId becomes null, you have to set the channel again using setVoiceChannelId(channel.id)
check if the player exists - if it exists check if voiceChannelId is null - set new channel - call connect
Okay thanks
GG @BastiGameツ, you just advanced to level 3!