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.on('voiceStateUpdate', (bef, aft) => { if (!aft.channel || !aft.guild.voice || aft.member.user === client.user) return; // const vysvetleni = (user, vojs = undefined) => { // const con = aft.guild.voice.connection; // const disp = con.play('./zvuky/neodposlouchavej.ogg'); // disp.on('finish', () => { // user.setDeaf(true, 'otposlouchávala ta gadza'); // if (vojs) con.voice.setChannel(vojs); // }); // } if (aft.mute && !aft.deaf) { // if (aft.guild.voice.channel !== aft.channel) { // const vojsBack = aft.guild.voice.channel; // aft.guild.voice.setChannel(aft.channel) // .then(() => vysvetleni(aft, vojsBack)); // return; // } // vysvetleni(aft); const disp = aft.guild.voice.connection.play('./zvuky/neodposlouchavej.ogg'); disp.on('finish', () => user.setDeaf(true, 'otposlouchávala ta gadza')); } if (!bef.channel) return; if (bef.mute && bef.deaf && !aft.mute && aft.deaf) aft.setDeaf(false, 'us muze poslouchat gaza'); }); client.login(process.env.TOKEN);