-
Notifications
You must be signed in to change notification settings - Fork 825
/
broadcastgroups.js
33 lines (27 loc) · 1.21 KB
/
broadcastgroups.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
let handler = async (m, { conn, text }) => {
let groups = conn.chats.all().filter(v => v.jid.endsWith('g.us')).map(v => v.jid)
let cc = text ? m : m.quoted ? await m.getQuotedObj() : false || m
let teks = text ? text : cc.text
conn.reply(m.chat, `_Send a broadcast message to ${groups.length} group_\estimate completed ${groups.length * 1.5} second`, m)
for (let id of groups) {
await delay(1500)
await conn.copyNForward(id, conn.cMod(m.chat, cc, /bc|broadcast/i.test(teks) ? teks : '*〔 Wizard-Ser Broadcast 〕*\n\n' + teks + '\n\n' + watermark), true).catch(_ => _)
}
m.reply('_*Broadcast Completed*_')
}
handler.help = ['broadcastgroup', 'bcgc'].map(v => v + ' <text>')
handler.tags = ['owner']
handler.command = /^(broadcast|bc)(group|grup|gc)$/i
handler.owner = true
handler.mods = false
handler.premium = false
handler.group = false
handler.private = false
handler.admin = false
handler.botAdmin = false
handler.fail = null
module.exports = handler
const more = String.fromCharCode(8206)
const readMore = more.repeat(4001)
const randomID = length => require('crypto').randomBytes(Math.ceil(length * .5)).toString('hex').slice(0, length)
const delay = time => new Promise(res => setTimeout(res, time))