module.exports = { config: { name: "botactive", version: "1.1", author: "HR ID OY", countDown: 5, role: 2, description: "Notify all groups when the bot starts", category: "System", guide: { en: "{pn}: manually resend the bot-active notice to all groups" } }, // ๐Ÿ”” Auto notify all groups when the bot starts onLoad: async function ({ api, threadsData }) { try { setTimeout(async () => { const allThreads = (await threadsData.getAll()).filter(t => t.isGroup); for (const thread of allThreads) { try { await api.sendMessage( "โ•ญโ”€โ”€ใ€Œ ๐๐Ž๐“ ๐’๐“๐€๐“๐”๐’ ใ€โ”€โ”€โ•ฎ\n\n" + " ๐Ÿค– ๐‘ฉ๐’๐’• ๐’Š๐’” ๐’๐’๐’˜ ๐‘จ๐’„๐’•๐’Š๐’—๐’† โœ…\n\n" + " ๐Ÿ“– ๐‘ป๐’š๐’‘๐’† " + "โ€น .help โ€บ" + " ๐’•๐’ ๐’”๐’†๐’†\n" + " ๐’‚๐’๐’ ๐’‚๐’—๐’‚๐’Š๐’๐’‚๐’ƒ๐’๐’† ๐’„๐’๐’Ž๐’Ž๐’‚๐’๐’…๐’”\n\n" + "โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ", thread.threadID ); } catch (err) { console.error(`[BOT ACTIVE] Failed to notify ${thread.threadID}:`, err?.message || err); } // Facebook rate limit เฆเฆกเฆผเฆพเฆคเง‡ await new Promise(resolve => setTimeout(resolve, 1000)); } console.log("[BOT ACTIVE] Message sent to all groups."); }, 5000); } catch (err) { console.error("[BOT ACTIVE ERROR]", err); } }, // ๐Ÿ” Manual trigger (admin only): resend the notice on demand onStart: async function ({ api, event, threadsData }) { const allThreads = (await threadsData.getAll()).filter(t => t.isGroup); for (const thread of allThreads) { try { await api.sendMessage( "โ•ญโ”€โ”€โ”€ใ€Œ ๐๐Ž๐“ ๐’๐“๐€๐“๐”๐’ ใ€โ”€โ”€โ”€โ•ฎ\n\n" + " ๐Ÿค– ๐‘ฉ๐’๐’• ๐’Š๐’” ๐’๐’๐’˜ ๐‘จ๐’„๐’•๐’Š๐’—๐’† โœ…\n\n" + " ๐Ÿ“– ๐‘ป๐’š๐’‘๐’† " + "โ€น .help โ€บ" + " ๐’•๐’ ๐’”๐’†๐’†\n" + " ๐’‚๐’๐’ ๐’‚๐’—๐’‚๐’Š๐’๐’‚๐’ƒ๐’๐’† ๐’„๐’๐’Ž๐’Ž๐’‚๐’๐’…๐’”\n\n" + "โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ", thread.threadID ); } catch (err) { console.error(`[BOT ACTIVE] Failed to notify ${thread.threadID}:`, err?.message || err); } await new Promise(resolve => setTimeout(resolve, 1000)); } return api.sendMessage(`โœจ ๐‘ต๐’๐’•๐’Š๐’‡๐’Š๐’†๐’… ${allThreads.length} ๐’ˆ๐’“๐’๐’–๐’‘(๐’”) โœ…`, event.threadID); } };