i built a discord.js bot that joins when someone use its command, but it's only working if the video has high views, I tried to use unlisted YouTube videos, some videos that I uploaded and low-viewed videos but it's not working, it just joins the voice channel then leaves.
if (message.content == "!sodium") {
if (!message.member.voice.channel) return message.reply("You have to be in a voice channel");
message.member.voice.channel.join().then(VoiceConnection => {
VoiceConnection.play(ytdl("https://youtu.be/30p-iRH9z2c")).on("finish", () =>
VoiceConnection.disconnect());
message.reply("started...");
}).catch(e => console.log(e))
};
I solved that by adding { filter: 'audioonly' }
.