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); } } };