not joining voice channel

const { Client, GatewayIntentBits } = require('discord.js');
const { joinVoiceChannel } = require('@discordjs/voice');

const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
]});

client.once('ready', async () => {
console.log('online');
});

client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;

if (interaction.commandName === 'ping') {
await interaction.reply('joining voice channel');

joinVoiceChannel({
channelId: interaction.channelId,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
};
});
const { Client, GatewayIntentBits } = require('discord.js');
const { joinVoiceChannel } = require('@discordjs/voice');

const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
]});

client.once('ready', async () => {
console.log('online');
});

client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;

if (interaction.commandName === 'ping') {
await interaction.reply('joining voice channel');

joinVoiceChannel({
channelId: interaction.channelId,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
};
});
4 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
dubfib
dubfibOP3y ago
npm 9.1.1 node 19.0.1
Idris
Idris3y ago
you need to pass a voice channel id at channelId
dubfib
dubfibOP3y ago
thanks
Want results from more Discord servers?
Add your server