// code from goatstore // api: https://store.agi.bd const fs = require("fs"); const path = require("path"); const DATA_FILE = path.join(__dirname, "autoreact_data.json"); const REACTIONS = [ "☺︎", "☆", "☑", "☏", "☠︎︎", "☕︎︎", "♲︎", "♨︎", "⚠︎", "⚡︎", "☑︎", "☄︎", "☔︎︎", "☂︎", "☁︎", "♫", "〄", "☪︎", "㋡", "♚", "🃙", "☣︎", "⚕︎" ]; function loadData() { try { if (!fs.existsSync(DATA_FILE)) { const data = { enabled: true, uids: [] }; fs.writeFileSync( DATA_FILE, JSON.stringify(data, null, 2) ); return data; } const data = JSON.parse( fs.readFileSync(DATA_FILE, "utf8") ); if (!Array.isArray(data.uids)) { data.uids = []; } if (typeof data.enabled !== "boolean") { data.enabled = true; } return data; } catch (error) { return { enabled: true, uids: [] }; } } function saveData(data) { try { fs.writeFileSync( DATA_FILE, JSON.stringify(data, null, 2) ); } catch (error) { console.error("AutoReact save error:", error); } } module.exports = { config: { name: "autoreact", aliases: ["ar", "react"], version: "2.0.0", author: "Zihad", countDown: 2, role: 0, shortDescription: "UID based symbol auto react", longDescription: "Automatically reacts to selected UID messages using symbols.", category: "utility", guide: "{pn} add \n" + "{pn} del \n" + "{pn} list\n" + "{pn} on\n" + "{pn} off" }, onStart: async function ({ api, event, message, args }) { try { const data = loadData(); const action = args[0]?.toLowerCase(); if (!action) { return message.reply( "╭━━〔 ⚡ AUTO REACT 〕━━╮\n" + "┃\n" + "┃ Status: " + (data.enabled ? "✅ ON" : "❌ OFF") + "\n" + "┃ UID: " + data.uids.length + " জন\n" + "┃ Mode: SYMBOL REACT\n" + "┃ Symbols: ☺︎ ☆ ☑ ⚡︎ ☄︎ ♚\n" + "┃\n" + "┃ autoreact add UID\n" + "┃ autoreact del UID\n" + "┃ autoreact list\n" + "┃ autoreact on\n" + "┃ autoreact off\n" + "┃\n" + "╰━━━━━━━━━━━━━━━━━━╯" ); } if (action === "add") { const uid = args[1]; if (!uid || !/^\d+$/.test(uid)) { return message.reply( "❌ সঠিক UID দিন।\n\n" + "Example:\n" + "autoreact add 10001234567890" ); } if (data.uids.includes(uid)) { return message.reply( "⚠️ এই UID আগে থেকেই Auto React list-এ আছে।" ); } data.uids.push(uid); saveData(data); return message.reply( "╭━━〔 ✅ UID ADDED 〕━━╮\n" + "┃\n" + "┃ UID: " + uid + "\n" + "┃ Mode: SYMBOL REACT\n" + "┃ Status: " + (data.enabled ? "ON" : "OFF") + "\n" + "┃\n" + "┃ এখন এই UID-এর মেসেজে\n" + "┃ Random Symbol React হবে।\n" + "┃\n" + "╰━━━━━━━━━━━━━━━━━━╯" ); } if ( action === "del" || action === "remove" ) { const uid = args[1]; if (!uid) { return message.reply( "❌ যে UID বাদ দিতে চান সেটি দিন।" ); } const index = data.uids.indexOf(uid); if (index === -1) { return message.reply( "⚠️ এই UID Auto React list-এ নেই।" ); } data.uids.splice(index, 1); saveData(data); return message.reply( "✅ UID Auto React list থেকে বাদ দেওয়া হয়েছে।\n\n" + "UID: " + uid ); } if (action === "list") { if (data.uids.length === 0) { return message.reply( "📭 এখনো কোনো UID Auto React list-এ নেই।" ); } let text = "╭━━〔 ⚡ AUTO REACT UID 〕━━╮\n" + "┃ Status: " + (data.enabled ? "✅ ON" : "❌ OFF") + "\n" + "┃ Mode: SYMBOL REACT\n" + "┃\n"; data.uids.forEach( (uid, index) => { text += "┃ " + (index + 1) + ". " + uid + "\n"; } ); text += "┃\n" + "╰━━━━━━━━━━━━━━━━━━━━╯"; return message.reply(text); } if (action === "on") { data.enabled = true; saveData(data); return message.reply( "✅ Auto React ON করা হয়েছে।\n\n" + "Selected UID-এর মেসেজে Symbol React হবে।" ); } if (action === "off") { data.enabled = false; saveData(data); return message.reply( "❌ Auto React OFF করা হয়েছে।" ); } return message.reply( "❌ Unknown command.\n\n" + "autoreact add UID\n" + "autoreact del UID\n" + "autoreact list\n" + "autoreact on\n" + "autoreact off" ); } catch (error) { console.error( "autoreact command error:", error ); return message.reply( "❌ Auto React command এ সমস্যা হয়েছে।" ); } }, onChat: async function ({ api, event }) { try { const data = loadData(); if (!data.enabled) return; if (!event || !event.senderID) { return; } if (!event.messageID) { return; } // শুধু selected UID if ( !data.uids.includes( String(event.senderID) ) ) { return; } // Random symbol const reaction = REACTIONS[ Math.floor( Math.random() * REACTIONS.length ) ]; // Native reaction return api.setMessageReaction( reaction, event.messageID, () => {} ); } catch (error) { console.error( "autoreact reaction error:", error.message ); } } };