Fixed memory leak even more

This commit is contained in:
Histmy 2020-12-27 13:49:56 +01:00
parent e80ba096c8
commit 2283010ee3

View File

@ -81,7 +81,15 @@ module.exports = (mes, komand, celArgs) => {
channel.join() channel.join()
.then(con => { .then(con => {
if (!timeouty[mes.guild.id]) vypocitatCas(con); if (!timeouty[mes.guild.id]) {
vypocitatCas(con);
con.on('disconnect', () => {
if (timeouty[mes.guild.id]) {
clearTimeout(timeouty[mes.guild.id]);
delete timeouty[mes.guild.id];
}
});
}
con.play('./zvuky/nazdar.ogg'); con.play('./zvuky/nazdar.ogg');
}); });
break; break;
@ -103,8 +111,6 @@ module.exports = (mes, komand, celArgs) => {
break; break;
} }
vojs.channel.leave(); vojs.channel.leave();
clearTimeout(timeouty[mes.guild.id]);
delete timeouty[mes.guild.id];
mes.react('purfieRIP:644609482843881483'); mes.react('purfieRIP:644609482843881483');
break; break;