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 => {
|
client.on('message', mes => {
|
||||||
if (process.env.IGNORE_MESS) return;
|
if (process.env.IGNORE_MESS) return;
|
||||||
|
|
||||||
const [mes_prefix, komand, ...args] = mes.content.toLowerCase().split(' ');
|
const [mes_prefix, komand, ...args] = mes.content.toLowerCase().split(' ');
|
||||||
if (mes_prefix === prefix) {
|
if (mes_prefix === prefix) {
|
||||||
const celArgs = args.join(' ');
|
const celArgs = args.join(' ');
|
||||||
@ -30,7 +31,6 @@ client.on('message', mes => {
|
|||||||
if (mes.content.toLowerCase().includes(sp)) sance++;
|
if (mes.content.toLowerCase().includes(sp)) sance++;
|
||||||
});
|
});
|
||||||
if (rand(3) < sance) mes.react(emouty[rand(emouty.length)]);
|
if (rand(3) < sance) mes.react(emouty[rand(emouty.length)]);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('presenceUpdate', (bef, aft) => {
|
client.on('presenceUpdate', (bef, aft) => {
|
||||||
|
|||||||
@ -40,6 +40,22 @@ function nula(a) {
|
|||||||
return a < 10 ? "0" + a : 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) => {
|
module.exports = (mes, komand, celArgs) => {
|
||||||
switch (komand) {
|
switch (komand) {
|
||||||
|
|
||||||
@ -81,6 +97,17 @@ module.exports = (mes, komand, celArgs) => {
|
|||||||
mes.react('purfieRIP:644609482843881483');
|
mes.react('purfieRIP:644609482843881483');
|
||||||
break;
|
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:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user