// code from goatstore // api: https://store.agi.bd const fs = require("fs"); const path = require("path"); const DATA_FILE = path.join(__dirname, "eclipse-data.json"); const THEMES = { default: { name: "ECLIPSE", symbol: "☾", color: "DARK", quote: "When darkness awakens, the system remembers." }, phantom: { name: "PHANTOM", symbol: "◈", color: "PURPLE", quote: "The shadow remembers everything." }, void: { name: "VOID", symbol: "◉", color: "RED", quote: "Nothing exists beyond the void." }, god: { name: "GOD MODE", symbol: "✦", color: "GOLD / PURPLE", quote: "Power begins where limits end." } }; const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); function readData() { try { if (!fs.existsSync(DATA_FILE)) { fs.writeFileSync(DATA_FILE, "{}"); } const data = JSON.parse(fs.readFileSync(DATA_FILE, "utf8")); return data && typeof data === "object" && !Array.isArray(data) ? data : {}; } catch (error) { return {}; } } function saveData(data) { fs.writeFileSync(DATA_FILE, JSON.stringify(data, null, 2)); } function send(api, text, threadID) { return new Promise((resolve, reject) => { api.sendMessage(text, threadID, (err, info) => { if (err) return reject(err); resolve(info); }); }); } function edit(api, messageID, text) { return new Promise((resolve, reject) => { if (typeof api.editMessage !== "function") { return reject(new Error("Message editing is unsupported.")); } api.editMessage(messageID, text, err => { if (err) return reject(err); resolve(); }); }); } function getTheme(threadID) { const data = readData(); const mode = data[String(threadID)] || "default"; return THEMES[mode] ? mode : "default"; } module.exports = { config: { name: "eclipse", aliases: ["ecl", "protocol"], version: "1.0.0", author: "Bunny", countDown: 5, role: 0, shortDescription: { en: "Eclipse cyberpunk protocol" }, longDescription: { en: "Cyberpunk animation, themes and diagnostics" }, category: "system", guide: { en: "{pn}\n{pn} awaken\n{pn} status\n{pn} scan\n{pn} mode phantom\n{pn} mode void\n{pn} mode god\n{pn} reset" } }, onStart: async function ({ api, event, args }) { const threadID = event.threadID; const action = (args[0] || "").toLowerCase(); try { if (action === "status") { const theme = THEMES[getTheme(threadID)]; const uptime = Math.floor(process.uptime()); const ram = (process.memoryUsage().rss / 1048576).toFixed(1); return await send( api, "╭━━━『 E C L I P S E 』━━━╮\n" + "│ STATUS: ONLINE\n" + "│ MODE: " + theme.name + "\n" + "│ RAM: " + ram + " MB RSS\n" + "│ UPTIME: " + uptime + " seconds\n" + "│ CORE: NODE.JS\n" + "╰━━━━━━━━━━━━━━━━━━━━╯\n\n" + theme.symbol + " " + theme.quote, threadID ); } if (action === "mode") { const requested = (args[1] || "").toLowerCase(); if (!["phantom", "void", "god"].includes(requested)) { return await send( api, "☾ AVAILABLE THEMES\n\n" + ":eclipse mode phantom\n" + ":eclipse mode void\n" + ":eclipse mode god", threadID ); } const data = readData(); data[String(threadID)] = requested; saveData(data); const theme = THEMES[requested]; return await send( api, "╭━━『 THEME UPDATED 』━━╮\n" + "│ MODE: " + theme.name + "\n" + "│ COLOR: " + theme.color + "\n" + "╰━━━━━━━━━━━━━━━━━━╯\n\n" + theme.quote, threadID ); } if (action === "reset") { const data = readData(); delete data[String(threadID)]; saveData(data); return await send( api, "☾ ECLIPSE RESET COMPLETE\nDefault theme restored.", threadID ); } if (action === "scan") { const files = fs.readdirSync(__dirname) .filter(file => file.endsWith(".js")); return await send( api, "╭━━『 ECLIPSE SCAN 』━━╮\n" + "│ DIRECTORY: READABLE\n" + "│ JS FILES: " + files.length + "\n" + "│ RESULT: SCAN COMPLETE\n" + "╰━━━━━━━━━━━━━━━━━━╯\n\n" + "Note: Filename check only; command functionality is not verified.", threadID ); } if (action === "awaken" || !action) { const theme = THEMES[getTheme(threadID)]; const frames = [ "☾ ECLIPSE BOOT\n\n[....] Initializing core...", "☾ ECLIPSE BOOT\n\n[ OK ] Core initialized\n[....] Loading modules...", "☾ ECLIPSE BOOT\n\n[ OK ] Core initialized\n[ OK ] Modules loaded\n[....] Synchronizing...", "╭━━━『 E C L I P S E 』━━━╮\n" + "│ STATUS: ONLINE\n" + "│ MODE: " + theme.name + "\n" + "│ CORE: STABLE\n" + "╰━━━━━━━━━━━━━━━━━━━━╯\n\n" + theme.symbol + " " + theme.quote ]; const info = await send(api, frames[0], threadID); if (!info || !info.messageID) return; for (let i = 1; i < frames.length; i++) { await sleep(700); try { await edit(api, info.messageID, frames[i]); } catch (error) { console.error("[ECLIPSE EDIT]", error.message); break; } } return; } return await send( api, "☾ ECLIPSE PROTOCOL\n\n" + ":eclipse — Boot protocol\n" + ":eclipse awaken — Animation\n" + ":eclipse status — System status\n" + ":eclipse scan — Scan JS filenames\n" + ":eclipse mode phantom — Purple theme\n" + ":eclipse mode void — Red theme\n" + ":eclipse mode god — Gold theme\n" + ":eclipse reset — Default theme", threadID ); } catch (error) { console.error("[ECLIPSE ERROR]", error); return await send( api, "☾ ECLIPSE ERROR\nCommand failed. Check the bot console.", threadID ); } } };