Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

150
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda