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))