Update app.js
This commit is contained in:
parent
8187e01dda
commit
e55c39b469
51
app.js
51
app.js
@ -1 +1,50 @@
|
|||||||
ij
|
const { Client } = require('discord.js');
|
||||||
|
|
||||||
|
const client = new Client();
|
||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
|
const prefix = process.env.PREFIX || 'more';
|
||||||
|
const role = {online: '684443816383610916', idle: '684444083065978941', dnd: '684444020558135399', offline: '684443903759614049', onlinephone: '777989420728975390'};
|
||||||
|
const spostece = ['mares', 'mareš', 'purfie', 'denim', '<@!639142938965704745>'];
|
||||||
|
const emouty = ['purfiek3:616026189269696512', 'purfiek3:616026189269696512', 'purfiek3:616026189269696512', 'purfieUchyl:576487602203525138', 'bafW:574646319696576532', 'purfiek4:616026180889477258'];
|
||||||
|
|
||||||
|
const modules = [require('./modules/help'), require('./modules/hovna'), require('./modules/normal'), require('./modules/status'), require('./modules/vojs')];
|
||||||
|
|
||||||
|
const rand = max => Math.floor(Math.random() * max);
|
||||||
|
|
||||||
|
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(' ');
|
||||||
|
for (let i = 0; i < modules.length; i++) {
|
||||||
|
if (modules[i](mes, komand, celArgs, client)) break;
|
||||||
|
if (i === modules.length - 1) mes.channel.send('co to znamena ti gadzovko');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let sance = 0;
|
||||||
|
spostece.forEach(sp => {
|
||||||
|
if (mes.content.toLowerCase().includes(sp)) sance++;
|
||||||
|
});
|
||||||
|
if (rand(3) < sance) mes.react(emouty[rand(emouty.length)]);
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('presenceUpdate', (bef, aft) => {
|
||||||
|
if (aft.guild.id !== '555779161067749446' || process.env.IGNORE_PRESENCE) return;
|
||||||
|
|
||||||
|
if (!bef) bef = {status: 'offline', clientStatus: {}};
|
||||||
|
if (bef.clientStatus.mobile === 'online' && bef.clientStatus.desktop !== 'online') bef.status = 'onlinephone';
|
||||||
|
if (aft.clientStatus.mobile === 'online' && aft.clientStatus.desktop !== 'online') aft.status = 'onlinephone';
|
||||||
|
if (bef.status === aft.status) return;
|
||||||
|
|
||||||
|
aft.member.roles.add(role[aft.status]);
|
||||||
|
aft.member.roles.remove(role[bef.status]);
|
||||||
|
console.log(`${aft.user.username} změnil status z ${bef.status} na ${aft.status}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
client.login(process.env.TOKEN);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user