Update app.js
rekniCas2
This commit is contained in:
parent
8cb213ed83
commit
18c6557349
40
app.js
40
app.js
@ -24,6 +24,38 @@ const rekniCas = (par = null) => {
|
||||
setTimeout(rekniCas, 30 - ickon/1000 % 30);
|
||||
};
|
||||
|
||||
function vypocitatCas(vojsl) {
|
||||
let c = new Date();
|
||||
let d = new Date();
|
||||
let hod = d.getHours();
|
||||
let min = d.getMinutes();
|
||||
if (min >= /*30*/ 20) {
|
||||
min = 0;
|
||||
hod = hod == 23 ? 0 : hod + 1;
|
||||
c = new Date(c.getDate() + 1);
|
||||
} else {
|
||||
min = 30;
|
||||
}
|
||||
d.setHours(hod);
|
||||
d.setMinutes(min);
|
||||
|
||||
setTimeout(function() {
|
||||
rekniCas2(vojsl, `${nula(hod)}${nula(min)}`);
|
||||
}, c - d);
|
||||
}
|
||||
|
||||
function rekniCas2(vojsl, cas) {
|
||||
if (!vojsl) return;
|
||||
const disp = vojs.play(`./zvuky/${cas}.mp3`);
|
||||
disp.on('finish', () => vojs.play('./zvuky/grg.mp3'));
|
||||
|
||||
vypocitatCas(vojsl);
|
||||
}
|
||||
|
||||
function nula(a) {
|
||||
return a < 10 ? "0" + a : a;
|
||||
}
|
||||
|
||||
client.on('ready', () => console.log('A jedeš!'));
|
||||
|
||||
client.on('message', mes => {
|
||||
@ -103,12 +135,12 @@ client.on('message', mes => {
|
||||
mes.channel.send(`di si tam sam ne ty gadzo ${mes.author}`);
|
||||
break;
|
||||
}
|
||||
channel.join()
|
||||
.then(con => vojs = con);
|
||||
|
||||
if (!mes.content.includes('potichu')) mes.channel.send('<@&591306633196339261> vojs');
|
||||
|
||||
const ickon = new Date();
|
||||
setTimeout(rekniCas, 30 - ickon/1000 % 30);
|
||||
/*const ickon = new Date();
|
||||
setTimeout(rekniCas, 30 - ickon/1000 % 30);*/
|
||||
channel.join().then(con => vypocitatCas(con));
|
||||
break;
|
||||
|
||||
case 'wojs':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user