owner-bc.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // by https://github.com/elrebelde21 & https://github.com/GataNina-Li
  2. import { randomBytes } from 'crypto'
  3. let handler = async (m, { conn, command, participants, usedPrefix, text }) => {
  4. let fkontak = { "key": { "participants":"[email protected]", "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": "[email protected]" }
  5. if (!text && !m.quoted) return m.reply('*โš ๏ธ ๐ˆ๐ง๐ ๐ซ๐ž๐ฌ๐ž ๐ž๐ฅ ๐ฆ๐ž๐ง๐ฌ๐š๐ฃ๐ž ๐ช๐ฎ๐ž ๐ช๐ฎ๐ข๐ž๐ซ๐ž ๐ญ๐ซ๐š๐ฆ๐ข๐ญ๐ž*')
  6. let cc4 = text ? m : m.quoted ? await m.getQuotedObj() : false || m
  7. let teks4 = text ? text : cc4.text
  8. let groups2 = Object.keys(await conn.groupFetchAllParticipating())
  9. let chats2 = Object.keys(global.db.data.users).filter(user => user.endsWith('@s.whatsapp.net'))
  10. await conn.reply(m.chat, '*Enviando mensaje oficial, espere un momento...*', m);
  11. let start2 = new Date().getTime()
  12. let usersTag2 = participants.map(u => conn.decodeJid(u.id))
  13. let totalPri2 = 0
  14. for (let i = 0; i < groups2.length; i++) {
  15. const group = groups2[i];
  16. const delay = i * 4000; // 4 seg
  17. setTimeout(async () => {
  18. await conn.reply(group, `โœ… *COMUNICADO OFICIAL* โœ…\n\n` + teks4, { mentions: usersTag2 }, { quoted: fkontak });
  19. }, delay)}
  20. for (let user of chats2) {
  21. await new Promise(resolve => setTimeout(resolve, 2000)) // 2 segundos
  22. await delay(2 * 2000)
  23. await conn.reply(user, `โœ… *COMUNICADO OFICIAL* โœ…\n\n` + teks4, fkontak, null)
  24. totalPri2++
  25. if (totalPri2 >= 500000) {
  26. break
  27. }}
  28. let end2 = new Date().getTime()
  29. let totalPrivate2 = chats2.length
  30. let totalGroups2 = groups2.length
  31. let total2 = totalPrivate2 + totalGroups2
  32. let time2 = Math.floor((end2 - start2) / 1000)
  33. if (time2 >= 60) {
  34. let minutes = Math.floor(time2 / 60)
  35. let seconds = time2 % 60
  36. time2 = `${minutes} minutos y ${seconds} segundos`
  37. } else {
  38. time2 = `${time2} segundos`
  39. }
  40. await m.reply(`โœ… แดแด‡ษดsแด€แดŠแด‡ แด‡ษดแด ษชแด€แด…แด แด€:
  41. \`\`\`แด„สœแด€แด› แด˜ส€ษชแด แด€แด…แด >> ${totalPrivate2}\`\`\`
  42. \`\`\`แด„สœแด€แด› ษขส€แดœแด˜แดs >> ${totalGroups2}\`\`\`
  43. \`\`\`แด„สœแด€แด›s แด›แดแด›แด€สŸแด‡s >> ${total2}\`\`\`\n\n*โ€ข แด›ษชแด‡แดแด˜แด แด›แดแด›แด€สŸ แด…แด‡ แด‡ษดแด ษชแด:* ${time2}\n${totalPri2 >= 500000 ? `\n*๐๐Ž๐“๐€: ๐„๐ฌ ๐ฉ๐จ๐ฌ๐ข๐›๐ฅ๐ž ๐ช๐ฎ๐ž ๐ญ๐ž๐ง๐ ๐š ๐Ÿ๐š๐ฅ๐ฅ๐จ๐ฌ ๐ž๐ฌ๐ญ๐ž ๐œ๐จ๐ฆ๐š๐ง๐๐จ ๐ฒ ๐ง๐จ ๐ฌ๐ž ๐ž๐ง๐ฏ๐ข๐ž ๐š ๐ญ๐จ๐๐จ๐ฌ ๐ฅ๐จ๐ฌ ๐œ๐ก๐š๐ญ๐ฌ, ๐๐ข๐ฌ๐œ๐ฎ๐ฅ๐ฉ๐ž ๐ฉ๐จ๐ซ ๐ž๐ฅ ๐ฆ๐จ๐ฆ๐ž๐ง๐ญ๐จ*` : ''}`);
  44. }
  45. handler.help = ['broadcast', 'bc'].map(v => v + ' <teks>')
  46. handler.tags = ['owner']
  47. handler.command = /^(comunicar|comunicado|broadcastall|bc)$/i
  48. handler.owner = true
  49. export default handler
  50. const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
  51. const more = String.fromCharCode(8206)
  52. const readMore = more.repeat(4001)
  53. const randomID = length => randomBytes(Math.ceil(length * .5)).toString('hex').slice(0, length)