// code from goatstore // api: https://store.agi.bd module.exports "use strict"; const tasks = new Map(); module.exports = { config: { name: "spam2", aliases: [], version: "1.0.0", author: "shtot", countDown: 2, role: 0, shortDescription: "تكرار رسالة كل 5 دقائق", category: "fun" }, onStart: async function ({ api, event, args, message }) { const threadID = event.threadID; // إيقاف if ( args[0] && ["stop", "وقف", "توقيف"].includes( String(args[0]).toLowerCase() ) ) { const task = tasks.get(threadID); if (!task) { return message.reply("❌ ماكاين حتى Spam2 خدام."); } task.stop = true; if (task.timer) { clearTimeout(task.timer); } tasks.delete(threadID); return message.reply("🛑 تم توقيف Spam2."); } if (!args.length) { return message.reply( "❌ كتب الرسالة.\n\nمثال:\n-spam2 سلام\n\nللإيقاف:\n-spam2 stop" ); } if (tasks.has(threadID)) { return message.reply( "⚠️ كاين Spam2 خدام دابا.\n\nاستعمل:\n-spam2 stop" ); } const text = args.join(" ").trim(); const task = { stop: false, timer: null, busy: false }; tasks.set(threadID, task); await message.reply( "🚀 بدا Spam2\n\n" + "📝 الرسالة: " + text + "\n" + "⏱️ كل 5 دقائق\n\n" + "🛑 للإيقاف: -spam2 stop" ); async function sendLoop() { if (task.stop) return; if (!task.busy) { task.busy = true; try { await api.sendMessage(text, threadID); } catch (error) {} task.busy = false; } if (!task.stop) { task.timer = setTimeout(sendLoop, 300000); } } task.timer = setTimeout(sendLoop, 300000); } };