Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

411
Visualizações
voiceChannel.join() isn't a function node v16 discord.js

I made a bot that plays music. I upgraded to NodeJS v16.6.1 and voiceChannel.join doesn't work anymore. I already tried using const { voiceChannel } = require('@discord.js/voice'); but it just says module not found. Code:

const ytdl = require("ytdl-core");
const ytSearch = require("yt-search");

module.exports = {
    name: 'play',
    description: 'Joins and plays a video from youtube',
    async execute(message, args) {
        const voiceChannel = message.member.voice.channel;
        if (!voiceChannel) return message.channel.send('You need to be in a channel to execute this command');
        const permissions = voiceChannel.permissionsFor(message.client.user);
        if (!permissions.has('CONNECT')) return message.channel.send('You dont have the neccesary permissions');
        if (!permissions.has("SPEAK")) return message.channel.send('You dont have the neccesary permissions');
        if (!args.length) return message.channel.send('Define Video');
        const connection = await voiceChannel.join();
        const videoFinder = async (query) => {
            const videoResult = await ytSearch(query);
            return (videoResult.videos.length > 1) ? videoResult.videos[0] : null;
        }
        const video = await videoFinder(args.join('  '));
        if (video) {
            const stream = ytdl(video.url, {
                filter: 'audioonly'
            });
            connection.play(stream, {
                    seek: 0,
                    volume: 1
                })
                .on('finish', () => {
                    voiceChannel.leave();
                });
            await message.reply(`Now Playing **${video.title}**`)
        } else {
            message.channel.send('No videos found');
        }
    }
}```
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

As the error says, voiceChannel#join is not, in fact, a function. While it did exist on Discord.js v12, which I assume you were using before updating your Node.js version, note that it is nowhere to be found in the Discord.js v13 documentation on VoiceChannel. Instead, you are to migrate to @discordjs/voice, whose joinVoiceChannel function can be used as a replacement.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda