← 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 https = require("https");

module.exports = {
 config: {
 name: "help",
 aliases: ["menu", "commands"],
 version: "5.0",
 author: "AKASH",
 shortDescription: "Show all commands",
 longDescription: "Show all commands in fancy font with boxes",
 category: "system",
 guide: "{pn}help [command name]"
 },

 onStart: async function({ message, args, prefix }) {
 const allCommands = global.GoatBot.commands;
 const categories = {};

 // Command font (๐€๐€๐€๐€๐๐ style)
 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 (๐š‚๐šˆ๐š‚๐šƒ๐™ด๐™ผ style) for ALL categories
 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:"๐š‰",
 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";

 // Categorize commands
 for (const [name, cmd] of allCommands) {
 const cat = cleanCategoryName(cmd.config.category);
 if (!categories[cat]) categories[cat] = [];
 categories[cat].push(name);
 }

 // Format commands **inside the box**
 const formatCommandsBox = (cmds) =>
 cmds.sort().map(c => `โ”‚ โ”‚ โŽ™ ${fancyFont(c)}`).join("\n");

 // Build message
 let msg = `โ”‚\nโ”‚ ${fancyFont("COMMANDS MENU")}\nโ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n`;
 msg += `โ”‚ ${fancyFont("PREFIX")} : ${prefix}\n`;
 msg += `โ”‚ ${fancyFont("TOTAL")} : ${allCommands.size}\n`;
 msg += `โ”‚ ${fancyFont("AUTHOR")} : ไบ—โ€ข๐˜”๐˜ˆ๐˜”๐˜œ๐˜•โœฟแญ„\nโ”‚\n`;

 for (const cat of Object.keys(categories)) {
 msg += `โ”‚ โ”Œโ”€ ${categoryFont(cat.toUpperCase())} โ”€โ”\n`;
 msg += formatCommandsBox(categories[cat]) + "\n";
 msg += `โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜\nโ”‚\n`;
 }

 msg += `โ”‚ ๐”๐’๐„ : ${prefix}help <command>\nโ”‚`;

 // GIFs array
 const gifURLs = [
 "https://i.imgur.com/HJpCU1g.mp4",
 "https://i.imgur.com/RVUlRqD.mp4",
 "https://i.imgur.com/AnivRhA.mp4"
 ];
 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)
 });
 }
};

// Download GIF function
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(new Error(`Failed to download '${url}' (${res.statusCode})`));
 }
 res.pipe(file);
 file.on("finish", () => file.close(resolve));
 }).on("error", (err) => {
 fs.unlink(dest, () => {});
 reject(err);
 });
 });
 }

View raw file