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);