oddiakritikovani komandu + fix aliasů

This commit is contained in:
det-fys 2021-08-29 01:54:34 +02:00
parent aa5573c70b
commit c243e7139e
8 changed files with 74 additions and 53 deletions

View File

@ -4,7 +4,7 @@ import { config } from "dotenv";
import { readdirSync } from "fs";
import { emouty } from "./utils/emotes";
import { Komand, ListenerFunkce, Modul } from "./utils/types";
import { formatCas } from "./utils/utils.js";
import { formatCas, oddiakritikovat } from "./utils/utils.js";
const ints = Intents.FLAGS;
const client = new Client({ intents: [ints.GUILDS, ints.GUILD_VOICE_STATES, ints.GUILD_PRESENCES, ints.GUILD_MESSAGES] });
@ -86,10 +86,11 @@ client.on("messageCreate", mes => {
if (process.env.IGNORE_MESS || spim(mes)) return;
runEvent("on_message", [mes]);
const [mes_prefix, komand, ...args] = mes.content.split(" ");
const [mes_prefix, komandSDiakritikou, ...args] = mes.content.split(" ");
if (mes_prefix.toLowerCase() !== prefix) return;
if (!komand) return void mes.channel.send("coe voe");
if (!komandSDiakritikou) return void mes.channel.send("coe voe");
const komand = oddiakritikovat(komandSDiakritikou);
const celArgs = args.join(" ");
const cmdName = aliasy[komand] ?? komand;
const cmd = komandy[cmdName];

View File

@ -22,21 +22,15 @@ module.exports = {
return `${emouty.clap2} ${arg}`;
},
voliz: {
als: ["voliž"],
run: (arg: string, mes: Message) => {
voliz: (arg: string, mes: Message) => {
mes.delete();
return `${emouty.lickL}${arg}${emouty.lickR}`;
}
},
pozdrav: (arg: string) => `zdravim ${arg}`,
zhejti: (arg: string) => `${arg} je pycovina zasrana vimrdana`,
uraz: {
als: ["uraž"],
run: (arg: string) => `${arg} , u suck`
}
uraz: (arg: string) => `${arg} , u suck`
}
};

View File

@ -25,11 +25,11 @@ module.exports = {
run: (_: any, mes: Message) => changeStatus(mes, "online")
},
idle: {
als: ["žlutej", "zlutej", "afk", "idle", "nepřítomnej", "nepritomnej"],
als: ["zlutej", "afk", "idle", "nepritomnej"],
run: (_: any, mes: Message) => changeStatus(mes, "idle")
},
dnd: {
als: ["nerusit", "nerušit", "červenej", "cervenej"],
als: ["nerusit", "cervenej"],
run: (_: any, mes: Message) => changeStatus(mes, "dnd")
},
offline: {
@ -40,10 +40,7 @@ module.exports = {
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: {
als: ["soutěž"],
run: (arg: string, mes: Message) => changeActivity(mes, "COMPETING", arg)
},
soutez: (arg: string, mes: Message) => changeActivity(mes, "COMPETING", arg),
nedelej: (_: any, mes: Message) => changeActivity(mes),
fight: {
@ -113,9 +110,7 @@ module.exports = {
mes.channel.send(":stop_button:").then(mes => randomshit(mes, [":five:", ":four:", ":three:", ":two:", ":one:", ":ok:"]));
},
pocasi: {
als: ["počasí"],
run: (_: any) => {
pocasi: () => {
const embed = {
title: "Počasí",
image: { url: "attachment://pocasi.png" }
@ -123,5 +118,4 @@ module.exports = {
return { embeds: [embed], files: ["https://util.deadfish.cz/morepocasi/v/49.4348358/12.8147250/pocasi.png"] };
}
}
}
};

View File

@ -22,15 +22,9 @@ module.exports = {
run: () => rand(2) ? "jo je" : "ne neni"
},
ma: {
als: ["má"],
run: () => rand(2) ? "jo ma" : "ne nema"
},
ma: () => rand(2) ? "jo ma" : "ne nema",
nazor: {
als: ["názor"],
run: (arg: string) => rand(2) ? `mam rad ${arg}` : `${arg} je picovina`
},
nazor: (arg: string) => rand(2) ? `mam rad ${arg}` : `${arg} je picovina`,
si: {
als: ["jsi"],
@ -40,12 +34,9 @@ module.exports = {
}
},
mas: {
als: ["máš"],
run: (arg: string) => {
mas: (arg: string) => {
const corict = arg.replace(/\?/g, "");
return rand(2) ? `jo mam ${corict}` : `ne nemam ${corict}`;
}
},
jakmoc: {
@ -60,7 +51,7 @@ module.exports = {
},
uz: {
als: ["už", "uz?", "už?"],
als: ["uz?"],
run: () => uz[rand(uz.length)]
}
}

View File

@ -5,9 +5,9 @@ const pomoc: [string[], {}] = require("../../addons/pomoc.json");
module.exports = {
more_komandy: {
vole: () => "coe voe more gadzo",
vole: "coe voe more gadzo",
kobel: () => "kde?",
kobel: "kde?",
ano: {
als: ["jo", "ne"],
@ -22,10 +22,7 @@ module.exports = {
triggered: "toto me trickeruje",
slak: {
als: ["šlak"],
run: "te natahne\nhttps://tenor.com/view/tired-done-imdone-afterschool-school-gif-5682065"
},
slak: "te natahne\nhttps://tenor.com/view/tired-done-imdone-afterschool-school-gif-5682065",
pomoc: pomoc[0].join("\n"),

View File

@ -37,7 +37,7 @@ module.exports = {
more_komandy: {
spinkacek: {
als: ["spinkáček"],
als: ["spoink", "spinkake", "spoinkacek"],
run: (_: any, mes: Message) => {
if (mes.author.bot) return `až někdy${emouty.kapp}`;
(async () => {
@ -49,7 +49,7 @@ module.exports = {
},
vstavacek: {
als: ["vstáváček"],
als: ["vstavcacek"],
run: (_: any, mes: Message) => {
if (mes.author.bot) return emouty.sjeta;
(async () => {

View File

@ -87,7 +87,7 @@ module.exports = {
},
vypadni: {
als: ["odejdi", "disconnect", "leave", "odpoj", "votpoj", "vodpoj", "vodprejskni", "tahni", "táhni"],
als: ["odejdi", "disconnect", "leave", "odpoj", "votpoj", "vodpoj", "vodprejskni", "tahni"],
run: (_: any, mes: Message) => {
const vojs = getVoiceConnection(mes.guildId!);
if (!vojs) return 'nejsem ve vojsu';
@ -98,7 +98,7 @@ module.exports = {
},
vytah: {
als: ["vitah", "výtah"],
als: ["vitah"],
run: (arg: string, mes: Message) => {
if (!mes.member?.voice.channel) return `nejsi ve vojsu ty gadzo ${mes.author}`;
if (!arg) return `napis do jakiho patra ${mes.author}`;

View File

@ -5,6 +5,50 @@ import { MuzikaFace } from "./types";
const pripojeni: Record<string, PlayerSubscription> = {};
export const oddiakritikovat = (a: string) => {
return a
.replace(/[àáâãäåæāăą]/g, "a")
.replace(/[çćĉċč]/g, "c")
.replace(/[ďđ]/g, "d")
.replace(/[èéêëðēĕėęě]/g, "e")
.replace(/[ĝğġģ]/g, "g")
.replace(/[ĥħ]/g, "h")
.replace(/[ìíîïĩīĭįı]/g, "i")
.replace(/[ĵ]/g, "j")
.replace(/[ķĸ]/g, "k")
.replace(/[ĺļľŀł]/g, "l")
.replace(/[ñńņňʼnŋ]/g, "n")
.replace(/[òóôõöøōŏőœ]/g, "o")
.replace(/[þ]/g, "p")
.replace(/[ŕŗř]/g, "r")
.replace(/[ßśŝşšſ]/g, "s")
.replace(/[ţťŧ]/g, "t")
.replace(/[ùúûüũūŭůűų]/g, "u")
.replace(/[ŵ]/g, "w")
.replace(/[ÿýŷ]/g, "y")
.replace(/[źżž]/g, "z")
.replace(/[ÀÁÂÃÄÅÆĀĂĄ]/g, "A")
.replace(/[ÇĆĈĊČ]/g, "C")
.replace(/[Ď]/g, "D")
.replace(/[ÈÉÊËÐĒĔĖĘĚ]/g, "E")
.replace(/[ĜĞĠĢ]/g, "G")
.replace(/[Ĵ]/g, "J")
.replace(/[Ķ]/g, "K")
.replace(/[ĤĦ]/g, "H")
.replace(/[ÌÍÎÏĨĪĬĮİ]/g, "I")
.replace(/[ĹĻĽĿŁ]/g, "L")
.replace(/[ÑŃŅŇŊ]/g, "N")
.replace(/[ÒÓÔÕÖØŌŎŐŒ]/g, "O")
.replace(/[Þ]/g, "P")
.replace(/[ŔŖŘ]/g, "R")
.replace(/[ŚŜŞŠ]/g, "S")
.replace(/[ŢŤŦ]/g, "T")
.replace(/[ÙÚÛÜŨŪŬŮŰŲ]/g, "U")
.replace(/[Ŵ]/g, "W")
.replace(/[ÝŶŸ]/g, "Y")
.replace(/[ŹŻŽ]/g, "Z");
}
export const formatCas = (cas: number) => {
const h = Math.floor(cas / 3600);
const m = Math.floor(cas % 3600 / 60);