I have been trying to get my discord bot to play audio. I managed to did it locally, but because I want to host it on heroku I am now trying to play it from a youtube video since heroku cannot play songs locally using ffmpeg.
if(command==="marijuana"){ var voiceChannel = message.member.voice.channel; if(voiceChannel!=null){ voiceChannel.join().then(connection => { const dispatcher = connection.play(ytdl('https://youtu.be/fqEhB9rjbvE')); dispatcher.on("end", end => {voiceChannel.leave()});}); } }
2.1m questions
2.1m answers
60 comments
57.0k users