Since today I have a problem with ytdl (all code was working fine a few days ago), I think it's because of the ytdl update,
here is the error:
MinigetError: Status code: 410
at ClientRequest.<anonymous> (/home/container/node_modules/miniget/dist/index.js:210:27)
...
and here is the function
async function runVideo(message, msg, noShift) {
const server = servers.get(message.guild.id);
const audioPlayer = createAudioPlayer();
let player;
// here is the problem
player = await ytdl(server.currentVideo.url, {
quality: 'highestaudio'
})
const voiceChannel = message.member.voice.channel;
const connection = getVoiceConnection(message.guild.id);
const resource = createAudioResource(player, { inlineVolume: true });
resource.volume.setVolumeLogarithmic(server.currentVol / 100)
audioPlayer.play(resource);
audioPlayer.on('error', async error => {
console.log(error)
if(server.tries >= 3) {
await message.channel.send(':x: To many fail, disconnecting the bot...').then(() => {
server.tries = 0
return connection.destroy()
})
} else {
message.channel.send(`:warning: An error occured, retrying to play the song (tries ${server.tries + 1}/3)...`).then(() => {
server.tries++;
return runVideo(message)
})
}
});
...
}