// code from goatstore // api: https://store.agi.bd // effect.js - Messenger send effects for GoatBot // Author: Zihad // // Commands: // effect list -> সেভ করা সব effect // effect -> effect সহ মেসেজ // effect random -> random effect // effect all -> সব effect একে একে (showcase) // effect test [from] [to] -> id স্ক্যান: প্রতিটা id তে মেসেজ পাঠায় // effect name -> test এ যেটা ভালো লাগল তার নাম সেভ করো // effect del -> সেভ করা নাম মুছো // // fca-protik ধরনের fca হলে patch লাগে না। অন্য fca হলে patch-fca.js (index.js এ require) লাগবে। const fs = require("fs"); const path = require("path"); const FILE = path.join(__dirname, "effect.data.json"); // শুরুর তালিকা: fca-protik এর built-in নাম (heart, love, gift, fire, confetti, party, sparkles, star, magic)। // Miku / Sailor Moon / কাচ ভাঙা ধরনের effect গুলো সংখ্যার id দিয়ে হয়, // `effect test 1 60` চালিয়ে দেখে `effect name ` দিয়ে নাম সেভ করো। const DEFAULTS = { heart: "heart", love: "love", gift: "gift", fire: "fire", confetti: "confetti", party: "party", sparkles: "sparkles", star: "star", magic: "magic" }; function load() { try { return { ...DEFAULTS, ...JSON.parse(fs.readFileSync(FILE, "utf8")) }; } catch { return { ...DEFAULTS }; } } function save(map) { const custom = {}; for (const [k, v] of Object.entries(map)) if (DEFAULTS[k] !== v) custom[k] = v; fs.writeFileSync(FILE, JSON.stringify(custom, null, 2)); } const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); // ১) আগে native চেষ্টা: fca-protik ধরনের fca তে `textEffect` / `effect` কাজ করে। // ২) না চললে patch-fca.js এর global পদ্ধতিতে fallback। const NATIVE_KEYS = ["textEffect", "effect"]; let workingKey = null; function trySend(api, threadID, msg) { return new Promise((resolve) => { let done = false; const fin = (v) => { if (!done) { done = true; resolve(v); } }; try { api.sendMessage(msg, threadID, (err) => { if (!err) return fin({ ok: true }); const text = String(err.error || err.message || err); fin({ ok: false, unknown: /Unknown property/i.test(text), text }); }); } catch (e) { fin({ ok: false, unknown: /Unknown property/i.test(e.message), text: e.message }); } }); } async function sendWithEffect(api, threadID, body, id) { const keys = workingKey ? [workingKey] : NATIVE_KEYS; for (const k of keys) { const r = await trySend(api, threadID, { body, [k]: id }); if (r.ok) { workingKey = k; return true; } if (!r.unknown) { console.log("[effect] send error:", r.text); return false; } } // fallback: patch-fca.js global.__fxId = id; const r = await trySend(api, threadID, { body }); global.__fxId = null; if (!r.ok) console.log("[effect] fallback error:", r.text); return r.ok; } module.exports = { config: { name: "effect", aliases: ["fx", "sendeffect"], version: "2.1", author: "Zihad", countDown: 3, role: 0, description: { en: "Send messages with Messenger send effects" }, category: "fun", guide: { en: "{p}effect list | {p}effect | {p}effect random | {p}effect all | {p}effect test [from] [to] | {p}effect name " } }, onStart: async function ({ api, event, args, message }) { const map = load(); const sub = (args[0] || "").toLowerCase(); const tid = event.threadID; if (!sub || sub === "list") { const rows = Object.entries(map).map(([n, i]) => `• ${n} (id ${i})`); return message.reply( "✨ Send Effects — by Zihad\n" + (rows.join("\n") || "(খালি)") + "\n\n`effect test 1 30` দিয়ে খোঁজো, ভালো লাগলে `effect name `" ); } if (sub === "test") { const from = parseInt(args[1]) || 1; const to = Math.min(parseInt(args[2]) || from + 19, from + 99); const byId = Object.fromEntries(Object.entries(map).map(([n, i]) => [i, n])); await message.reply(`🔍 id ${from} → ${to} স্ক্যান শুরু`); for (let id = from; id <= to; id++) { await sendWithEffect(api, tid, `Effect test: ${byId[id] || "?"} (id ${id})`, id); await sleep(1800); } return message.reply("✅ স্ক্যান শেষ। ভালোগুলোর নাম দাও: effect name "); } if (sub === "name") { const id = parseInt(args[1]); const nm = (args[2] || "").toLowerCase(); if (!id || !nm) return message.reply("ব্যবহার: effect name "); map[nm] = id; save(map); return message.reply(`✅ "${nm}" = id ${id} সেভ হলো`); } if (sub === "del") { const nm = (args[1] || "").toLowerCase(); if (!map[nm] || DEFAULTS[nm]) return message.reply("❌ এই নাম মুছা যাবে না/নাই"); delete map[nm]; save(map); return message.reply(`🗑️ "${nm}" মুছে গেছে`); } if (sub === "random") { const ids = Object.values(map); const id = ids[Math.floor(Math.random() * ids.length)]; const ok = await sendWithEffect(api, tid, args.slice(1).join(" ") || "✨", id); return ok ? undefined : message.reply("❌ পাঠানো যায়নি, console দেখো"); } if (sub === "all") { const text = args.slice(1).join(" ") || "✨"; for (const [n, id] of Object.entries(map)) { await sendWithEffect(api, tid, `${text} (${n})`, id); await sleep(2200); } return; } const id = map[sub] ?? (/^\d+$/.test(sub) ? parseInt(sub) : null); if (id === null) return message.reply("❌ এই effect নাই। `effect list` দেখো।"); const ok = await sendWithEffect(api, tid, args.slice(1).join(" ") || "✨", id); if (!ok) return message.reply("❌ পাঠানো যায়নি। `node patch-fca.js` এর লগ আর console দেখো।"); } };