Rewrite of module run call signature

+ jakmoc0 finally with promile
This commit is contained in:
Histmy 2021-09-29 20:36:48 +02:00
parent 7141da4c58
commit 370caa08d8
9 changed files with 41 additions and 39 deletions

View File

@ -94,7 +94,7 @@ client.on("messageCreate", async mes => {
const akce = cmd.run;
if (typeof akce === "string") return void mes.channel.send(akce);
const result = await akce(celArgs, mes);
const result = await akce(mes, celArgs);
if (result && !(result instanceof Promise)) mes.channel.send(result);
});

View File

@ -5,32 +5,32 @@ import { emouty } from "../utils/emotes";
module.exports = {
more_komandy: {
rekni: (arg: string, mes: Message) => {
rekni: (mes: Message, arg: string) => {
if (mes.author.bot) return "ne";
const corict = arg ?? "co mam jako rict";
mes.delete();
return corict;
},
clap: (arg: string, mes: Message) => {
clap: (mes: Message, arg: string) => {
mes.delete();
return `${arg} ${emouty.clap}`;
},
clap2: (arg: string, mes: Message) => {
clap2: (mes: Message, arg: string) => {
mes.delete();
return `${emouty.clap2} ${arg}`;
},
voliz: (arg: string, mes: Message) => {
voliz: (mes: Message, arg: string) => {
mes.delete();
return `${emouty.lickL}${arg}${emouty.lickR}`;
},
pozdrav: (arg: string) => `zdravim ${arg}`,
pozdrav: (_: any, arg: string) => `zdravim ${arg}`,
zhejti: (arg: string) => `${arg} je pycovina zasrana vimrdana`,
zhejti: (_: any, arg: string) => `${arg} je pycovina zasrana vimrdana`,
uraz: (arg: string) => `${arg} , u suck`
uraz: (_: any, arg: string) => `${arg} , u suck`
}
};

View File

@ -22,30 +22,30 @@ module.exports = {
online: {
als: ["onlajn", "zelenej"],
run: (_: any, mes: Message) => changeStatus(mes, "online")
run: (mes: Message) => changeStatus(mes, "online")
},
idle: {
als: ["zlutej", "afk", "idle", "nepritomnej"],
run: (_: any, mes: Message) => changeStatus(mes, "idle")
run: (mes: Message) => changeStatus(mes, "idle")
},
dnd: {
als: ["nerusit", "cervenej"],
run: (_: any, mes: Message) => changeStatus(mes, "dnd")
run: (mes: Message) => changeStatus(mes, "dnd")
},
offline: {
als: ["oflajn", "neviditelnej"],
run: (_: any, mes: Message) => changeStatus(mes, "invisible")
run: (mes: Message) => changeStatus(mes, "invisible")
},
hraj: (arg: string, mes: Message) => changeActivity(mes, "PLAYING", arg),
sleduj: (arg: string, mes: Message) => changeActivity(mes, "WATCHING", arg),
poslouchej: (arg: string, mes: Message) => changeActivity(mes, "LISTENING", arg),
soutez: (arg: string, mes: Message) => changeActivity(mes, "COMPETING", arg),
nedelej: (_: any, mes: Message) => changeActivity(mes),
hraj: (mes: Message, arg: string) => changeActivity(mes, "PLAYING", arg),
sleduj: (mes: Message, arg: string) => changeActivity(mes, "WATCHING", arg),
poslouchej: (mes: Message, arg: string) => changeActivity(mes, "LISTENING", arg),
soutez: (mes: Message, arg: string) => changeActivity(mes, "COMPETING", arg),
nedelej: (mes: Message) => changeActivity(mes),
fight: {
als: ["figh", "fajt"],
run: (arg: string, mes: Message) => {
run: (mes: Message, arg: string) => {
if (!ping.test(arg)) return "tak si kokot ti kokote";
const vyherce = Math.random() < 0.5 ? mes.author : arg;
@ -53,7 +53,7 @@ module.exports = {
}
},
status: (arg: string, mes: Message) => {
status: (mes: Message, arg: string) => {
if (!ping.test(arg)) return "tak si kokot ti kokote";
const uzivatel = mes.mentions.members!.first()!;
@ -80,7 +80,7 @@ module.exports = {
zareaguj: {
als: ["react"],
run: async (arg: string, mes: Message) => {
run: async (mes: Message, arg: string) => {
const emouty = arg.match(/<a?:\w{1,32}:\d+>/g);
if (!emouty) return "retard";
@ -97,7 +97,7 @@ module.exports = {
}
},
odpocitej: (_: any, mes: Message) => {
odpocitej: (mes: Message) => {
const randomshit = (mes: Message, argument: string[]) => {
mes.edit(argument[0]);
argument.splice(0, 1);

View File

@ -25,30 +25,30 @@ module.exports = {
ma: () => rand(2) ? "jo ma" : "ne nema",
nazor: (arg: string) => rand(2) ? `mam rad ${arg}` : `${arg} je picovina`,
nazor: (_: any, arg: string) => rand(2) ? `mam rad ${arg}` : `${arg} je picovina`,
si: {
als: ["jsi"],
run: (arg: string) => {
run: (_: any, arg: string) => {
const corict = arg.replace(/\?/g, "");
return rand(2) ? `jo sem ${corict}` : `ne nejsem ${corict}`;
}
},
mas: (arg: string) => {
mas: (_: any, arg: string) => {
const corict = arg.replace(/\?/g, "");
return rand(2) ? `jo mam ${corict}` : `ne nemam ${corict}`;
},
jakmoc: {
cd: 1800,
run: (arg: string) => `${arg} na ${rand(101)}%`
run: (_: any, arg: string) => `${arg} na ${rand(101)}%`
},
jakmoc0: {
cd: 1800,
run: (arg: string) => `${arg} na ${rand(1001)}%`
run: (_: any, arg: string) => `${arg} na ${rand(1001)}`
},
uz: {
@ -56,7 +56,7 @@ module.exports = {
run: () => choose(uz)
},
vyber: (arg: string) => {
vyber: (_: any, arg: string) => {
if (!arg.length) return "co vole";
const moznosti = arg.split(arg.indexOf("|") > -1 ? "|" : ",").filter(m => m.length);
return choose(moznosti) || "kokot";

View File

@ -6,7 +6,7 @@ import { joinVoice, play } from "../utils/utils";
module.exports = {
more_komandy: {
zahraj: async (url: string, mes: Message) => {
zahraj: async (mes: Message, url: string) => {
if (!ytdl.validateURL(url)) return "tuto neni validni youtube url a to je zatim jedini co hodlam hrat";
const kanel = mes.member?.voice.channel;
if (!kanel) return "nejsi ve vojsu ty kkt";

View File

@ -60,7 +60,7 @@ module.exports = {
spinkacek: {
als: ["spink", "spoink", "spinkake", "spoinkacek", "gn", "<:spinkacek:761652251966046208>", "<:gn:887124590583746590>"],
run: async (_: any, mes: Message) => {
run: async (mes: Message) => {
if (mes.author.bot) return `až někdy${emouty.kapp}`;
if (await handleSpink("spinkacek", mes.member!, mes.guild!)) {
mes.react(emouty.spinkacek);
@ -76,7 +76,7 @@ module.exports = {
vstavacek: {
als: ["vstavcacek", "gm"],
run: async (_: any, mes: Message) => {
run: async (mes: Message) => {
if (mes.author.bot) return emouty.sjeta;
const odpoved = await handleSpink("vstavacek", mes.member!, mes.guild!);
@ -93,7 +93,7 @@ module.exports = {
}
},
pgn: (kdy: string, mes: Message) => {
pgn: (mes: Message, kdy: string) => {
if (mes.author.bot) return emouty.sjeta;
const ted = new Date();

View File

@ -60,11 +60,11 @@ const vytahnout = (member: GuildMember, patro: number) => {
module.exports = {
more_komandy: {
wojs: (_: any, mes: Message) => `vojs se pise s normalnim v ti kriple ${mes.author}`,
wojs: (mes: Message) => `vojs se pise s normalnim v ti kriple ${mes.author}`,
vojs: {
cd: 1800,
run: (arg: string, mes: Message) => {
run: (mes: Message, arg: string) => {
const channel = mes.member?.voice.channel;
if (!channel) return `di si tam sam ne ty gadzo ${mes.author}`;
@ -89,7 +89,7 @@ module.exports = {
vypadni: {
als: ["odejdi", "disconnect", "leave", "odpoj", "votpoj", "vodpoj", "vodprejskni", "tahni"],
run: (_: any, mes: Message) => {
run: (mes: Message) => {
const vojs = getVoiceConnection(mes.guildId!);
if (!vojs) return 'nejsem ve vojsu';
@ -100,7 +100,7 @@ module.exports = {
vytah: {
als: ["vitah"],
run: (arg: string, mes: Message) => {
run: (mes: Message, arg: string) => {
if (!mes.member?.voice.channel) return `nejsi ve vojsu ty gadzo ${mes.author}`;
if (!arg) return `napis do jakiho patra ${mes.author}`;
@ -110,7 +110,7 @@ module.exports = {
krkacek: {
als: ["krk", "grg", "grgnisi", "krknisi", "grgacek"],
run: async (_: any, mes: Message) => {
run: async (mes: Message) => {
const channel = mes.member?.voice.channel;
if (!channel) return "***grrrrrrrrg***";
@ -122,7 +122,7 @@ module.exports = {
cas: {
cd: 5,
run: async (_: any, mes: Message) => {
run: async (mes: Message) => {
const date = new Date();
const h = date.getHours();
const m = date.getMinutes();

View File

@ -10,7 +10,7 @@ let spim = false;
module.exports = {
more_komandy: {
debug_log: (arg: string) => {
debug_log: (_: any, arg: string) => {
console.log("log: ", arg);
return "je to v konzoli";
},

View File

@ -1,6 +1,8 @@
import { Client, ClientPresenceStatusData, Message, MessageOptions, User } from "discord.js";
type RunFunkce = (argumenty: string, message: Message) => undefined | string | Promise<string | MessageOptions | undefined>;
type OutputRunFunkce = string | MessageOptions | undefined;
type RunFunkce = (message: Message, argumenty: string) => OutputRunFunkce | Promise<OutputRunFunkce>;
interface KomandRaw {
als?: string[];