diff --git a/src/modules/OGs.ts b/src/modules/OGs.ts new file mode 100644 index 0000000..71b6dcd --- /dev/null +++ b/src/modules/OGs.ts @@ -0,0 +1,181 @@ +// Tento modul je zasvěcen komandům, které je potřeba zachovat a jsou tak primitivní, že se dají zkombinovat do jednoho kompaktního souboru. + +import { ActivityType, ChannelType, Message, PresenceStatusData } from "discord.js"; +import { emouty } from "../utils/emotes"; +import { Modul } from "../utils/types"; +import { formatCas, ping, rand } from "../utils/utils"; + +const pomoc: [string[], Record] = require("../../res/pomoc.json"); +const ftipy: string[] = require("../../res/ftipy.json"); + +const delAndReturn = (mes: Message, co: string) => { + if (mes.channel.type != ChannelType.DM) mes.delete(); + return co; +}; + +const changeStatus = (mes: Message, status: PresenceStatusData) => { + mes.client.user?.setStatus(status); + return "ano pane"; +}; + +const changeActivity = (mes: Message, activity: Exclude | undefined = undefined, txt: string = "") => { + mes.client.user?.setActivity(txt, { type: activity }); + mes.react(emouty.d3k); + return "ano pane"; +}; + +const choose = (arr: string[]) => arr[rand(arr.length)]; + +const exp: Modul = { + more_komandy: { + vole: "coe voe more gadzo", + + kobel: "kde?", + + ano: { + als: ["jo", "ne"], + run: "ok" + }, + + rekt: "**ouuuuuuuuuuuuuuuuuuuuu**", + + omegasmart: "<:DENIM3K_OMEGASMART1:638103812892131328><:DENIM3K_OMEGASMART2:638104266195861514><:DENIM3K_OMEGASMART3:638104266178822155>\n<:DENIM3K_OMEGASMART4:638104266246062180><:DENIM3K_OMEGASMART5:638104266241867787><:DENIM3K_OMEGASMART6:638104265889546241>\n<:DENIM3K_OMEGASMART7:638104266267033610><:DENIM3K_OMEGASMART8:638104266271096882><:DENIM3K_OMEGASMART9:638104266258513960>", + + lag: "protoze to spousti na tich stravberi", + + triggered: "toto me trickeruje", + + slak: "te natahne\nhttps://tenor.com/view/tired-done-imdone-afterschool-school-gif-5682065", + + pomoc: pomoc[0].join("\n"), + + pomoc2: () => { return { embeds: [pomoc[1]] }; }, + + pomoc3: `${emouty.lukiw} :point_right: https://denim3001.deadfish.cz/morepomoc`, + + verze: () => `${require("../../package.json").version}\nčenžlog mas tady https://denim3001.deadfish.cz/morehovna`, + + navrh: "tadi mas prostor https://navrhy.denim3001.deadfish.cz/", + + uptime: () => `uz jedu ${formatCas(Math.round(globalThis.performance.now() / 1000))}`, + + rekni: (mes, co) => { + if (mes.author.bot) return "ne"; + return delAndReturn(mes, co || `co mam jako rict ${mes.author}`); + }, + + clap: (mes, text) => { + return delAndReturn(mes, `${text} ${emouty.clap}`); + }, + + clap2: (mes, text) => { + return delAndReturn(mes, `${emouty.clap2} ${text}`); + }, + + voliz: (mes, co) => { + return delAndReturn(mes, `${emouty.lickL}${co}${emouty.lickR}`); + }, + + pozdrav: (_, koho) => `zdravim ${koho}`, + + zhejti: (_, koho) => `${koho} je pycovina zasrana vimrdana`, + + uraz: (_, koho) => `${koho} , u suck`, + + online: { + als: ["onlajn", "zelenej"], + run: mes => changeStatus(mes, "online") + }, + idle: { + als: ["zlutej", "afk", "idle", "nepritomnej"], + run: mes => changeStatus(mes, "idle") + }, + dnd: { + als: ["nerusit", "cervenej"], + run: mes => changeStatus(mes, "dnd") + }, + offline: { + als: ["oflajn", "neviditelnej"], + run: mes => changeStatus(mes, "invisible") + }, + + hraj: (mes, co) => changeActivity(mes, ActivityType.Playing, co), + sleduj: (mes, co) => changeActivity(mes, ActivityType.Watching, co), + poslouchej: (mes, co) => changeActivity(mes, ActivityType.Listening, co), + soutez: (mes, vcem) => changeActivity(mes, ActivityType.Competing, vcem), + nedelej: mes => changeActivity(mes), + + vtip: { + als: ["ftip"], + run: () => choose(ftipy) + }, + + kam: () => choose(["na šroťák", "na vrakoviště", "na smetiště", "do kontejneru", "na skládku", "do kriminálu", "pod most", "do sběru", "do hospody", "do najt klubu", "na folmavu"]), + + je: { + cd: 1800, + arg: "kdo/co", + run: () => rand(2) ? "jo je" : "ne neni" + }, + + ma: { + arg: "kdo/co", + run: () => rand(2) ? "jo ma" : "ne nema" + }, + + nazor: { + arg: "koho/co", + run: (_, arg) => rand(2) ? `mam rad ${arg}` : `${arg} je picovina` + }, + + si: { + als: ["jsi"], + run: (_, co) => { + const corict = co.replace(/\?/g, ""); + return rand(2) ? `jo sem ${corict}` : `ne nejsem ${corict}`; + } + }, + + mas: (_, co) => { + const corict = co.replace(/\?/g, ""); + return rand(2) ? `jo mam ${corict}` : `ne nemam ${corict}`; + }, + + jakmoc: { + cd: 1800, + run: (_, co) => `${co} na ${rand(101)}%` + }, + + + jakmoc0: { + cd: 1800, + run: (_, co) => `${co} na ${rand(1001)}‰` + }, + + uz: { + als: ["uz?"], + run: () => choose(["ne", "jeste ne", "jiz brzy", "za chvili", "vubec", "nikdy", "za dlouho", "za 5 let", "zejtra", "davno", "jo", "mozna"]) + }, + + vyber: { + arg: "co (odděleno čárkami nebo \"|\")", + run: (_, arg) => { + if (!arg.length) return "co vole"; + const moznosti = arg.split(arg.indexOf("|") > -1 ? "|" : ",").filter(m => m.length); + return choose(moznosti) || "kokot"; + } + }, + + fight: { + als: ["figh", "fajt"], + run: (mes, skym) => { + if (!ping.test(skym)) return "tak si kokot ti kokote"; + + const vyherce = Math.random() < 0.5 ? mes.author : skym; + return `tento figh vyhrál: ${vyherce}!`; + } + } + } +}; + +module.exports = exp; diff --git a/src/modules/custom.ts b/src/modules/custom.ts index c69e302..6cc37c7 100644 --- a/src/modules/custom.ts +++ b/src/modules/custom.ts @@ -17,7 +17,7 @@ function spojit() { for (const komand in customKomandy) { cKomandyAsKomand[komand] = { run: customKomandy[komand].text }; - cKomandyForExport.push({ name: komand }); + cKomandyForExport.push({ name: komand, custom: true }); } client.komandy = { ...cKomandyAsKomand, ...zakladniKomandy }; diff --git a/src/modules/komArgs.ts b/src/modules/komArgs.ts deleted file mode 100644 index c2cb802..0000000 --- a/src/modules/komArgs.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Komandy, který pošlou jenom celArgs a random hovno -import { ChannelType, Message } from "discord.js"; -import { emouty } from "../utils/emotes"; -import { Modul } from "../utils/types"; - -const delAndReturn = (mes: Message, co: string) => { - if (mes.channel.type != ChannelType.DM) mes.delete(); - return co; -}; - -const exp: Modul = { - more_komandy: { - - rekni: (mes, co) => { - if (mes.author.bot) return "ne"; - return delAndReturn(mes, co || `co mam jako rict ${mes.author}`); - }, - - clap: (mes, text) => { - return delAndReturn(mes, `${text} ${emouty.clap}`); - }, - - clap2: (mes, text) => { - return delAndReturn(mes, `${emouty.clap2} ${text}`); - }, - - voliz: (mes, co) => { - return delAndReturn(mes, `${emouty.lickL}${co}${emouty.lickR}`); - }, - - pozdrav: (_, koho) => `zdravim ${koho}`, - - zhejti: (_, koho) => `${koho} je pycovina zasrana vimrdana`, - - uraz: (_, koho) => `${koho} , u suck` - } -}; - -module.exports = exp; diff --git a/src/modules/komComplex.ts b/src/modules/komComplex.ts index 76b946f..206ac6a 100644 --- a/src/modules/komComplex.ts +++ b/src/modules/komComplex.ts @@ -1,58 +1,13 @@ -// Komandy, který buď nějakým způsobem mění funkci nebo "vzhled" bota -// nebo donutí bota něco udělat (odeslání zprávy nebo smazání originální zprávy se nepočítá) +// Komandy, co maj víc než "pár" řádek, a který si nezaslouží vlastní soubor -import { ActivityType, ChannelType, Message, MessageReaction, PresenceStatusData } from "discord.js"; +import { ChannelType, Message, MessageReaction } from "discord.js"; import { emouty } from "../utils/emotes"; import { Modul, SRecord } from "../utils/types"; import { formatter, ping } from "../utils/utils"; -const changeStatus = (mes: Message, status: PresenceStatusData) => { - mes.client.user?.setStatus(status); - return "ano pane"; -}; - -const changeActivity = (mes: Message, activity: Exclude | undefined = undefined, txt: string = "") => { - mes.client.user?.setActivity(txt, { type: activity }); - mes.react(emouty.d3k); - return "ano pane"; -}; - const exp: Modul = { more_komandy: { - online: { - als: ["onlajn", "zelenej"], - run: mes => changeStatus(mes, "online") - }, - idle: { - als: ["zlutej", "afk", "idle", "nepritomnej"], - run: mes => changeStatus(mes, "idle") - }, - dnd: { - als: ["nerusit", "cervenej"], - run: mes => changeStatus(mes, "dnd") - }, - offline: { - als: ["oflajn", "neviditelnej"], - run: mes => changeStatus(mes, "invisible") - }, - - hraj: (mes, co) => changeActivity(mes, ActivityType.Playing, co), - sleduj: (mes, co) => changeActivity(mes, ActivityType.Watching, co), - poslouchej: (mes, co) => changeActivity(mes, ActivityType.Listening, co), - soutez: (mes, vcem) => changeActivity(mes, ActivityType.Competing, vcem), - nedelej: mes => changeActivity(mes), - - fight: { - als: ["figh", "fajt"], - run: (mes, skym) => { - if (!ping.test(skym)) return "tak si kokot ti kokote"; - - const vyherce = Math.random() < 0.5 ? mes.author : skym; - return `tento figh vyhrál: ${vyherce}!`; - } - }, - status: (mes, koho) => { if (!ping.test(koho)) return "tak si kokot ti kokote"; diff --git a/src/modules/komRNG.ts b/src/modules/komRNG.ts deleted file mode 100644 index 2200391..0000000 --- a/src/modules/komRNG.ts +++ /dev/null @@ -1,78 +0,0 @@ -// Komandy, který jenom pošlou random hovno a jsou nějakým způsobem ovlivněný RNG - -import { Modul } from "../utils/types"; -import { rand } from "../utils/utils"; - -const ftipy: string[] = require("../../res/ftipy.json"); -const mista = ["na šroťák", "na vrakoviště", "na smetiště", "do kontejneru", "na skládku", "do kriminálu", "pod most", "do sběru", "do hospody", "do najt klubu", "na folmavu"]; -const uz = ["ne", "jeste ne", "jiz brzy", "za chvili", "vubec", "nikdy", "za dlouho", "za 5 let", "zejtra", "davno", "jo", "mozna"]; - -const choose = (arr: string[]) => arr[rand(arr.length)]; - -const exp: Modul = { - more_komandy: { - - vtip: { - als: ["ftip"], - run: () => choose(ftipy) - }, - - kam: () => choose(mista), - - je: { - cd: 1800, - arg: "kdo/co", - run: () => rand(2) ? "jo je" : "ne neni" - }, - - ma: { - arg: "kdo/co", - run: () => rand(2) ? "jo ma" : "ne nema" - }, - - nazor: { - arg: "koho/co", - run: (_, arg) => rand(2) ? `mam rad ${arg}` : `${arg} je picovina` - }, - - si: { - als: ["jsi"], - run: (_, co) => { - const corict = co.replace(/\?/g, ""); - return rand(2) ? `jo sem ${corict}` : `ne nejsem ${corict}`; - } - }, - - mas: (_, co) => { - const corict = co.replace(/\?/g, ""); - return rand(2) ? `jo mam ${corict}` : `ne nemam ${corict}`; - }, - - jakmoc: { - cd: 1800, - run: (_, co) => `${co} na ${rand(101)}%` - }, - - - jakmoc0: { - cd: 1800, - run: (_, co) => `${co} na ${rand(1001)}‰` - }, - - uz: { - als: ["uz?"], - run: () => choose(uz) - }, - - vyber: { - arg: "co (odděleno čárkami nebo \"|\")", - run: (_, arg) => { - if (!arg.length) return "co vole"; - const moznosti = arg.split(arg.indexOf("|") > -1 ? "|" : ",").filter(m => m.length); - return choose(moznosti) || "kokot"; - } - } - } -}; - -module.exports = exp; diff --git a/src/modules/komStatic.ts b/src/modules/komStatic.ts deleted file mode 100644 index 637e837..0000000 --- a/src/modules/komStatic.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Sekce pro komandy, který jenom pošlou nějaký hovno bez a nevyžadují argumenty - -import { emouty } from "../utils/emotes"; -import { Modul } from "../utils/types"; -import { formatCas } from "../utils/utils"; - -const pomoc: [string[], Record] = require("../../res/pomoc.json"); - -const exp: Modul = { - more_komandy: { - - vole: "coe voe more gadzo", - - kobel: "kde?", - - ano: { - als: ["jo", "ne"], - run: "ok" - }, - - rekt: "**ouuuuuuuuuuuuuuuuuuuuu**", - - omegasmart: "<:DENIM3K_OMEGASMART1:638103812892131328><:DENIM3K_OMEGASMART2:638104266195861514><:DENIM3K_OMEGASMART3:638104266178822155>\n<:DENIM3K_OMEGASMART4:638104266246062180><:DENIM3K_OMEGASMART5:638104266241867787><:DENIM3K_OMEGASMART6:638104265889546241>\n<:DENIM3K_OMEGASMART7:638104266267033610><:DENIM3K_OMEGASMART8:638104266271096882><:DENIM3K_OMEGASMART9:638104266258513960>", - - lag: "protoze to spousti na tich stravberi", - - triggered: "toto me trickeruje", - - slak: "te natahne\nhttps://tenor.com/view/tired-done-imdone-afterschool-school-gif-5682065", - - pomoc: pomoc[0].join("\n"), - - pomoc2: () => { return { embeds: [pomoc[1]] }; }, - - pomoc3: `${emouty.lukiw} :point_right: https://denim3001.deadfish.cz/morepomoc`, - - verze: () => `${require("../../package.json").version}\nčenžlog mas tady https://denim3001.deadfish.cz/morehovna`, - - navrh: "tadi mas prostor https://navrhy.denim3001.deadfish.cz/", - - uptime: () => `uz jedu ${formatCas(Math.round(globalThis.performance.now() / 1000))}` - } -}; - -module.exports = exp; diff --git a/src/modules/novaOrdinacka.ts b/src/modules/novaOrdinacka.ts deleted file mode 100644 index d1c9e0e..0000000 --- a/src/modules/novaOrdinacka.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Client, TextChannel } from "discord.js"; -import fetch from "node-fetch"; -import { emouty } from "../utils/emotes"; -import { Modul } from "../utils/types"; -import { log } from "../utils/utils"; - -let posledniDatum = ""; -let client: Client; - -function naplanovat(): void; -function naplanovat(jesteNeska: true): void; -function naplanovat(jesteNeska?: true) { - const novyCas = new Date(); - const den = novyCas.getDay(); - - if (jesteNeska && den == 4) return hendelieren(); - - novyCas.setDate(novyCas.getDate() + ((den < 4 ? 4 : 11) - den)); - novyCas.setHours(15); - novyCas.setMinutes(0); - setTimeout(hendelieren, Number(novyCas) - Number(new Date())); -} - -const padNula = (n: number) => n > 9 ? n : `0${n}`; - -function hendelieren() { - const base = "https://sktorrent.eu/torrent/"; - fetch(`${base}torrents_v2.php?search=ordinace`) - .then(r => r.text()) - .then(txt => { - const tabule = txt.match(/(?.+)<\/table>/is); - if (!tabule) return log(new Error("nenašel jsem tabuleho")); - - const detaily = tabule.groups!.kontent.match(/\d\d\/\d\d\/\d{4})/is); - const datum = detaily!.groups!.datum; - - if (posledniDatum == "") { - const d = new Date(); - if (`${padNula(d.getDate())}/${padNula(d.getMonth() + 1)}/${d.getFullYear()}` == datum) { - return naplanovat(); - } - - posledniDatum = datum; - return setTimeout(hendelieren, 18e4); - } - - if (posledniDatum == datum) return setTimeout(hendelieren, 18e4); - - (client.channels.cache.get("555779161067749448") as TextChannel).send(`<@&591306633196339261> vyšla nová vordinačka ${emouty.lajk}\n${base}download.php?${detaily?.groups?.odkaz}`); - naplanovat(); - return; - }); -} - -const exp: Modul = { - - // on_ready: () => { - // client = module.exports.client; - - // naplanovat(true); - // } -}; - -module.exports = exp; diff --git a/src/modules/onReady.ts b/src/modules/onReady.ts deleted file mode 100644 index bbc921e..0000000 --- a/src/modules/onReady.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Až se bot načte tak to napíše do konzole a jestli pošel, tak to oznámí adminům - -import { Client } from "discord.js"; -import { Modul } from "../utils/types"; -import { adminLog, log } from "../utils/utils"; - -const exp: Modul = { - on_ready: async () => { - log("A jedeš!"); - if (process.argv.length < 4) return; - const client: Client = module.exports.client; - adminLog(client, "pošel jsem"); - } -}; - -module.exports = exp; diff --git a/src/modules/zbytek.ts b/src/modules/zbytek.ts index 7e9237d..83a17fe 100644 --- a/src/modules/zbytek.ts +++ b/src/modules/zbytek.ts @@ -5,7 +5,7 @@ import { Client, Message, Presence, TextChannel, User } from "discord.js"; import { createServer } from "http"; import { Modul } from "../utils/types"; import fetch from "node-fetch"; -import { formatCas, log, sendDM } from "../utils/utils"; +import { adminLog, formatCas, log, sendDM } from "../utils/utils"; import { emouty } from "../utils/emotes"; const zpravy = new Map(); @@ -83,6 +83,10 @@ const exp: Modul = { // Nastavení clienta client = module.exports.client; + // OG onReady + log("A jedeš!"); + if (process.argv.length >= 4) adminLog(client, "pošel jsem"); + // Server na navrhy createServer((req, res) => { res.statusCode = 400; diff --git a/src/utils/types.ts b/src/utils/types.ts index 1d1f203..ae5ca7b 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -82,6 +82,7 @@ export interface MuzikaFace { export type KomandNaExport = { name: string; + custom?: true; } & BaseKomandProps; export interface JoinHovna {