0
votes

I am trying to make my bot play music in a member's VC, but all it does is download the song the member tries to play, join the voice channel, and immediately goes to my dispatcher.on("end", () => {}) function. The path to the song is correct. If I try to play the song directly on Windows it works, but the bot doesn't even play anything. I have FFmpeg installed, installed node-opus using yarn add node-opus and I honestly have no clue why it doesn't work.

message.member.voiceChannel.join()
  .then(connection => {
    const dispatcher = connection.playFile('C:\Users\ameij\OneDrive\programming\promo\ytdl\song.mp3');
    dispatcher.on("end", () => {
      this.message.channel.send('Finished Playing.')
      dispatcher.end();

      this.message.member.voiceChannel.leave();
    })
  })
  .catch(console.error);
1

1 Answers

0
votes

I had the same error because I did not have ffmpeg installed globally.

Try to do npm i -g ffmpeg-binaries, maybe you hadn't installed ffmpeg globally (Sorry I should comment but I have not enough reputation)

If that does not work, try to install node-opus again using NPM: npm i node-opus