Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!