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

125
Visualizações
Bot won't join voice channel

I have a problem where I've joined a voice channel and I want to play a song but the bot tells me to join a voice channel even though I'm already in one here's an image

Here's my code:

import ytdl from 'ytdl-core'
import ytSearch from 'yt-search'
export const name = 'play';
export const description = 'Play a desired song!';
export const args = 1;
export const usage = '{song}';
export const execute = async (message, args) => {
const voiceChannel = message.member.voice.channel;
if (!voiceChannel) return message.channel.send('Please join a voice channel first!');

const connection = await joinVoiceChannel();

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(`:arrow_forward: Now playing ***${video.title}***`)
} else {
    message.channel.send(`I could not find the video :c`)
}

}

This is the first time I'm asking for help here, so if something isn't clear please ask me any questions!

Help would be heavily appreciated (I think it's because joinVoiceChannel(); is not a function.)

about 4 years ago · Juan Pablo Isaza
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