// code from goatstore // api: https://store.agi.bd module.exports = { config: { name: "autosticker2", version: "4.6", author: "HR ID OY", countDown: 1, role: 0, description: "Send a random sticker when someone sends a sticker. Fixed loop issue.", category: "System", guide: "{prefix}autosticker list\n{prefix}autosticker listall" }, onChat: async function ({ api, event }) { const { attachments, type, threadID, messageID, senderID, body } = event; // Bot's own ID const botID = api.getCurrentUserID?.() || process.env.BOT_ID || "YOUR_BOT_ID_HERE"; // Prevent bot from reacting to its own messages (main fix for loop) if (senderID === botID) return; const stickerList = [ "997237917529747", "610031329418350", "610502019371281", "610569272697889", "610569976031152", "476425823021014", "476426593020937", "476429343020662", "476425429687720", "1303078524468983", "1303078351135667", "1303076361135866", "1303077221135780", "587748556953567", "587538733641216", "587532536975169", "587534000308356", "8298078730277844", "2041012262792914", "788171644590353", "2041021119458695", "456545803421865", "2041015016125972", "456536873422758", "456539756755803", "456538446755934", "456537923422653", "551710548197410", "3258106924322842", "3258108400989361", "529234074205621", "2041012539459553", "2041012109459596", "2041011389459668", "2041011836126290", "2041012406126233" ]; // Commands if (body && body.toLowerCase() === "/autosticker list") { return api.sendMessage(`šŸ“Š Total stickers: ${stickerList.length}`, threadID, messageID); } if (body && body.toLowerCase() === "/autosticker listall") { let msg = "šŸ“œ š—”š—¹š—¹ š—¦š˜š—¶š—°š—øš—²š—æ š—œš——š˜€\n━━━━━━━━━━━━━━━━━━━━\n"; stickerList.forEach((id, index) => { msg += `${index + 1}. ${id}\n`; }); msg += `\nšŸ“Š š—§š—¼š˜š—®š—¹: ${stickerList.length}`; return api.sendMessage(msg, threadID, messageID); } // Main functionality: Only respond when user sends a sticker if (type === "message" && attachments && attachments[0] && attachments[0].type === "sticker") { const randomSticker = stickerList[Math.floor(Math.random() * stickerList.length)]; return api.sendMessage({ sticker: randomSticker }, threadID, messageID); } }, onStart: async function ({}) { } };