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

151
Visualizações
How I can make the bot can play music in stage channel

This is client messageCreate in my code:

    if (msg.author.bot || msg.channel.type == "dm") return;
    if (msg.content.startsWith(".")){
        const player = await createAudioPlayer();
        const connection = await joinVoiceChannel({
            channelId: "935835998397542400",
            guildId: "808674100469432360",
            adapterCreator: msg.guild.voiceAdapterCreator
        });
        await msg.guild.me.voice.setSuppressed(false);
        const stream = await ytdl("https://www.youtube.com/watch?v=21qNxnCS8WU", { 
            filter: 'audioonly',
            quality: 'highestaudio',
            highWaterMark: 1 << 25,
         });
        const resource = await createAudioResource(stream);
        await player.play(resource);
    }
});

When I send "." in discord, the bot just join the stage channel but it doesn't play music in there. I spend all day to fix this error but it doesn't work

Version package:

Nodejs: v16.13.0

Discord.js: v13.6.0

Npm: v8.3.2

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

At the end you have to call:

connection.subscribe(player);

Documentation: https://discord.js.org/#/docs/voice/stable/class/VoiceConnection?scrollTo=subscribe

Guide (with great explanation): https://discordjs.guide/voice/voice-connections.html#playing-audio

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