Async message events can now return response
& fixed vojs potichu
This commit is contained in:
parent
6369ea2720
commit
4a49094844
@ -73,7 +73,7 @@ const maKuldan = (id: string, komand: string, kuldan_komandu: number) => {
|
||||
return 0;
|
||||
};
|
||||
|
||||
client.on("messageCreate", mes => {
|
||||
client.on("messageCreate", async mes => {
|
||||
if (process.env.ignoreMess) return;
|
||||
|
||||
const [mes_prefix, komandSDiakritikou, ...args] = mes.content.split(" ");
|
||||
@ -94,7 +94,7 @@ client.on("messageCreate", mes => {
|
||||
|
||||
const akce = cmd.run;
|
||||
if (typeof akce === "string") return void mes.channel.send(akce);
|
||||
const result = akce(celArgs, mes);
|
||||
const result = await akce(celArgs, mes);
|
||||
if (typeof result == "string") mes.channel.send(result);
|
||||
});
|
||||
|
||||
|
||||
@ -80,24 +80,20 @@ module.exports = {
|
||||
|
||||
zareaguj: {
|
||||
als: ["react"],
|
||||
run: (arg: string, mes: Message) => {
|
||||
if (!arg) return "retard";
|
||||
|
||||
run: async (arg: string, mes: Message) => {
|
||||
const emouty = arg.match(/<a?:\w{1,32}:\d+>/g);
|
||||
if (!emouty) return "retard";
|
||||
|
||||
let naCo: Message;
|
||||
(async () => {
|
||||
if (mes.reference) {
|
||||
naCo = await mes.channel.messages.fetch(mes.reference.messageId!);
|
||||
} else {
|
||||
const msgs = [...mes.channel.messages.cache.values()];
|
||||
naCo = msgs[msgs.length - 2];
|
||||
}
|
||||
if (mes.reference) {
|
||||
naCo = await mes.channel.messages.fetch(mes.reference.messageId!);
|
||||
} else {
|
||||
const msgs = [...mes.channel.messages.cache.values()];
|
||||
naCo = msgs[msgs.length - 2];
|
||||
}
|
||||
|
||||
mes.delete();
|
||||
emouty.forEach(emout => naCo.react(emout));
|
||||
})();
|
||||
mes.delete();
|
||||
emouty.forEach(emout => naCo.react(emout));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -38,34 +38,30 @@ module.exports = {
|
||||
|
||||
spinkacek: {
|
||||
als: ["spink", "spoink", "spinkake", "spoinkacek", "gn"],
|
||||
run: (_: any, mes: Message) => {
|
||||
run: async (_: any, mes: Message) => {
|
||||
if (mes.author.bot) return `až někdy${emouty.kapp}`;
|
||||
(async () => {
|
||||
if (await contactSpinkServer('spinkacek', mes.author.id, mes.author.username, mes.author.avatarURL()) === "OK")
|
||||
mes.react(emouty.spinkacek);
|
||||
else mes.channel.send('nespis uz?????');
|
||||
})();
|
||||
if (await contactSpinkServer('spinkacek', mes.author.id, mes.author.username, mes.author.avatarURL()) === "OK")
|
||||
mes.react(emouty.spinkacek);
|
||||
else return 'nespis uz?????';
|
||||
}
|
||||
},
|
||||
|
||||
vstavacek: {
|
||||
als: ["vstavcacek", "gm"],
|
||||
run: (_: any, mes: Message) => {
|
||||
run: async (_: any, mes: Message) => {
|
||||
if (mes.author.bot) return emouty.sjeta;
|
||||
(async () => {
|
||||
const odpoved = await contactSpinkServer('vstavacek', mes.author.id);
|
||||
const [ok, casTxt] = odpoved.split(" ");
|
||||
const cas = Number(casTxt);
|
||||
if (ok !== "OK") return mes.channel.send("uz jsi vzhuru ty hajzle");
|
||||
const formatedCas = formatCas(cas);
|
||||
let zpr = "";
|
||||
if (cas >= 57600) zpr = "mas dat more vstavacek uz kdyz vstanes retarde";
|
||||
else if (cas >= 43200) zpr = "extrémní bídák";
|
||||
else if (cas >= 36000) zpr = "fakt bídák";
|
||||
else if (cas < 10800) zpr = "dobrej fake spink debile";
|
||||
const odpoved = await contactSpinkServer('vstavacek', mes.author.id);
|
||||
const [ok, casTxt] = odpoved.split(" ");
|
||||
const cas = Number(casTxt);
|
||||
if (ok !== "OK") return "uz jsi vzhuru ty hajzle";
|
||||
const formatedCas = formatCas(cas);
|
||||
let zpr = "";
|
||||
if (cas >= 57600) zpr = "mas dat more vstavacek uz kdyz vstanes retarde";
|
||||
else if (cas >= 43200) zpr = "extrémní bídák";
|
||||
else if (cas >= 36000) zpr = "fakt bídák";
|
||||
else if (cas < 10800) zpr = "dobrej fake spink debile";
|
||||
|
||||
mes.channel.send(`dobry rano hajzle\nspal sy ${formatedCas}\n${zpr}`);
|
||||
})();
|
||||
return `dobry rano hajzle\nspal sy ${formatedCas}\n${zpr}`;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -68,7 +68,7 @@ module.exports = {
|
||||
const channel = mes.member?.voice.channel;
|
||||
if (!channel) return `di si tam sam ne ty gadzo ${mes.author}`;
|
||||
|
||||
const nahlas = arg !== "potichu";
|
||||
const nahlas = arg.startsWith("potichu");
|
||||
if (nahlas) mes.channel.send("<@&591306633196339261> vojs");
|
||||
|
||||
joinVoice(channel)
|
||||
@ -112,7 +112,7 @@ module.exports = {
|
||||
als: ["krk", "grg", "grgnisi", "krknisi", "grgacek"],
|
||||
run: async (_: any, mes: Message) => {
|
||||
const channel = mes.member?.voice.channel;
|
||||
if (!channel) return mes.channel.send("***grrrrrrrrg***");
|
||||
if (!channel) return "***grrrrrrrrg***";
|
||||
|
||||
const { conn, prev } = await joinVoice(channel);
|
||||
await play(conn, "zvuky/grg.mp3");
|
||||
@ -145,7 +145,7 @@ module.exports = {
|
||||
const je = h > 1 && h < 5 ? "jsou" : "je";
|
||||
|
||||
const channel = mes.member?.voice.channel;
|
||||
if (!channel) return mes.channel.send(`${je} ${h} ${hod} ${m} ${min}`);
|
||||
if (!channel) return `${je} ${h} ${hod} ${m} ${min}`;
|
||||
|
||||
const zvuky: MuzikaFace[] = [{ name: `${pre}${je}.mp3`, volume: 2.5 }];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user