// Cokoliv co má něco společnýho s vojsem const { formatCas } = require("../addons/utils.js"); let vojsKuldan = 0; function vypocitatCas(vojsl) { let c = new Date(); let d = new Date(); let hod = d.getHours(); let min = d.getMinutes(); if (min >= 30) { min = 0; if (hod == 23) { hod = 0; d.setDate(c.getDate() + 1); } else { hod++; } } else { min = 30; } d.setHours(hod); d.setMinutes(min); d.setSeconds(0); timeouty[vojsl.channel.guild.id] = setTimeout(function () { rekniCas(vojsl, `${nula(hod)}${nula(min)}`); }, d - c + 3000); } function rekniCas(vojsl, cas) { if (!vojsl) return; const d1 = vojsl.play(`./zvuky/intro.mp3`, { volume: 0.8 }); d1.on('finish', function () { const d2 = vojsl.play(`./zvuky/${cas}.mp3`, { volume: 1.5 }); d2.on('finish', function () { vojsl.play(`./zvuky/grg.mp3`, { volume: 0.5 }); }); }); vypocitatCas(vojsl); } function nula(a) { return a < 10 ? "0" + a : a; } const vytahnout = (clen, patro) => { const vojs = clen.voice.channel; if (!vojs) return; const aktPatro = Number(vojs.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); }; const timeouty = {}; module.exports = { more_komandy: { wojs: (_, mes) => `vojs se pise s normalnim v ti kriple ${mes.author}`, vojs: { cd: 1800, run: (arg, mes) => { const channel = mes.member.voice.channel; if (!channel) return `di si tam sam ne ty gadzo ${mes.author}`; if (arg !== 'potichu') mes.channel.send('<@&591306633196339261> vojs'); if (mes.guild.voice?.channel === channel && mes.guild.connection) return; channel.join() .then(con => { if (!timeouty[mes.guild.id]) { vypocitatCas(con); con.on('disconnect', () => { if (timeouty[mes.guild.id]) { clearTimeout(timeouty[mes.guild.id]); delete timeouty[mes.guild.id]; } }); } setTimeout(() => con.play('./zvuky/nazdar.ogg'), 500); }); } }, vypadni: { als: ["odejdi", "disconnect", "leave", "odpoj", "votpoj", "vodpoj", "vodprejskni", "tahni", "táhni"], run: _ => { let vojs = mes.guild.voice; if (!vojs) vojs = {}; if (!vojs.channel) return mes.channel.send('nejsem ve vojsu'); vojs.channel.leave(); mes.react('855120055632134155'); } }, vytah: { als: ["vitah"], run: (arg, mes) => { if (!mes.member) return 'kokot'; if (!mes.member.voice.channel) return `nejsi ve vojsu ty gadzo ${mes.author}`; if (!arg) return `napis do jakiho patra ${mes.author}`; vytahnout(mes.member, Number(celArgs) || 0); } }, krkacek: { als: ["krkáček", "krkácek", "krkaček", "krk", "grg", "grgnisi", "krknisi", "grgacek", "grgáček", "grgácek", "grgaček"], run: async (_, mes) => { let vojs = mes.guild.voice?.connection; let odpojit = false; if (!vojs) { const chanel = mes.member.voice.channel; if (!chanel) return mes.channel.send("***grrrrrrrrg***"); vojs = await chanel.join(); odpojit = true; } vojs.play(`./zvuky/grg.mp3`, { volume: 0.5 }).on("finish", _ => { if (odpojit) vojs.channel.leave(); }); } } }, // Neodposlouchávej on_voiceStateUpdate: (bef, aft) => { if (!aft.channel || !aft.guild.voice?.connection || aft.member.user === aft.guild.client.user) return; if (aft.selfMute && !aft.deaf) { aft.guild.voice.connection.play('./zvuky/neodposlouchavej.ogg', { volume: 0.38 }) .on('finish', () => { if (aft.selfMute) aft.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 gadza'); } };