putteke
putteke

Reputation: 11

Discord.js not playing youtube url

    let channel = bot.channels.cache.get(config.STUDIEHOKr)
        channel.join().then(connection =>{
        const dispatcher = connection.play(ytdl('https://www.youtube.com/watch?v=5zXB8ibh5yk', { filter: 'audioonly' }));
        dispatcher.on("end", end => {
            channel.leave();
            console.log('Playing is finished!');
        });    
    }).catch(err => console.log(err));

This is my code from a Discord bot that is playing a song. My bot is running on Heroku. It has worked for a while but today it stopped working. The bot still joins the channel but doesn't play any sound. I don't get any errors in my logs. Can someone help me to figure out what the problem is?

Upvotes: 0

Views: 1168

Answers (1)

putteke
putteke

Reputation: 11

I tried to host the bot from my pc but playing from YouTube also didn't work. I think there is something wrong with the ytdl-core. So another solution was to put the mp3 files on my Github and play them localy from Heroku, so not from third party YouTube.

Upvotes: 1

Related Questions