// code from goatstore // api: https://store.agi.bd const fs = require("fs-extra"); const path = require("path"); module.exports.config = { name: "autoreply", version: "2.0.0", author: "RAYHAN-SABBIR", countDown: 1, role: 0, description: "নিজের মতো শব্দ অ্যাড/ডিলেট করে অটো রিপ্লাই - Permanent", category: "ai", guide: { bn: "autoreply add hi = হ্যালো বস\nautoreply del hi\nautoreply list\nautoreply on/off" } }; // ফাইল পাথ - এখানে সব সেভ থাকবে const cachePath = path.join(__dirname, "cache", "autoreply.json"); // ডিফল্ট লিস্ট let defaultReplies = { "hi": "আঁসঁসাঁলাঁমুঁ আঁলাঁইঁকুঁমঁ 😊 কেমন আছো তুমি", "assalamualaikum": "ওঁয়াঁলাঁইঁকুঁমুঁসঁসাঁলাঁমঁ ❤️", "kemon acho": "আঁলঁহাঁমঁদুঁলিঁল্লাঁহঁ ভাঁলোঁ আঁছিঁ তুঁমিঁ?", "good night": "শুঁভঁ রাঁত্রিঁ 🌙 ঘুঁমাঁওঁ জাঁলঁদিঁ", "l love you": "l love you too baby 😘", "কি করো": "এইতো তোমাদের সাথে আড্ডা দিতে আসলাম, তুমি করো জান,? 👑" }; function loadData() { try { if (!fs.existsSync(cachePath)) { fs.ensureDirSync(path.dirname(cachePath)); fs.writeJsonSync(cachePath, { replyList: defaultReplies, autoMode: {} }, { spaces: 2 }); return { replyList: defaultReplies, autoMode: {} }; } const data = fs.readJsonSync(cachePath); return data; } catch { return { replyList: defaultReplies, autoMode: {} }; } } function saveData(data) { fs.ensureDirSync(path.dirname(cachePath)); fs.writeJsonSync(cachePath, data, { spaces: 2 }); } module.exports.onStart = async ({ api, event, args }) => { const { threadID, messageID } = event; const data = loadData(); let replyList = data.replyList; let autoMode = data.autoMode; const cmd = args[0]?.toLowerCase(); // ON/OFF if (cmd === "on") { autoMode[threadID] = true; saveData({ replyList, autoMode }); return api.sendMessage("✅ 𝐀𝐔𝐓𝐎-𝐑𝐄𝐏𝐋𝐘 𝐎𝐍", threadID, messageID); } if (cmd === "off") { autoMode[threadID] = false; saveData({ replyList, autoMode }); return api.sendMessage("❌ 𝐀𝐔𝐓𝐎-𝐑𝐄𝐏𝐋𝐘 𝐎𝐅𝐅", threadID, messageID); } // LIST if (cmd === "list") { if (Object.keys(replyList).length === 0) { return api.sendMessage("❌ কোনো রিপ্লাই সেট করা নাই", threadID, messageID); } let list = "╭─『 𝐑𝐄𝐏𝐋𝐘 𝐋𝐈𝐒𝐓 』─╮\n"; let i = 1; for (let key in replyList) { list += `│ ${i++}. ${key} » ${replyList[key]}\n`; } list += "╰────────────────╯"; return api.sendMessage(list, threadID, messageID); } // ADD - পার্মানেন্ট if (cmd === "add") { const key = args[1]; const reply = args.slice(2).join(" "); if (!key ||!reply) return api.sendMessage("⚠️ Example: autoreply add hi হ্যালো বস", threadID, messageID); replyList[key.toLowerCase()] = reply; saveData({ replyList, autoMode }); return api.sendMessage(`✅ পার্মানেন্ট অ্যাড হইছে\n» ${key} » ${reply}`, threadID, messageID); } // DEL - পার্মানেন্ট ডিলিট if (cmd === "del" || cmd === "delete" || cmd === "remove") { const key = args[1]?.toLowerCase(); if (!key) return api.sendMessage("⚠️ Example: autoreply del hi", threadID, messageID); if (!replyList[key]) { return api.sendMessage(`❌ "${key}" নামে কোনো শব্দ পাওয়া যায় নাই`, threadID, messageID); } delete replyList[key]; saveData({ replyList, autoMode }); return api.sendMessage(`✅ পার্মানেন্ট ডিলেট হইছে: ${key}`, threadID, messageID); } // CLEAR ALL if (cmd === "clear") { saveData({ replyList: {}, autoMode }); return api.sendMessage("✅ সব রিপ্লাই ডিলেট করে দিলাম", threadID, messageID); } return api.sendMessage( `╭───『 𝐀𝐔𝐓𝐎-𝐑𝐄𝐏𝐋𝐘 v2 』───╮ │ » autoreply add hi হ্যালো │ » autoreply del hi │ » autoreply list │ » autoreply clear - সব ডিলিট │ » autoreply on/off ╰──────────────────╯`, threadID, messageID ); }; // অটো রিপ্লাই চেক module.exports.onChat = async ({ api, event }) => { const { threadID, messageID, body, senderID } = event; if (senderID === api.getCurrentUserID()) return; if (!body) return; const data = loadData(); if (data.autoMode[threadID] === false) return; const msg = body.toLowerCase().trim(); const replyList = data.replyList; for (let key in replyList) { if (msg.includes(key.toLowerCase())) { return api.sendMessage(replyList[key], threadID, messageID); } } };