commands reordering

+ help server shows custom cmds
+ removed ordinace :rip:
This commit is contained in:
Histmy 2023-06-04 20:04:01 +02:00
parent 3101454cde
commit b32fcb6be2
10 changed files with 190 additions and 291 deletions

181
src/modules/OGs.ts Normal file
View File

@ -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<string, any>] = 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<ActivityType, ActivityType.Custom> | 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;

View File

@ -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 };

View File

@ -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;

View File

@ -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<ActivityType, ActivityType.Custom> | 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";

View File

@ -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;

View File

@ -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<string, unknown>] = 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;

View File

@ -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 width="100%" class="lista">(?<kontent>.+)<\/table>/is);
if (!tabule) return log(new Error("nenašel jsem tabuleho"));
const detaily = tabule.groups!.kontent.match(/<a href="d.+?&(?<odkaz>id=.+?)".+?Pridany (?<datum>\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;

View File

@ -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;

View File

@ -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<string, number[]>();
@ -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;

View File

@ -82,6 +82,7 @@ export interface MuzikaFace {
export type KomandNaExport = {
name: string;
custom?: true;
} & BaseKomandProps;
export interface JoinHovna {