Closed RickOrnichons closed 4 years ago
Problem: You are listening to the event even after returning the response.
Solution:
Use .once to listen to the event for one time for that one particular request.
connection.dispatcher.once("finish", () => {
Could fix your issue, if it doesn't let me know.
Hello ! @LiamTownsley
I'm trying use once
just like you tell me.
But the issue comes agin :/
connection.dispatcher.once("finish", () => { guildMusic.queue.shift() if (!guildMusic.queue.length) { voiceChannel.leave() return } play(connection, guildMusic.queue[0].link) }) } }
And the error : events.js:288 throw er; // Unhandled 'error' event ^
Error [ERR_STREAM_WRITE_AFTER_END]: write after end
at writeAfterEnd (_stream_writable.js:264:14)
at PassThrough.Writable.write (_stream_writable.js:313:5)
at IncomingMessage.ondata (_stream_readable.js:714:22)
at IncomingMessage.emit (events.js:323:22)
at addChunk (_stream_readable.js:294:12)
at readableAddChunk (_stream_readable.js:275:11)
at IncomingMessage.Readable.push (_stream_readable.js:209:10)
at HTTPParser.parserOnBody (_http_common.js:132:24)
at TLSSocket.socketOnData (_http_client.js:476:22)
at TLSSocket.emit (events.js:311:20)
Emitted 'error' event on PassThrough instance at:
at PassThrough.
@RickOrnichons how did you solve this? I'm having the exact same issue
Hello,
I come here, because i've got a little issue. I'm trying to make an play command for my Bot. So this is my code : `// Play Youtube
const Discord = require('discord.js') const ytdl = require('ytdl-core-discord') const ytsr = require('ytsr') ytsr.do_warn_deprecate = false
module.exports = { name: 'play', description: 'Lance une musique choisie par un utilisateur',
async execute(message) {
} }`
And all the times, in approximatively 50 percent of the music, i'v got an error : Error
[ERR_STREAM_WRITE_AFTER_END]: write after end
And i don't relly know why.If someones can help me, thanks !