Voice connection dropping after 3-5 min with ECONNRESET error

Error: node:events:495 throw er; // Unhandled 'error' event ^ Error: read ECONNRESET at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) Emitted 'error' event on BodyReadable instance at: at BodyReadable.emit (X:\Code\DiscordBotinok\node_modules\undici\lib\api\readable.js:71:18) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4077, code: 'ECONNRESET', syscall: 'read' } Function that plays music:
const playFunc = async (player, interaction) => {
player.extractors.register(YouTubeExtractor);
const channel = interaction.member.voice.channel;
if (!channel) return interaction.reply('You need to be in voice channel'); // You need to be in voice channel
const query = interaction.options.getString('url', true);

// await interaction.deferReply();

try {
const { track } = await player.play(channel, query, {
nodeOptions: {
// nodeOptions are the options for guild node (aka your queue in simple word)
metadata: interaction // we can access this metadata object using queue.metadata later on
}
});

return await interaction.followUp(`**${track.title}** is playing!`);
} catch (e) {
return await interaction.followUp(`Somthing went wrong: ${e}`);
}
}
const playFunc = async (player, interaction) => {
player.extractors.register(YouTubeExtractor);
const channel = interaction.member.voice.channel;
if (!channel) return interaction.reply('You need to be in voice channel'); // You need to be in voice channel
const query = interaction.options.getString('url', true);

// await interaction.deferReply();

try {
const { track } = await player.play(channel, query, {
nodeOptions: {
// nodeOptions are the options for guild node (aka your queue in simple word)
metadata: interaction // we can access this metadata object using queue.metadata later on
}
});

return await interaction.followUp(`**${track.title}** is playing!`);
} catch (e) {
return await interaction.followUp(`Somthing went wrong: ${e}`);
}
}
Dependencies: "devDependencies": { "@discord-player/extractor": "^4.4.5", "@discordjs/builders": "^1.7.0", "@discordjs/opus": "^0.9.0", "@discordjs/rest": "^2.2.0", "@discordjs/voice": "^0.16.0", "discord-api-types": "^0.37.67", "discord-player": "^6.6.6", "discord.js": "^14.14.1", "dotenv": "^16.3.1", "lodash": "^4.17.21", "youtube-ext": "^1.1.16" }
2 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
miawue
miawueOP11mo ago
YouTube music player is not allowed? Oh got it ty
Want results from more Discord servers?
Add your server