komand aliasy added

This commit is contained in:
Histmy 2023-06-04 20:54:22 +02:00
parent 542130d9a3
commit 0c5f39d981

View File

@ -2,6 +2,7 @@ import { CClient, HelpServer, Komand, KomandNaExport, Modul, SRecord } from "../
import { join } from "path";
import { existsSync, readFileSync, writeFileSync } from "fs";
import { oddiakritikovat, prefix } from "../utils/utils";
import { APIEmbed } from "discord.js";
let client: CClient;
const cesta = `${join(__dirname, "../../res/")}custom`;
@ -251,6 +252,26 @@ const exp: Modul = {
save();
return "jo";
}
},
aliasy: (_, arg) => {
const name = arg.toLowerCase();
const cmdName = client.aliasy[name] ?? name;
const list: string[] = [];
for (const key in client.aliasy) {
const val = client.aliasy[key];
if (val == cmdName) list.push(key);
}
if (!list.length) return `"${name}" bud nen9 komand ani ajilas nebo nema ajilasi vubec`;
const embed: APIEmbed = {
color: 13697024,
fields: [{ name: `alijasy pro **${cmdName}**:`, value: `${list.join("\n• ")}` }]
};
return { embeds: [embed] };
}
},