Time announcement memory leak finally fixed
This commit is contained in:
parent
0515cbcdbf
commit
e80ba096c8
@ -18,7 +18,7 @@ function vypocitatCas(vojsl) {
|
||||
d.setMinutes(min);
|
||||
d.setSeconds(0);
|
||||
|
||||
setTimeout(function() {
|
||||
timeouty[vojsl.channel.guild.id] = setTimeout(function() {
|
||||
rekniCas(vojsl, `${nula(hod)}${nula(min)}`);
|
||||
}, d - c + 3000);
|
||||
}
|
||||
@ -56,6 +56,8 @@ const vytahnout = (clen, patro) => {
|
||||
setTimeout(() => vytahnout(clen, patro), 1000);
|
||||
};
|
||||
|
||||
const timeouty = {};
|
||||
|
||||
module.exports = (mes, komand, celArgs) => {
|
||||
switch (komand) {
|
||||
|
||||
@ -69,11 +71,17 @@ module.exports = (mes, komand, celArgs) => {
|
||||
mes.channel.send(`di si tam sam ne ty gadzo ${mes.author}`);
|
||||
break;
|
||||
}
|
||||
if (mes.guild.voice) {
|
||||
if (mes.guild.voice.channel === channel) {
|
||||
mes.channel.send(`vsak uz tam sem ne ty gadzo ${mes.author}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (celArgs !== 'potichu') mes.channel.send('<@&591306633196339261> vojs');
|
||||
|
||||
channel.join()
|
||||
.then(con => {
|
||||
vypocitatCas(con);
|
||||
if (!timeouty[mes.guild.id]) vypocitatCas(con);
|
||||
con.play('./zvuky/nazdar.ogg');
|
||||
});
|
||||
break;
|
||||
@ -95,6 +103,8 @@ module.exports = (mes, komand, celArgs) => {
|
||||
break;
|
||||
}
|
||||
vojs.channel.leave();
|
||||
clearTimeout(timeouty[mes.guild.id]);
|
||||
delete timeouty[mes.guild.id];
|
||||
mes.react('purfieRIP:644609482843881483');
|
||||
break;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user