joinVoiceChannel does absolutely nothing

const { SlashCommandBuilder } = require('discord.js');
const { joinVoiceChannel, getVoiceConnection, entersState, VoiceConnectionStatus } = require('@discordjs/voice');

module.exports = {
data: new SlashCommandBuilder()
.setName('join')
.setDescription('Makes the bot join your voice channel'),
run: async (Interaction) => {
await Interaction.deferReply();

if (!Interaction.member.voice.channel)
return Interaction.editReply('You must be on a Voice channel to run this command.')

var Conn = getVoiceConnection(Interaction.guild.id)
if (!Conn) {
const Options = {
chanelId: Interaction.member.voice.channel.id,
guildId: Interaction.guild.id,
adapterCreator: Interaction.guild.voiceAdapterCreator,
selfDeaf: true,
selfMute: false,
debug: true
};

Conn = joinVoiceChannel(Options);

Conn.on('error', (err) => {
console.log(err);
});

Conn.on('debug', (dbg) => {
console.log(`dbg: ${dbg}`);
});

Conn.on('stateChange', (state, stateNew) => {
console.log(`state: ${state} ${stateNew}`);
});

try {
await entersState(Conn, VoiceConnectionStatus.Ready, 30_000);
} catch(Err) {
return Interaction.editReply(`Connection timed out...`);
}

Interaction.editReply(`Joined`);
}
}
}
const { SlashCommandBuilder } = require('discord.js');
const { joinVoiceChannel, getVoiceConnection, entersState, VoiceConnectionStatus } = require('@discordjs/voice');

module.exports = {
data: new SlashCommandBuilder()
.setName('join')
.setDescription('Makes the bot join your voice channel'),
run: async (Interaction) => {
await Interaction.deferReply();

if (!Interaction.member.voice.channel)
return Interaction.editReply('You must be on a Voice channel to run this command.')

var Conn = getVoiceConnection(Interaction.guild.id)
if (!Conn) {
const Options = {
chanelId: Interaction.member.voice.channel.id,
guildId: Interaction.guild.id,
adapterCreator: Interaction.guild.voiceAdapterCreator,
selfDeaf: true,
selfMute: false,
debug: true
};

Conn = joinVoiceChannel(Options);

Conn.on('error', (err) => {
console.log(err);
});

Conn.on('debug', (dbg) => {
console.log(`dbg: ${dbg}`);
});

Conn.on('stateChange', (state, stateNew) => {
console.log(`state: ${state} ${stateNew}`);
});

try {
await entersState(Conn, VoiceConnectionStatus.Ready, 30_000);
} catch(Err) {
return Interaction.editReply(`Connection timed out...`);
}

Interaction.editReply(`Joined`);
}
}
}
Bot has admin perms, and I'm passing the GuildVoiceStates intent (discord.js 14.14.1, discordjs/voice 0.16.1) Not a single event (error, debug or stateChange) runs, it just times out. Am I doing something wrong?
4 Replies
d.js toolkit
d.js toolkit4mo 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
neru
neru4mo ago
i'm guessing dependencies have nothing to do with this but just in case
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.16.1
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: not found
- opusscript: 0.0.8

Encryption Libraries
- sodium-native: 4.0.10
- sodium: not found
- libsodium-wrappers: 0.7.13
- tweetnacl: not found

FFmpeg
- version: 2024-03-04-git-e30369bc1c-essentials_build-www.gyan.dev
- libopus: yes
--------------------------------------------------
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.16.1
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: not found
- opusscript: 0.0.8

Encryption Libraries
- sodium-native: 4.0.10
- sodium: not found
- libsodium-wrappers: 0.7.13
- tweetnacl: not found

FFmpeg
- version: 2024-03-04-git-e30369bc1c-essentials_build-www.gyan.dev
- libopus: yes
--------------------------------------------------
duck
duck4mo ago
chanelId
channelId has 2 ns
neru
neru4mo ago
oh my god you are right i spent a whole hour staring at it and didn't notice that im going to kill someone (in mc) tysm