Added more vytah (finally) + some formating

This commit is contained in:
Histmy 2020-12-23 02:51:09 +01:00
parent c11c381484
commit 3e97196d0f
2 changed files with 28 additions and 1 deletions

2
app.js
View File

@ -16,6 +16,7 @@ client.on('ready', () => console.log('A jedeš!'));
client.on('message', mes => {
if (process.env.IGNORE_MESS) return;
const [mes_prefix, komand, ...args] = mes.content.toLowerCase().split(' ');
if (mes_prefix === prefix) {
const celArgs = args.join(' ');
@ -30,7 +31,6 @@ client.on('message', mes => {
if (mes.content.toLowerCase().includes(sp)) sance++;
});
if (rand(3) < sance) mes.react(emouty[rand(emouty.length)]);
});
client.on('presenceUpdate', (bef, aft) => {

View File

@ -40,6 +40,22 @@ function nula(a) {
return a < 10 ? "0" + a : a;
}
const vytahnout = (clen, patro) => {
const vojs = clen.voice
if (!vojs) return;
const aktPatro = Number(vojs.channel.name) || 0;
let dalsiPatro = aktPatro;
if (patro < aktPatro) dalsiPatro--; else if (patro > aktPatro) dalsiPatro++; else return;
if (dalsiPatro === 0) dalsiPatro = 'P';
const dalsiVojsy = [...clen.guild.channels.cache.values()].filter(channel => channel.type === 'voice' && channel.name === String(dalsiPatro));
if (!dalsiVojsy) return;
clen.voice.setChannel(dalsiVojsy[0]);
setTimeout(() => vytahnout(clen, patro), 1000);
};
module.exports = (mes, komand, celArgs) => {
switch (komand) {
@ -81,6 +97,17 @@ module.exports = (mes, komand, celArgs) => {
mes.react('purfieRIP:644609482843881483');
break;
case 'vitah':
case 'vytah':
console.log(celArgs, Boolean(celArgs));
if (!celArgs) {
mes.channel.send(`napis do jakiho patra ${mes.author}`);
break;
}
vytahnout(mes.member, Number(celArgs) || 0);
break;
default:
return false;
}