← back to browse
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); } } };

View raw file