kyuurzy

Broadcast Channel WhatsApp

Oct 27th, 2025 (edited)
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.65 KB | Source Code | 0 0
  1.             case "broadcast": {
  2.                 if (!text || !text.includes("|")) return reply(`- *example:* ${prefix + command} url|info|title`)
  3.                 const [url, display_text, topic] = text.split("|").map(v => v.trim())
  4.                 const data = await sock.newsletterFetchAllSubscribe()
  5.                 const ids = data.filter(v => v.viewer_metadata?.role === "ADMIN").map(v => v.id)
  6.                
  7.                 const interactiveMessage = {
  8.                     title: topic,
  9.                     footer: "telegram: @yumevtc",
  10.                     image: { url: "https://github.com/kiuur.png" },
  11.                     nativeFlowMessage: {
  12.                         messageParamsJson: JSON.stringify({
  13.                             bottom_sheet: {
  14.                                 list_title: "Menu"
  15.                             }
  16.                         }),
  17.                         buttons: [
  18.                             {
  19.                                 name: "cta_url",
  20.                                 buttonParamsJson: JSON.stringify({
  21.                                     display_text: display_text,
  22.                                     url: url
  23.                                 })
  24.                             }
  25.                         ]
  26.                     }
  27.                 }
  28.                 for (const jid of ids) {
  29.                     await sock.sendMessage(jid, { interactiveMessage })
  30.                     await new Promise(r => setTimeout(r, 4500))
  31.                 }
  32.                 await reply(`broadcast selesai ke ${ids.length} channel.`)
  33.             }
  34.             break
  35. // use baileys: "@whiskeysockets/baileys": "github:kiuur/baileys",
Advertisement
Add Comment
Please, Sign In to add comment