// code from goatstore // api: https://store.agi.bd const fs = require("fs-extra"); const path = require("path"); const https = require("https"); module.exports = { config: { name: "help", aliases: ["commands", "menu"], version: "2.2.0", author: "ROBIUL ISLAM", countDown: 2, role: 0, category: "utility" }, onStart: async function ({ message, args, prefix }) { const commands = global.GoatBot.commands; if (!commands) return message.reply("❌ Commands collection পাওয়া যাচ্ছে না!"); // ━━━━━ COMMAND INFO ━━━━━ if (args[0]) { const search = args[0].toLowerCase(); let command; for (const cmd of commands.values()) { const c = cmd.config; if (!c) continue; const name = c.name?.toLowerCase(); const aliases = (c.aliases || []).map(a => a.toLowerCase() ); if ( name === search || aliases.includes(search) ) { command = cmd; break; } } if (!command) { return message.reply( `╭━━━━━━━━━━━━━━╮ ┃ ❌ NOT FOUND ╰━━━━━━━━━━━━━━╯ 🔎 Command: ${args[0]} এই নামে কোনো command পাওয়া যায়নি। 💡 Try: ${prefix}help` ); } const c = command.config; return message.reply( `╭━━━━━━━━━━━━━━━━━━╮ ┃ ⚡ COMMAND INFO ╰━━━━━━━━━━━━━━━━━━╯ 🔹 Name : ${c.name} 🔸 Aliases : ${ c.aliases?.length ? c.aliases.join(", ") : "None" } 👤 Permission : ${ c.role === 2 ? "Admin" : c.role === 1 ? "VIP" : "Everyone" } 📂 Category : ${c.category || "Unknown"} 📌 Version : ${c.version || "N/A"} 👑 Author : ${c.author || "Unknown"} ╭━━━━━━━━━━━━━━━━━━╮ ┃ 🤖 NIX BOT ╰━━━━━━━━━━━━━━━━━━╯` ); } // ━━━━━ CATEGORY ━━━━━ const categories = {}; for (const cmd of commands.values()) { const c = cmd.config; if (!c || !c.name) continue; const category = c.category || "Other"; if (!categories[category]) categories[category] = []; if (!categories[category].includes(c.name)) categories[category].push(c.name); } let text = `╭━━━━━━━━━━━━━━━━━━━━╮ ┃ 🤖 NIX BOT ┃ ✦ HELP CENTER ✦ ╰━━━━━━━━━━━━━━━━━━━━╯ `; for (const category of Object.keys(categories).sort()) { text += `╭───「 ${category.toUpperCase()} 」\n`; categories[category] .sort() .forEach((name, i) => { text += `│ ${i + 1}. ${name}\n`; }); text += `╰────────────────\n\n`; } text += `╭━━━━━━━━━━━━━━━━━━━━╮ ┃ 📦 Total : ${commands.size} ┃ 👑 Owner : ROBIUL ISLAM ┃ 🤖 Bot : NIX BOT ╰━━━━━━━━━━━━━━━━━━━━╯ 💡 ${prefix}help 📌 Example: ${prefix}help ping ⚡ POWERED BY GOATBOT ⚡`; // ━━━━━ IMGUR VIDEO URLs ━━━━━ const gifURLs = [ "https://i.imgur.com/M7h7gew.mp4" ]; const randomGifURL = gifURLs[Math.floor(Math.random() * gifURLs.length)]; const gifFolder = path.join( __dirname, "cache" ); try { 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: text.trim(), attachment: fs.createReadStream(gifPath) }); } catch (err) { console.log( "Help video error:", err.message ); return message.reply(text.trim()); } } }; // ━━━━━ DOWNLOAD VIDEO ━━━━━ function downloadGif(url, dest) { return new Promise((resolve, reject) => { const file = fs.createWriteStream(dest); https.get(url, res => { if ( res.statusCode >= 300 && res.statusCode < 400 && res.headers.location ) { file.close(); fs.unlink(dest, () => {}); return downloadGif( res.headers.location, dest ) .then(resolve) .catch(reject); } if (res.statusCode !== 200) { file.close(); fs.unlink(dest, () => {}); return reject( new Error( `Request failed: ${res.statusCode}` ) ); } res.pipe(file); file.on("finish", () => { file.close(resolve); }); file.on("error", err => { fs.unlink(dest, () => {}); reject(err); }); }).on("error", err => { fs.unlink(dest, () => {}); reject(err); }); }); }