function vypocitatCas(vojsl) { let c = new Date(); let d = new Date(); let hod = d.getHours(); let min = d.getMinutes(); if (min >= 30) { min = 0; if (hod == 23) { hod = 0; d.setDate(c.getDate() + 1); } else { hod++; } } else { min = 30; } d.setHours(hod); d.setMinutes(min); d.setSeconds(0); setTimeout(function() { rekniCas(vojsl, `${nula(hod)}${nula(min)}`); }, d - c + 3000); } function rekniCas(vojsl, cas) { if (!vojsl) return; const d1 = vojsl.play(`./zvuky/intro.mp3`); d1.on('finish', function () { const d2 = vojsl.play(`./zvuky/${cas}.mp3`); d2.on('finish', function () { vojsl.play(`./zvuky/grg.mp3`); }); }); vypocitatCas(vojsl); } function nula(a) { return a < 10 ? "0" + a : a; } module.exports = (mes, komand, celArgs) => { switch (komand) { case 'wojs': mes.channel.send(`vojs se pise s normalnim v ti kriple ${mes.author}`); break; case 'vojs': const channel = mes.member.voice.channel; if (!channel) { mes.channel.send(`di si tam sam ne ty gadzo ${mes.author}`); break; } if (celArgs !== 'potichu') mes.channel.send('<@&591306633196339261> vojs'); channel.join() .then(con => { vypocitatCas(con); con.play('./zvuky/nazdar.ogg'); }); break; case "odejdi": case "disconnect": case "leave": case "odpoj": case "votpoj": case "vodpoj": case "vodprejskni": case "tahni": case "táhni": case "vypadni": const vojs = mes.guild.voice; if (!vojs) { mes.channel.send('nejsem ve vojsu'); break; } vojs.channel.leave(); mes.react('purfieRIP:644609482843881483'); break; default: return false; } return true; };