// 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; const HELP_VIDEOS = [ "https://files.catbox.moe/4wkxxe.mp4", "https://files.catbox.moe/0wx30s.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; } 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(""); } const boldFont = (str) => str.replace(/[A-Za-z0-9]/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:"๐ณ", "0":"๐ŸŽ","1":"๐Ÿ","2":"๐Ÿ","3":"๐Ÿ‘","4":"๐Ÿ’","5":"๐Ÿ“","6":"๐Ÿ”","7":"๐Ÿ•","8":"๐Ÿ–","9":"๐Ÿ—" }; return map[c] || c; }); 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 parseText(input) { if (!input) return "No description"; if (typeof input === "string") return input; if (typeof input === "object") { return input.en || input.vi || Object.values(input)[0] || "No description"; } return String(input); } 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: "help2", aliases: ["menu"], version: "3.2", author: "๐’๐ˆ๐˜๐€๐Œ-๐‡๐€๐’๐€๐", role: 0, category: "info", shortDescription: "Show all commands with video and premium style", guide: "{pn} | {pn} | {pn} -c " }, onStart: async function ({ message, args, event, role }) { if (!xfont || !yfont || !categoryEmoji) await loadResources(); const prefix = getPrefix(event.threadID); const input = args.join(" ").trim(); 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); } if (args[0] === "-c" && args[1]) { const cat = args[1].toUpperCase(); if (!categories[cat]) return message.reply(`ยป โš ๏ธ Category "${cat}" not found!`); let msg = `ยป ๐Ÿ‘‘ ๐’๐ˆ๐˜๐€๐Œ-๐‡๐€๐’๐€๐ ๐Ÿ‘‘\n`; msg += `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n`; msg += `ยป ${getCategoryEmoji(cat)} ๐’๐„๐‚๐“๐ˆ๐Ž๐: ${boldFont(cat)}\n`; msg += `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n`; for (const c of categories[cat].sort()) { msg += `ยป โœฆ ${fontConvert(c)}\n`; } msg += `\nโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n`; msg += `ยป ๐Ÿ“Š ${boldFont("Total")}: [ ${boldFont(String(categories[cat].length))} ]\n`; msg += `ยป ๐Ÿ‘‘ ${boldFont("Prefix")}: [ ${prefix} ]\n`; msg += `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n`; msg += `ยป ๐Ÿงšโ€โ™€๏ธ ๐—ก๐—œ๐—๐—›๐—จ๐—  ๐—–๐—›๐—”๐—ง๐—•๐—ข๐—ง`; return message.reply({ body: msg, attachment: await getStreamFromURL(HELP_GIF) }); } if (!input) { let msg = `ยป ๐Ÿ‘‘ ๐’๐ˆ๐˜๐€๐Œ-๐‡๐€๐’๐€๐ ๐Ÿ‘‘\n`; msg += `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n`; for (const cat of Object.keys(categories).sort()) { msg += `ยป โ—ˆ ${getCategoryEmoji(cat)} โ” ใ€Ž ${boldFont(cat)} ใ€\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 += `ยป ๐Ÿ“Š โŠฑ ${boldFont("Total Commands")}: [ ${total} ]\n`; msg += `ยป ๐Ÿ‘‘ โŠฑ ${boldFont("Find Info")}: [ ${prefix}\n`; msg += `ยป ๐Ÿ”— โŠฑ ${boldFont("Facebook")}: https://www.facebook.com/share/1LDy7c49aK/\n`; msg += `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n`; msg += `ยป ๐Ÿงšโ€โ™€๏ธ ๐—ก๐—œ๐—๐—›๐—จ๐—  ๐—–๐—›๐—”๐—ง๐—•๐—ข๐—ง`; return message.reply({ body: msg, attachment: await getStreamFromURL(HELP_GIF) }); } 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 descriptionText = parseText(c.shortDescription || c.description); let infoMsg = `ยป ๐Ÿ‘‘ ๐’๐ˆ๐˜๐€๐Œ-๐‡๐€๐’๐€๐ ๐Ÿ‘‘\n`; infoMsg += `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n`; infoMsg += `ยป ๐Ÿ‘‘ ${boldFont("COMMAND DETAILS")}\n`; infoMsg += `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n`; infoMsg += `ยป ๐Ÿ“Œ ${boldFont("Name")} โ†ฌ ${boldFont(c.name)}\n`; infoMsg += `ยป ๐Ÿ“‚ ${boldFont("Category")} โ†ฌ ${boldFont(parseText(c.category))}\n`; infoMsg += `ยป ๐Ÿ”‘ ${boldFont("Aliases")} โ†ฌ ${boldFont(aliasText)}\n`; infoMsg += `ยป ๐Ÿ›ก๏ธ ${boldFont("Role")} โ†ฌ ${boldFont(roleText(c.role))}\n`; infoMsg += `ยป ๐Ÿ“ ${boldFont("Description")} โ†ฌ ${descriptionText}\n`; infoMsg += `ยป ๐Ÿ“– ${boldFont("Usage")} โ†ฌ ${usage}\n`; infoMsg += `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n`; infoMsg += `ยป ๐Ÿงšโ€โ™€๏ธ ๐—ก๐—œ๐—๐—›๐—จ๐—  ๐—–๐—›๐—”๐—ง๐—•๐—ข๐—ง`; return message.reply({ body: infoMsg, attachment: await getStreamFromURL(HELP_GIF) }); } };