const connection = await voice_channel.join();
Gives me the error:
voice_channel.join is not a function
I have @discordjs/voice installed and everything but it does not work in my code. Does anyone know how I fix this? The same is with my
voice_channel.leave();
which also just gives me the error that it's not a function. Can anyone provide a code example for how I fix this? And yes I have this in my code:
const voice_channel = message.member.voice.channel;
In version 13 joining a voice channel has been changed. You can read all about it in the discord.js guide. To join a voice channel you must now use the joinVoiceChannel() command from discordjs/voice. It is used like this:
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator
})
The channel variable in this example is an instance of BaseGuildVoiceChannel.
To leave the channel just call .disconnect() or .destroy() on your connection object.