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