owner-bcgc.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { randomBytes } from 'crypto'
  2. let handler = async (m, { conn, command, participants, usedPrefix, text }) => {
  3. 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]" }
  4. if (!text && !m.quoted) return m.reply('*โš ๏ธ ๐ˆ๐ง๐ ๐ซ๐ž๐ฌ๐ž ๐ž๐ฅ ๐ฆ๐ž๐ง๐ฌ๐š๐ฃ๐ž ๐ช๐ฎ๐ž ๐ช๐ฎ๐ข๐ž๐ซ๐ž ๐ญ๐ซ๐š๐ฆ๐ข๐ญ๐ž*')
  5. let users = participants.map(u => conn.decodeJid(u.id))
  6. let cc2 = text ? m : m.quoted ? await m.getQuotedObj() : false || m
  7. let teks2 = text ? text : cc2.text
  8. //let d = new Date(new Date + 3600000)
  9. //let locale = lenguajeGB.lenguaje()
  10. //let dia = d.toLocaleDateString(locale, { weekday: 'long' })
  11. //let fecha = d.toLocaleDateString(lenguajeGB.lenguaje(), { day: 'numeric', month: 'numeric', year: 'numeric' })
  12. //let mes = d.toLocaleDateString(", { month: 'long' })
  13. //let aรฑo = d.toLocaleDateString(lenguajeGB.lenguaje(), { year: 'numeric' })
  14. //let tiempo = d.toLocaleString('es-CO', { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true })
  15. let groups = Object.keys(await conn.groupFetchAllParticipating())
  16. let usersTag = participants.map(u => conn.decodeJid(u.id))
  17. let readMS = String.fromCharCode(8206).repeat(850)
  18. await m.reply(`*Enviando mensaje oficial, espere un momento...*`)
  19. for (let i = 0; i < groups.length; i++) {
  20. const id = groups[i];
  21. //const infoGP = lenguajeGB.smsChatGP2(readMS, dia, mes, aรฑo, fecha, tiempo)
  22. const delay = i * 4000 //4 seg
  23. setTimeout(async () => {
  24. await conn.sendMessage(id, { text: `โœ… *COMUNICADO OFICIAL* โœ…\n\n` + teks2, mentions: [m.sender], mentions: (await conn.groupMetadata(id)).participants.map(v => v.id) }, { quoted: fkontak })
  25. //await conn.reply(id, infoGP + teks2, { mentions: (await conn.groupMetadata(id)).participants.map(v => v.id) }, { quoted: fkontak });
  26. }, delay)}
  27. let totalGP = groups.length
  28. await m.reply(`โœ… ๐Œ๐ž๐ง๐ฌ๐š๐ฃ๐ž ๐ž๐ง๐ฏ๐ข๐š๐๐จ ๐š ${groups.length} ๐†๐ซ๐ฎ๐ฉ๐จ/๐ฌ*\n\n*๐๐Ž๐“๐€: ๐„๐ฌ ๐ฉ๐จ๐ฌ๐ข๐›๐ฅ๐ž ๐ช๐ฎ๐ž ๐ญ๐ž๐ง๐ ๐š ๐Ÿ๐š๐ฅ๐ฅ๐จ๐ฌ ๐ž๐ฌ๐ญ๐ž ๐œ๐จ๐ฆ๐š๐ง๐๐จ ๐ฒ ๐ง๐จ ๐ฌ๐ž ๐ž๐ง๐ฏ๐ข๐ž ๐š ๐ญ๐จ๐๐จ๐ฌ ๐ฅ๐จ๐ฌ ๐œ๐ก๐š๐ญ๐ฌ, ๐๐ข๐ฌ๐œ๐ฎ๐ฅ๐ฉ๐ž ๐ฉ๐จ๐ซ ๐ž๐ฅ ๐ฆ๐จ๐ฆ๐ž๐ง๐ญ๐จ*`)
  29. }
  30. handler.help = ['broadcastgroup', 'bcgc'].map(v => v + ' <teks>')
  31. handler.tags = ['owner']
  32. handler.command = /^(broadcast|bc)(group|grup|gc)$/i
  33. handler.owner = true
  34. export default handler
  35. const more = String.fromCharCode(8206)
  36. const readMore = more.repeat(4001)
  37. const delay = time => new Promise(res => setTimeout(res, time))