goat
command
help
Show all available commands
0
views
0
likes
0
installs
Aliases: menu, commands
raw source
const fs = require("fs-extra");
const path = require("path");
const axios = require("axios");
// ๐ฅ Put your direct mp4 video link here (e.g., https://files.catbox.moe/xxxxxx.mp4)
const HELP_VIDEO_URL = "https://files.catbox.moe/euhp0a.mp4";
module.exports = {
config: {
name: "help",
aliases: ["menu", "commands"],
version: "5.0",
author: "Protik shah",
countDown: 3,
role: 0,
shortDescription: "Show all available commands",
longDescription: "Displays a ultra-stylish, categorized list of commands with video attachment support.",
category: "system",
guide: "{pn}help [command name]"
},
onStart: async function ({ api, message, args, prefix }) {
const sendMsg = (txt) => message && typeof message.reply === "function" ? message.reply(txt) : api.sendMessage(txt, event.threadID, event.messageID);
const allCommands = global.GoatBot.commands;
const categories = {};
const emojiMap = {
ai: "๐ค", "ai-image": "๐จ", group: "๐ฅ", system: "โ๏ธ",
fun: "๐ฎ", owner: "๐", config: "๐ ๏ธ", economy: "๐ฐ",
media: "๐ฅ", "18+": "๐", tools: "๐งฐ", utility: "๐ง",
info: "โน๏ธ", image: "๐ผ๏ธ", game: "๐ฒ", admin: "๐ก๏ธ",
rank: "๐", boxchat: "๐ฌ", others: "๐"
};
const cleanCategoryName = (text) => {
if (!text) return "others";
return text
.normalize("NFKD")
.replace(/[^\w\s-]/g, "")
.replace(/\s+/g, " ")
.trim()
.toLowerCase();
};
for (const [name, cmd] of allCommands) {
const cat = cleanCategoryName(cmd.config.category);
if (!categories[cat]) categories[cat] = [];
categories[cat].push(cmd.config.name);
}
// Detailed Command Info View
if (args[0]) {
const query = args[0].toLowerCase();
const cmd =
allCommands.get(query) ||
[...allCommands.values()].find((c) => (c.config.aliases || []).includes(query));
if (!cmd) return sendMsg(`โ ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ "${query}" ๐ป๐ผ๐ ๐ณ๐ผ๐๐ป๐ฑ.`);
const {
name,
version,
author,
guide,
category,
shortDescription,
longDescription,
aliases,
role
} = cmd.config;
const desc =
typeof longDescription === "string"
? longDescription
: longDescription?.en || shortDescription?.en || shortDescription || "No description available.";
const usage =
typeof guide === "string"
? guide.replace(/{pn}/g, prefix)
: guide?.en?.replace(/{pn}/g, prefix) || `${prefix}${name}`;
const requiredRole = role !== undefined ? role : 0;
const roleText = requiredRole === 0 ? "Everyone (Member)" : requiredRole === 1 ? "Group Admin" : "Bot Admin / Owner";
return sendMsg(
`โ๏ธ ๐ฆ๐ง๐ฌ๐๐๐ฆ๐ ๐๐ข๐ ๐ ๐๐ก๐ ๐๐ก๐๐ข โ๏ธ\n` +
`โโโโโโโโโโโโโโโโโโโ\n` +
`๐ ๐ก๐ฎ๐บ๐ฒ: ${name.toUpperCase()}\n` +
`๐ท๏ธ ๐๐ฎ๐๐ฒ๐ด๐ผ๐ฟ๐: ${(category || "Uncategorized").toUpperCase()}\n` +
`๐ ๐๐ฒ๐๐ฐ๐ฟ๐ถ๐ฝ๐๐ถ๐ผ๐ป: ${desc}\n` +
`๐ ๐๐น๐ถ๐ฎ๐๐ฒ๐: ${aliases?.length ? aliases.join(", ") : "None"}\n` +
`๐ก ๐จ๐๐ฎ๐ด๐ฒ: ${usage}\n` +
`๐ ๐ฃ๐ฒ๐ฟ๐บ๐ถ๐๐๐ถ๐ผ๐ป: ${roleText}\n` +
`๐ค ๐๐๐๐ต๐ผ๐ฟ: ${author}\n` +
`๐ ๐ฉ๐ฒ๐ฟ๐๐ถ๐ผ๐ป: v${version}\n` +
`โโโโโโโโโโโโโโโโโโโ`
);
}
// Main Categorized Help Menu View
const formatCommands = (cmds) => cmds.sort().map((cmd) => `โฌ ${cmd}`);
let msg = `โก ๐๐๐๐๐๐ข ๐ ๐๐ก๐จ โก\n`;
msg += `โโโโโโโโโโโโโโโโโโโโโ\n`;
const sortedCategories = Object.keys(categories).sort();
for (const cat of sortedCategories) {
const emoji = emojiMap[cat] || "โ";
msg += `\nโญโโโโฑ ${emoji} ${cat.toUpperCase()}โฒ \n`;
msg += `${formatCommands(categories[cat]).join(" ")}\n`;
msg += `โฐโโโโโโโโโโโโโโโโโ\n`;
}
msg += `\nโพโโโโโโโโโโโโโโโโโโโโฟ\n`;
msg += `๐ก ๐จ๐๐ฒ: ${prefix}help <command_name> for detailed usage.\n`;
msg += `๐ ๐จ๐๐ฒ: ${prefix}callad to talk directly with my boss DI-ABLO.`;
// Handle Media Attachment (Video)
if (HELP_VIDEO_URL && HELP_VIDEO_URL.trim() !== "") {
const cacheDir = path.join(__dirname, "cache");
await fs.ensureDir(cacheDir);
const videoPath = path.join(cacheDir, `help_menu_${Date.now()}.mp4`);
try {
const res = await axios({ url: HELP_VIDEO_URL, responseType: "stream" });
const writer = fs.createWriteStream(videoPath);
res.data.pipe(writer);
await new Promise((resolve, reject) => {
writer.on("finish", resolve);
writer.on("error", reject);
});
const payload = {
body: msg,
attachment: fs.createReadStream(videoPath)
};
const callback = () => { if (fs.existsSync(videoPath)) fs.unlinkSync(videoPath); };
return message && typeof message.reply === "function"
? message.reply(payload, callback)
: api.sendMessage(payload, event.threadID, callback, event.messageID);
} catch (err) {
console.error("Help video attachment failed, sending text only:", err);
if (fs.existsSync(videoPath)) fs.unlinkSync(videoPath);
return sendMsg(msg);
}
} else {
return sendMsg(msg);
}
}
};