Explicación
Tengo este código que reproduce audio de video de youtube en canales de voz.
Cuando se une al canal, aparece un error que dice "ffmpeg no encontrado". Ejecuté el comando de terminal "npm i ffmpeg-static" y funcionó bien, pero después de un par de minutos aparece un error largo y la música deja de reproducirse.
Este es mi código:
client.on("ready", async () => { for (const channelId of Channels) { joinChannel(channelId); await new Promise(res => setTimeout(()=>res(2), 500)) } function joinChannel(channelId) { client.channels.fetch(channelId).then(channel => { const VoiceConnection = joinVoiceChannel({ channelId: channel.id, guildId: channel.guild.id, adapterCreator: channel.guild.voiceAdapterCreator }); const resource = createAudioResource(ytdl("https://youtu.be/0J2gdL87fVs", { filter: "audioonly" }), { inlineVolume: true }); resource.volume.setVolume(0.2); const player = createAudioPlayer() VoiceConnection.subscribe(player); player.play(resource); player.on("idle", () => { try { player.stop() }catch (e) {} try { VoiceConnection.destory() }catch (e) {} joinChannel(channelId) }) }).catch(console.error) } })