Added more vytah (finally) + some formating
This commit is contained in:
parent
c11c381484
commit
3e97196d0f
2
app.js
2
app.js
@ -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) => {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user