goat
command
help
Show all commands
0
views
0
likes
0
installs
Aliases: menu, commands
raw source
const fs = require("fs-extra");
const path = require("path");
module.exports = {
config: {
name: "help",
aliases: ["menu", "commands"],
version: "1.0.0",
author: "Mohammad Maruf",
shortDescription: "Show all commands",
longDescription: "Show all available commands in a clean menu.",
category: "chat",
guide: {
en: "{pn}help [command name]"
}
},
onStart: async function ({ message, args, prefix }) {
const allCommands = global.GoatBot.commands;
const fancyFont = (str) => {
const map = {
A: "๐", B: "๐", C: "๐", D: "๐", E: "๐",
F: "๐
", G: "๐", H: "๐", I: "๐", J: "๐",
K: "๐", L: "๐", M: "๐", N: "๐", O: "๐",
P: "๐", Q: "๐", R: "๐", S: "๐", T: "๐",
U: "๐", V: "๐", W: "๐", X: "๐", Y: "๐",
Z: "๐",
a: "๐", b: "๐", c: "๐", d: "๐", e: "๐",
f: "๐", g: "๐ ", h: "๐ก", i: "๐ข", j: "๐ฃ",
k: "๐ค", l: "๐ฅ", m: "๐ฆ", n: "๐ง", o: "๐จ",
p: "๐ฉ", q: "๐ช", r: "๐ซ", s: "๐ฌ", t: "๐ญ",
u: "๐ฎ", v: "๐ฏ", w: "๐ฐ", x: "๐ฑ", y: "๐ฒ",
z: "๐ณ"
};
return [...String(str)]
.map(char => map[char] || char)
.join("");
};
const categoryFont = (str) => {
const map = {
A: "๐ฐ", B: "๐ฑ", C: "๐ฒ", D: "๐ณ", E: "๐ด",
F: "๐ต", G: "๐ถ", H: "๐ท", I: "๐ธ", J: "๐น",
K: "๐บ", L: "๐ป", M: "๐ผ", N: "๐ฝ", O: "๐พ",
P: "๐ฟ", Q: "๐", R: "๐", S: "๐", T: "๐",
U: "๐", V: "๐
", W: "๐", X: "๐", Y: "๐",
Z: "๐",
a: "๐", b: "๐", c: "๐", d: "๐", e: "๐",
f: "๐", g: "๐", h: "๐", i: "๐", j: "๐",
k: "๐", l: "๐", m: "๐", n: "๐", o: "๐",
p: "๐", q: "๐", r: "๐", s: "๐", t: "๐",
u: "๐", v: "๐", w: "๐ ", x: "๐ก", y: "๐ข",
z: "๐ฃ"
};
return [...String(str)]
.map(char => map[char] || char)
.join("");
};
const cleanCategoryName = (text) => {
if (!text) return "others";
return String(text)
.trim()
.toLowerCase();
};
if (args[0]) {
const cmdName = String(args[0]).toLowerCase();
const cmd =
allCommands.get(cmdName) ||
[...allCommands.values()].find(command =>
Array.isArray(command.config?.aliases) &&
command.config.aliases.some(
alias =>
String(alias).toLowerCase() === cmdName
)
);
if (!cmd) {
return message.reply(
`โ ${fancyFont("Command")} "${cmdName}" ${fancyFont("not found!")}`
);
}
const config = cmd.config || {};
const description =
typeof config.longDescription === "object"
? config.longDescription.en ||
config.shortDescription ||
"No description"
: config.longDescription ||
config.shortDescription ||
"No description";
let guide =
config.guide ||
`${prefix}${config.name}`;
if (typeof guide === "object") {
guide =
guide.en ||
`${prefix}${config.name}`;
}
guide = String(guide).replace(
/\{pn\}/g,
`${prefix}${config.name}`
);
const infoMsg =
`โญโโโโโโโโโโโโโโโโโโโฎ
โ โฆ ${categoryFont("COMMAND INFO")} โฆ
โฐโโโโโโโโโโโโโโโโโโโฏ
โญโใ ${fancyFont("NAME")} ใ
โ โถ ${fancyFont(config.name || "Unknown")}
โฐโโโโโโโโโโโโโโโโโโโฏ
โญโใ ${fancyFont("CATEGORY")} ใ
โ โถ ${categoryFont(
(config.category || "Others").toUpperCase()
)}
โฐโโโโโโโโโโโโโโโโโโโฏ
โญโใ ${fancyFont("VERSION")} ใ
โ โถ ${fancyFont(config.version || "1.0.0")}
โฐโโโโโโโโโโโโโโโโโโโฏ
โญโใ ${fancyFont("AUTHOR")} ใ
โ โถ ${fancyFont(config.author || "Unknown")}
โฐโโโโโโโโโโโโโโโโโโโฏ
โญโใ ${fancyFont("DESCRIPTION")} ใ
โ โถ ${description}
โฐโโโโโโโโโโโโโโโโโโโฏ
โญโใ ${fancyFont("USAGE")} ใ
โ โถ ${guide}
โฐโโโโโโโโโโโโโโโโโโโฏ`;
return message.reply(infoMsg);
}
const categories = {};
for (const [name, command] of allCommands) {
if (!command || !command.config) {
continue;
}
const category = cleanCategoryName(
command.config.category
);
if (!categories[category]) {
categories[category] = [];
}
if (!categories[category].includes(name)) {
categories[category].push(name);
}
}
const formatCommands = (commands) => {
return commands
.sort((a, b) =>
String(a).localeCompare(String(b))
)
.map((name, index) => {
const number = String(index + 1).padStart(2, "0");
return `โ ${number} โถ ${fancyFont(name)}`;
})
.join("\n");
};
const categoryOrder = [
"18+",
"admin",
"ai",
"ai-image",
"anime",
"birthday",
"box",
"box chat",
"config",
"contacts",
"custom",
"economy",
"events",
"fun",
"game",
"group",
"image",
"info",
"information",
"love",
"media",
"music",
"other",
"owner",
"rank",
"software",
"supportgc",
"system",
"tools",
"utility",
"wiki"
];
const sortedCategories =
Object.keys(categories).sort((a, b) => {
const indexA = categoryOrder.indexOf(a);
const indexB = categoryOrder.indexOf(b);
if (indexA === -1 && indexB === -1) {
return a.localeCompare(b);
}
if (indexA === -1) {
return 1;
}
if (indexB === -1) {
return -1;
}
return indexA - indexB;
});
let msg =
`โญโโโโโโโโโโโโโโโโโโโฎ
โ โฆ ${fancyFont("HELP")} โฆ
โฐโโโโโโโโโโโโโโโโโโโฏ
โญโใ ${categoryFont("PREFIX")} ใ
โ โก โถ ${prefix}
โ โก ${categoryFont("TOTAL")} โถ ${allCommands.size}
โฐโโโโโโโโโโโโโโโโโโโฏ
`;
for (const category of sortedCategories) {
const title = categoryFont(
category.toUpperCase()
);
msg +=
`โญโใ ${title} ใ
${formatCommands(categories[category])}
โฐโโโโโโโโโโโโโโโโโโโฏ
`;
}
msg +=
`โญโใ ${categoryFont("HOW TO USE")} ใ
โ โก โถ ${prefix}<command>
โ
โ โฆ ${fancyFont("Example")}
โ โถ ${prefix}owner
โฐโโโโโโโโโโโโโโโโโโโฏ
โก ${fancyFont("Mohammad Maruf")} โก`;
return message.reply(msg);
}
};