// code from goatstore // api: https://store.agi.bd const axios = require("axios"); const { getPrefix, getStreamFromURL } = global.utils; const { commands } = global.GoatBot; const fs = require("fs"); const path = require("path"); let xfont = null; let yfont = null; let categoryEmoji = null; // šŸŽ„ VIDEO ROTATION SYSTEM const HELP_VIDEOS = [ "https://files.catbox.moe/0wx30s.mp4", "https://files.catbox.moe/rjdbb9.mp4" ]; const videoCountFile = path.join(__dirname, "help_video_count.json"); function getNextHelpVideo() { let index = 0; try { if (fs.existsSync(videoCountFile)) { const data = JSON.parse(fs.readFileSync(videoCountFile, "utf8")); index = data.index || 0; } } catch (e) { console.log("Video count read error:", e.message); } const selectedVideo = HELP_VIDEOS[index]; const nextIndex = (index + 1) % HELP_VIDEOS.length; try { fs.writeFileSync( videoCountFile, JSON.stringify({ index: nextIndex }) ); } catch (e) { console.log("Video count write error:", e.message); } return selectedVideo; } // šŸ”’ AUTHOR LOCK SYSTEM const AUTHOR_NAME = "FARHAN-KHAN"; const FILE_PATH = __filename; function checkAuthorLock() { try { const fileData = fs.readFileSync(FILE_PATH, "utf-8"); if (!fileData.includes(`author: "${AUTHOR_NAME}"`)) { console.log("āŒ AUTHOR CHANGED! FILE LOCKED."); return false; } return true; } catch (e) { console.log("āŒ ERROR CHECKING AUTHOR LOCK"); return false; } } async function loadResources() { try { const [x, y, c] = await Promise.all([ axios.get("https://raw.githubusercontent.com/Saim-x69x/sakura/main/xfont.json"), axios.get("https://raw.githubusercontent.com/Saim-x69x/sakura/main/yfont.json"), axios.get("https://raw.githubusercontent.com/Saim-x69x/sakura/main/category.json") ]); xfont = x.data; yfont = y.data; categoryEmoji = c.data; } catch (e) { console.error("[HELP] Resource load failed", e); xfont = {}; yfont = {}; categoryEmoji = {}; } } function fontConvert(text, type = "command") { const map = type === "category" ? xfont : yfont; if (!map) return text; return text.split("").map(c => map[c] || c).join(""); } function getCategoryEmoji(cat) { return categoryEmoji?.[cat.toLowerCase()] || "šŸ—‚ļø"; } function roleText(role) { const roles = { 0: "All Users", 1: "Group Admins", 2: "Bot Admin" }; return roles[role] || "Unknown"; } function findCommand(name) { name = name.toLowerCase(); for (const [, cmd] of commands) { const a = cmd.config?.aliases; if (cmd.config?.name === name) return cmd; if (Array.isArray(a) && a.includes(name)) return cmd; if (typeof a === "string" && a === name) return cmd; } return null; } module.exports = { config: { name: "help", aliases: ["menu"], version: "2.1", author: "FARHAN-KHAN", role: 0, category: "info", shortDescription: "Show all commands", guide: "{pn} | {pn} | {pn} -c " }, onStart: async function ({ message, args, event, role }) { if (!checkAuthorLock()) { return message.reply("āŒ FILE LOCKED! DON'T CHANGE AUTHOR."); } if (!xfont || !yfont || !categoryEmoji) await loadResources(); const prefix = getPrefix(event.threadID); const input = args.join(" ").trim(); // šŸŽ„ AUTO VIDEO CHANGE const HELP_GIF = getNextHelpVideo(); const categories = {}; for (const [name, cmd] of commands) { if (!cmd?.config || cmd.config.role > role) continue; const cat = (cmd.config.category || "UNCATEGORIZED").toUpperCase(); if (!categories[cat]) categories[cat] = []; categories[cat].push(name); } // šŸ“‚ CATEGORY VIEW if (args[0] === "-c" && args[1]) { const cat = args[1].toUpperCase(); if (!categories[cat]) return message.reply(`āŒ Category "${cat}" not found`); let msg = `ā•­ā”€ā”€ā”€ā”€ā”€āœ°ć€Ž ${getCategoryEmoji(cat)} ${fontConvert(cat, "category")} 怏\n`; for (const c of categories[cat].sort()) msg += `ā”‚šŸŖÆ ${fontConvert(c)}\n`; msg += `ā•°ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€āœ°\n`; msg += `> TOTAL: ${categories[cat].length}\n> PREFIX: ${prefix}`; return message.reply({ body: msg, attachment: await getStreamFromURL(HELP_GIF) }); } // šŸ“œ FULL LIST if (!input) { let msg = `ā•­ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā\nā”‚šŸ‘‘ā€æš’šˆš˜š€šŒ š—›š—˜š—Ÿš—£ š—Ÿš—œš—¦š—§šŸ‘‘ \nā•°ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā\n`; for (const cat of Object.keys(categories).sort()) { msg += `ā•­ā”€ā”€ā”€ā”€ā”€āœ°ć€Ž ${getCategoryEmoji(cat)} ${fontConvert(cat, "category")} 怏\n`; for (const c of categories[cat].sort()) msg += `ā”‚šŸŖÆ ${fontConvert(c)}\n`; msg += `ā•°ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€āœ°\n`; } const total = Object.values(categories).reduce((a, b) => a + b.length, 0); msg += `ā•­ā”€ā”€ā”€ā”€ā”€āœ°[🪬 š„šš‰šŽš˜ 🪬]\n│> TOTAL COMMANDS: [${total}]\n│\n│> TYPE: [ ${prefix}help ]\n│\n│> FB.LINK: [https://www.facebook.com/share/1LDy7c49aK/]\nā•°ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€āœ°\n`; msg += `ā•­ā”€ā”€ā”€ā”€ā”€āœ°\n│ 🐲 ā€æššˆš‰š‡š”šŒ-š—•š—¢š—§ 🐲\nā•°ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€āœ°`; return message.reply({ body: msg, attachment: await getStreamFromURL(HELP_GIF) }); } // šŸ” COMMAND INFO const cmd = findCommand(input); if (!cmd) return message.reply(`āŒ Command "${input}" not found`); const c = cmd.config; const aliasText = Array.isArray(c.aliases) ? c.aliases.join(", ") : c.aliases || "None"; let usage = "No usage"; if (c.guide) { if (typeof c.guide === "string") usage = c.guide; else if (typeof c.guide === "object") usage = c.guide.en || Object.values(c.guide)[0] || "No usage"; usage = usage.replace(/{pn}/g, `${prefix}${c.name}`); } const infoMsg = ` ╭─── COMMAND INFO ───╮ šŸ”¹ Name : ${c.name} šŸ“‚ Category : ${c.category || "UNCATEGORIZED"} šŸ”‘ Aliases : ${aliasText} šŸ‘„ Role : ${roleText(c.role)} šŸ“ Description : ${c.shortDescription || "No description"} šŸ“– Usage : ${usage} ╰──────────────────╯`; return message.reply({ body: infoMsg, attachment: await getStreamFromURL(HELP_GIF) }); } };