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"); const axios = require("axios"); module.exports = { config: { name: "help", aliases: ["menu", "commands"], version: "3.0.0", author: "๐๐๐๐ฎ๐
", 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 IMAGE_URL = "https://i.ibb.co/b5LhvTXL/d81b6049057a.jpg"; 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) { const errorMsg = `โญโโโโใ ${categoryFont("ERROR")} ใโโโโโฎ\n` + `โ ${categoryFont("Command")} โ ${categoryFont(cmdName)}\n` + `โ ${categoryFont("Not Found")}\n` + `โฐโโโโโโโโโโโโโโโโโโโโโโโฏ`; return message.reply(errorMsg); } 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")} ใโโโโโฎ\n` + `โ ${categoryFont("Name")} โ ${categoryFont(config.name || "Unknown")}\n` + `โ ${categoryFont("Category")} โ ${categoryFont((config.category || "Others").toUpperCase())}\n` + `โ ${categoryFont("Version")} โ ${categoryFont(config.version || "1.0.0")}\n` + `โ ${categoryFont("Author")} โ ${categoryFont(config.author || "Unknown")}\n` + `โ ${categoryFont("About")} โ ${categoryFont(description)}\n` + `โ ${categoryFont("Usage")} โ ${categoryFont(guide)}\n` + `โฐโโโโโโโโโโโโโโโโโโโโโโโโฏ`; 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 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; }); const BOX_WIDTH = 23; const bottomLine = `โฐ${"โ".repeat(BOX_WIDTH)}โฏ`; 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 ( `โ ${categoryFont(number)} โ ` + `${categoryFont(name)}` ); }) .join("\n"); }; let msg = `โญโโโโใ โฆ ${categoryFont("COMMANDS")} โฆ ใโโโโโฎ\n` + `โ ${categoryFont("PREFIX")} โ ${categoryFont(prefix)}\n` + `โ ${categoryFont("TOTAL")} โ ${categoryFont(allCommands.size)}\n` + `${bottomLine}\n\n`; for (const category of sortedCategories) { const title = categoryFont( category.toUpperCase() ); msg += `โญโโโโใ ${title} ใ-)โฟ\n` + formatCommands(categories[category]) + `\n${bottomLine}\n\n`; } msg += `โญโโโโใ ${categoryFont("HOW TO USE")} ใ-)โฟ\n` + `โ ${categoryFont("1")} โ ${categoryFont(prefix + "owner")}\n` + `โ ${categoryFont("2")} โ ${categoryFont(prefix + "help owner")}\n` + `${bottomLine}`; try { const response = await axios({ method: "GET", url: IMAGE_URL, responseType: "stream" }); return message.reply({ body: msg, attachment: response.data }); } catch (error) { return message.reply(msg); } } };