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

178
Views
How can i make it play music?

I tried making a rickroll command like this:

client.on('message', message => {
if (message.content.startsWith('music plz')) {
    const voiceChannel = message.member.voice.channel;
    if (!voiceChannel) {
        return message.reply(`Wow what a scrub, join a Voice Channel first`);
    }
    voiceChannel.join()
.then(connection => {
    const stream = ytdl('https://www.youtube.com/watch?v=dQw4w9WgXcQ', { filter: 'audioonly' });
    const dispatcher = connection.playStream(stream, streamOptions);
})

It joins the VC and gives an error when not in VC but does not play music what am I doing wrong? I use Discord.js v12.5 and I am new to it.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Check the guide Here they have a guide of how to do this. Also please update to v13, it's much better. Something like this:

const fs = require('fs');

const broadcast = client.voice.createBroadcast();

// From a path
broadcast.play('audio.mp3');
// From a ReadableStream
broadcast.play(fs.createReadStream('audio.mp3'));
// From a URL
broadcast.play('http://myserver.com/audio.aac');
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!