EADDRINUSE fix finally

finally it doens't overload console!1!1 !1!
This commit is contained in:
ChomeNS 2022-12-08 20:06:00 +07:00
parent 512c4213ff
commit e6b64c2386

View file

@ -93,13 +93,16 @@ function inject (bot, dcclient, config) {
}) })
function endListener (reason) { function endListener (reason) {
client.end(`Bot disconnected with reason: ${util.inspect(reason)}`)
bot.off('end', endListener) bot.off('end', endListener)
srv.close() client.end(`Bot disconnected with reason: ${util.inspect(reason)}`)
srv.removeAllListeners()
} }
bot.on('end', endListener) bot.on('end', endListener)
}) })
bot.on('end', () => {
srv.close()
srv.removeAllListeners()
})
}; };
module.exports = { inject } module.exports = { inject }