My bot plays a stream and it stops after round about a minute of playing.
const connection = joinVoiceChannel({
channelId: message.member.voice.channel.id,
guildId: message.member.voice.channel.guildId,
adapterCreator: message.guild.voiceAdapterCreator,
selfDeaf: true
});
const player = createAudioPlayer();
let resource = createAudioResource(streamURL);
connection.subscribe(player);
connection.on(VoiceConnectionStatus.Ready, () => {
player.play(resource);
});
connection.on(VoiceConnectionStatus.Disconnected, async () => {
connection.destroy();
});
Thats my code to play the stream and these are my dependencies:
"@discordjs/opus": "^0.8.0",
"@discordjs/rest": "^1.0.0",
"@discordjs/voice": "^0.11.0",
"discord-api-types": "^0.36.3",
"discord.js": "^14.0.3",
"ffmpeg-static": "^5.0.2",
"libsodium-wrappers": "^0.7.10",
"node-fetch": "^3.2.9"
Node version: v18.16.0
Npm version: 9.6.4