bot not joining

djs v14, voice 0.16 & node v18.12.1 i did try to console.log - here's my code:
if (message.content.startsWith('.vsaucemeup')) {
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require('@discordjs/voice');
const channel = message.content.split(' ?c ')[1]
console.log(channel)
const player = createAudioPlayer();
const connection = joinVoiceChannel({
channelId: channel,
guildId: message.channel.guild.id,
adapterCreator: message.channel.guild.voiceAdapterCreator,
});
const resource = createAudioResource('vsauce.mp3');
console.log(resource)
player.play(resource);
connection.subscribe(player);
}
if (message.content.startsWith('.vsaucemeup')) {
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require('@discordjs/voice');
const channel = message.content.split(' ?c ')[1]
console.log(channel)
const player = createAudioPlayer();
const connection = joinVoiceChannel({
channelId: channel,
guildId: message.channel.guild.id,
adapterCreator: message.channel.guild.voiceAdapterCreator,
});
const resource = createAudioResource('vsauce.mp3');
console.log(resource)
player.play(resource);
connection.subscribe(player);
}
and everything it gave checks out, but it isnt joining
7 Replies
d.js toolkit
d.js toolkit2y ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
duck
duck2y ago
do you have the the GuildVoiceStates intent? I saw in #djs-help-v14 that you have confirmed channel is a valid snowflake, but have you double checked that it's the correct id? is your bot able to get the given channel from the cache? is it in the same guild as this message? have you confirmed that your bot has the correct permissions to join the given channel?
Adelto
AdeltoOP2y ago
1. No, i didnt know u had to have that, ill try that 2. yea 3. yea, its in the guild 4. yes 5. i think so yes
duck
duck2y ago
(I would like to avoid asking that you've confirmed the id is for a voice channel, but there was previously someone attempting to connect to a text channel, so please make sure that isn't the case)
Adelto
AdeltoOP2y ago
added GuildVoiceStates intent, lets see didnt join brb
duck
duck2y ago
just to confirm question 5, after having gotten the channel from the cache, what does <VoiceChannel>.joinable output?
Adelto
AdeltoOP2y ago
i think it doesnt have perms

Did you find this page helpful?