random fix

This commit is contained in:
Histmy 2020-11-13 19:58:10 +01:00
parent bf8c3e3e70
commit d4242db625
2 changed files with 12 additions and 2 deletions

14
app.js
View File

@ -29,7 +29,7 @@ function vypocitatCas(vojsl) {
let d = new Date();
let hod = d.getHours();
let min = d.getMinutes();
if (min > 25 && min < 55) {
if (min > 30) {
min = 0;
if (hod == 23) {
hod = 0;
@ -42,16 +42,25 @@ function vypocitatCas(vojsl) {
}
d.setHours(hod);
d.setMinutes(min);
d.setSeconds(0);
setTimeout(function() {
rekniCas2(vojsl, `${nula(hod)}${nula(min)}`);
}, d - c);
}, d - c + 3000);
}
function rekniCas2(vojsl, cas) {
if (!vojsl) return;
const disp = vojsl.play(`./zvuky/${cas}.mp3`);
disp.on('finish', () => vojsl.play('./zvuky/grg.mp3'));
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);
}
@ -75,6 +84,7 @@ client.on('message', mes => {
break;
case 'rekni':
if (mes.author.bot) return;
corict = celArgs ? celArgs : 'co mam jako ric';
mes.channel.send(corict);
break;

BIN
zvuky/intro.mp3 Normal file

Binary file not shown.