const fs = require("fs-extra"); const path = require("path"); const axios = require("axios"); module.exports = { config: { name: "help", aliases: ["menu", "commands"], version: "7.0", author: "EfxAsif", shortDescription: "Show all commands", longDescription: "Show all commands in clean UI with random GIF/video", category: "system", guide: "{pn}help [command name]" }, onStart: async function ({ message, args, prefix }) { const allCommands = global.GoatBot.commands; // ============================== // Fancy Font // ============================== 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; }); // ============================== // Category Font // ============================== 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"; // ============================== // Specific Command Help // ============================== 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); } // ============================== // Build Categories // ============================== const categories = {}; for (const [name, cmd] of allCommands) { const cat = cleanCategoryName(cmd.config.category); if (!categories[cat]) { categories[cat] = []; } categories[cat].push(name); } // ============================== // Main Help Message // ============================== let msg = `╭─ š‚šŽšŒšŒš€ššƒš’ šŒš„šš” ā”œ Prefix : ${prefix} ā”œ Total : ${allCommands.size} ā”œ Author : EfxAsif `; 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 `; // ============================== // GIF + GOOGLE DRIVE VIDEOS // ============================== const mediaList = [ // Existing GIFs { type: "gif", url: "https://i.imgur.com/Xw6JTfn.gif", name: "help_gif_1.gif" }, { type: "gif", url: "https://i.imgur.com/mW0yjZb.gif", name: "help_gif_2.gif" }, { type: "gif", url: "https://i.imgur.com/KQBcxOV.gif", name: "help_gif_3.gif" }, // Google Drive Video 1 { type: "video", url: "https://drive.google.com/file/d/1xzRHlnlnf_QRNkI0hnTssEAlACF0t0gc/view?usp=drivesdk", id: "1xzRHlnlnf_QRNkI0hnTssEAlACF0t0gc", name: "help_video_1.mp4" }, // Google Drive Video 2 { type: "video", url: "https://drive.google.com/file/d/1G6p87ApW-5taGZ8J81QKKSjyBTPABO8S/view?usp=drivesdk", id: "1G6p87ApW-5taGZ8J81QKKSjyBTPABO8S", name: "help_video_2.mp4" } ]; // ============================== // Random Media // ============================== const randomMedia = mediaList[Math.floor(Math.random() * mediaList.length)]; // ============================== // Cache Folder // ============================== const mediaFolder = path.join(__dirname, "cache"); await fs.ensureDir(mediaFolder); const mediaPath = path.join( mediaFolder, randomMedia.name ); try { // ============================== // Download If Not Cached // ============================== if (!fs.existsSync(mediaPath)) { let downloadURL = randomMedia.url; // Convert Google Drive view URL // into direct download URL if (randomMedia.type === "video") { downloadURL = `https://drive.usercontent.google.com/download?id=${randomMedia.id}&export=download&confirm=t`; } await downloadMedia( downloadURL, mediaPath ); } // ============================== // Send Media // ============================== return message.reply({ body: msg, attachment: fs.createReadStream(mediaPath) }); } catch (error) { console.error( "[HELP MEDIA ERROR]", error.message ); // If media fails, still show help menu return message.reply( `${msg} āš ļø Media could not be loaded. Please try ${prefix}help again.` ); } } }; // ====================================== // Download Media Function // ====================================== async function downloadMedia(url, destination) { const response = await axios({ method: "GET", url: url, responseType: "stream", maxRedirects: 10, timeout: 120000, headers: { "User-Agent": "Mozilla/5.0 (Android 13; Mobile) AppleWebKit/537.36 Chrome/120 Safari/537.36" } }); if (response.status !== 200) { throw new Error( `Download failed with status ${response.status}` ); } const writer = fs.createWriteStream(destination); return new Promise((resolve, reject) => { response.data.pipe(writer); writer.on("finish", () => { writer.close(); resolve(); }); writer.on("error", (err) => { fs.unlink(destination).catch(() => {}); reject(err); }); response.data.on("error", (err) => { fs.unlink(destination).catch(() => {}); reject(err); }); }); }