Discord.js 13 channel.join is not a function
I recently installed Discord.js 13.1.0 and my music commands broke because, apparently, channel.join();
is not a function, although I have been using it for months on 12.5.3...
Does anybody know a fix for this?
Some parts of my join command:
const { channel } = message.member.voice;
const voiceChannel = message.member.voice.channel;
await channel.join();
It results in the error.
Solution 1:
Discord.js no longer supports voice. You need to use the other package they made (@discordjs/voice). You can import joinVoiceChannel
from there.
//discord.js and client declaration
const { joinVoiceChannel } = require('@discordjs/voice');
client.on('messageCreate', message => {
if(message.content === '!join') {
joinVoiceChannel({
channelId: message.member.voice.channel.id,
guildId: message.guild.id,
adapterCreator: message.guild.voiceAdapterCreator
})
}
})