const axios = require("axios"); const API_BASE = "https://hridoy-api.onrender.com"; module.exports = { config: { name: "hnekos", version: "2.0", author: "HR ID OY", role: 0, shortDescription: "Nekos menu system", category: "Image", guide: "{pn}", cooldown: 5 }, onStart: async function ({ api, event }) { const config = (await axios.get(`${API_BASE}/api/links/nekos`)).data; const allActions = [...config.imageActions, ...config.textActions]; let text = "✨ NEKOS MENU ✨\n\n🖼 IMAGE\n"; config.imageActions.forEach((a, i) => text += `${i+1}. ${a}\n`); text += "\n🧠 TEXT\n"; config.textActions.forEach((a, i) => text += `${config.imageActions.length+i+1}. ${a}\n`); text += `\nReply with a number (1-${allActions.length})`; const msg = await api.sendMessage(text, event.threadID); if (msg?.messageID) global.GoatBot.onReply.set(msg.messageID, { commandName: "hnekos", author: event.senderID, config }); }, onReply: async function ({ api, event, Reply }) { if (!Reply || event.senderID !== Reply.author) return; const choice = Number(String(event.body || "").trim()); const config = Reply.config; const allActions = [...config.imageActions, ...config.textActions]; if (!Number.isInteger(choice) || choice < 1 || choice > allActions.length) return api.sendMessage("❌ Invalid number.", event.threadID, event.messageID); const action = allActions[choice - 1]; if (config.imageActions.includes(action)) { const res = await axios.get(`${config.url}${action}`, { timeout: 15000 }); const imageURL = res.data?.url; if (!imageURL) throw new Error("Image URL not found"); return api.sendMessage({ body: `✨ ${action.toUpperCase()}`, attachment: await global.utils.getStreamFromURL(imageURL) }, event.threadID, event.messageID); } const res = await axios.get(`${config.textUrl}${action}`, { timeout: 15000 }); const data = res.data || {}; const value = data[Object.keys(data)[0]]; return api.sendMessage(`✨ ${action.toUpperCase()} ✨\n\n${String(value || "No data")}`, event.threadID, event.messageID); } };