const fs = require("fs-extra"); const path = require("path"); const https = require("https"); module.exports = { config: { name: "help", aliases: ["menu", "commands"], version: "6.4", author: "EryXenX", shortDescription: "Show all commands", longDescription: "Show all commands in clean UI", category: "system", guide: "{pn}help [command name]" }, onStart: async function ({ message, args, prefix }) { const allCommands = global.GoatBot.commands; const fancyFont = (str) => str.replace(/[A-Za-z]/g, (c) => { 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 map[c] || c; }); const categoryFont = (str) => str.split("").map(c => { 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:"š™" }; return map[c] || c; }).join(""); const cleanCategoryName = (text) => text ? text.toLowerCase() : "others"; if (args[0]) { const cmdName = args[0].toLowerCase(); const cmd = allCommands.get(cmdName) || [...allCommands.values()].find(c => c.config.aliases?.includes(cmdName)); if (!cmd) return message.reply( `āŒ ${fancyFont(`Command '${cmdName}' not found!`)} āž¤ Try ${prefix}help to see full list` ); const usage = typeof cmd.config.guide === "string" ? cmd.config.guide.replace("{pn}", cmd.config.name) : cmd.config.name; const infoMsg = `ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”“ 🧩 š‚šŒšƒ šˆšš…šŽ ┗━━━━━━━━━━━━━┛ ✦ Name : ${cmd.config.name} ✦ Aliases : ${cmd.config.aliases?.join(", ") || "None"} ✦ Category : ${categoryFont((cmd.config.category || "Others").toUpperCase())} ✦ Version : v${cmd.config.version || "1.0"} ✦ Author : ${cmd.config.author || "Unknown"} ✦ Usage : ${prefix}${usage} ━━━━━━━━━━━━━━━ šŸ“ ${(cmd.config.longDescription || cmd.config.shortDescription || "No description")}`; return message.reply(infoMsg); } const categories = {}; for (const [name, cmd] of allCommands) { const cat = cleanCategoryName(cmd.config.category); if (!categories[cat]) categories[cat] = []; categories[cat].push(name); } let msg = `╭─ š‚šŽšŒšŒš€ššƒš’ šŒš„šš” ā”œ Prefix : ${prefix} ā”œ Total : ${allCommands.size} ā”œ Author : Ridh `; for (const cat of Object.keys(categories).sort()) { const catTitle = categoryFont(cat.toUpperCase()); msg += `\nā”Œā”€ ${catTitle} ─┐\n`; for (const cmdName of categories[cat].sort()) { msg += `│ āŽ™ ${fancyFont(cmdName)}\n`; } msg += `ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜\n`; } msg += `\n╰─ Use: ${prefix}help `; const gifURLs = [ "https://i.imgur.com/Xw6JTfn.gif", "https://i.imgur.com/mW0yjZb.gif", "https://i.imgur.com/KQBcxOV.gif" ]; const randomGifURL = gifURLs[Math.floor(Math.random() * gifURLs.length)]; const gifFolder = path.join(__dirname, "cache"); if (!fs.existsSync(gifFolder)) fs.mkdirSync(gifFolder, { recursive: true }); const gifName = path.basename(randomGifURL); const gifPath = path.join(gifFolder, gifName); if (!fs.existsSync(gifPath)) await downloadGif(randomGifURL, gifPath); return message.reply({ body: msg, attachment: fs.createReadStream(gifPath) }); } }; function downloadGif(url, dest) { return new Promise((resolve, reject) => { const file = fs.createWriteStream(dest); https.get(url, (res) => { if (res.statusCode !== 200) { fs.unlink(dest, () => {}); return reject(); } res.pipe(file); file.on("finish", () => file.close(resolve)); }).on("error", (err) => { fs.unlink(dest, () => {}); reject(err); }); }); }