// by https://github.com/elrebelde21 & https://github.com/GataNina-Li import { randomBytes } from 'crypto' let handler = async (m, { conn, command, participants, usedPrefix, text }) => { let fkontak = { "key": { "participants":"0@s.whatsapp.net", "remoteJid": "status@broadcast", "fromMe": false, "id": "Halo" }, "message": { "contactMessage": { "vcard": `BEGIN:VCARD\nVERSION:3.0\nN:Sy;Bot;;;\nFN:y\nitem1.TEL;waid=${conn.user.jid.split('@')[0]}:${conn.user.jid.split('@')[0]}\nitem1.X-ABLabel:Ponsel\nEND:VCARD` }}, "participant": "0@s.whatsapp.net" } if (!text && !m.quoted) return m.reply('*โš ๏ธ ๐ˆ๐ง๐ ๐ซ๐ž๐ฌ๐ž ๐ž๐ฅ ๐ฆ๐ž๐ง๐ฌ๐š๐ฃ๐ž ๐ช๐ฎ๐ž ๐ช๐ฎ๐ข๐ž๐ซ๐ž ๐ญ๐ซ๐š๐ฆ๐ข๐ญ๐ž*') let cc4 = text ? m : m.quoted ? await m.getQuotedObj() : false || m let teks4 = text ? text : cc4.text let groups2 = Object.keys(await conn.groupFetchAllParticipating()) let chats2 = Object.keys(global.db.data.users).filter(user => user.endsWith('@s.whatsapp.net')) await conn.reply(m.chat, '*Enviando mensaje oficial, espere un momento...*', m); let start2 = new Date().getTime() let usersTag2 = participants.map(u => conn.decodeJid(u.id)) let totalPri2 = 0 for (let i = 0; i < groups2.length; i++) { const group = groups2[i]; const delay = i * 4000; // 4 seg setTimeout(async () => { await conn.reply(group, `โœ… *COMUNICADO OFICIAL* โœ…\n\n` + teks4, { mentions: usersTag2 }, { quoted: fkontak }); }, delay)} for (let user of chats2) { await new Promise(resolve => setTimeout(resolve, 2000)) // 2 segundos await delay(2 * 2000) await conn.reply(user, `โœ… *COMUNICADO OFICIAL* โœ…\n\n` + teks4, fkontak, null) totalPri2++ if (totalPri2 >= 500000) { break }} let end2 = new Date().getTime() let totalPrivate2 = chats2.length let totalGroups2 = groups2.length let total2 = totalPrivate2 + totalGroups2 let time2 = Math.floor((end2 - start2) / 1000) if (time2 >= 60) { let minutes = Math.floor(time2 / 60) let seconds = time2 % 60 time2 = `${minutes} minutos y ${seconds} segundos` } else { time2 = `${time2} segundos` } await m.reply(`โœ… แดแด‡ษดsแด€แดŠแด‡ แด‡ษดแด ษชแด€แด…แด แด€: \`\`\`แด„สœแด€แด› แด˜ส€ษชแด แด€แด…แด >> ${totalPrivate2}\`\`\` \`\`\`แด„สœแด€แด› ษขส€แดœแด˜แดs >> ${totalGroups2}\`\`\` \`\`\`แด„สœแด€แด›s แด›แดแด›แด€สŸแด‡s >> ${total2}\`\`\`\n\n*โ€ข แด›ษชแด‡แดแด˜แด แด›แดแด›แด€สŸ แด…แด‡ แด‡ษดแด ษชแด:* ${time2}\n${totalPri2 >= 500000 ? `\n*๐๐Ž๐“๐€: ๐„๐ฌ ๐ฉ๐จ๐ฌ๐ข๐›๐ฅ๐ž ๐ช๐ฎ๐ž ๐ญ๐ž๐ง๐ ๐š ๐Ÿ๐š๐ฅ๐ฅ๐จ๐ฌ ๐ž๐ฌ๐ญ๐ž ๐œ๐จ๐ฆ๐š๐ง๐๐จ ๐ฒ ๐ง๐จ ๐ฌ๐ž ๐ž๐ง๐ฏ๐ข๐ž ๐š ๐ญ๐จ๐๐จ๐ฌ ๐ฅ๐จ๐ฌ ๐œ๐ก๐š๐ญ๐ฌ, ๐๐ข๐ฌ๐œ๐ฎ๐ฅ๐ฉ๐ž ๐ฉ๐จ๐ซ ๐ž๐ฅ ๐ฆ๐จ๐ฆ๐ž๐ง๐ญ๐จ*` : ''}`); } handler.help = ['broadcast', 'bc'].map(v => v + ' ') handler.tags = ['owner'] handler.command = /^(comunicar|comunicado|broadcastall|bc)$/i handler.owner = true export default handler const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) const more = String.fromCharCode(8206) const readMore = more.repeat(4001) const randomID = length => randomBytes(Math.ceil(length * .5)).toString('hex').slice(0, length)