Spaces:
Paused
Paused
File size: 1,571 Bytes
bb69f9b |
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
const { bot, PREFIX, getNumbers, jidToNum } = require('../lib')
bot(
{
pattern: 'ison ?(.*)',
desc: 'List number in whatsapp',
type: 'search',
},
async (message, match) => {
if (!match) return message.send(`*Example :* ${PREFIX}ison 9198765432x0`)
const numbers = getNumbers(match.replace('+', ''))
const ison = await message.onWhatsapp(numbers)
if (!ison.length) {
let msg = ''
msg += `*Not Exist on Whatsapp* (${numbers.length})\n`
for (const num of numbers) msg += `+${num}\n`
return await message.send(msg.trim())
}
const about = await message.fetchStatus(ison.map((e) => e.jid))
const exist = []
const x403 = []
about.forEach((item) => (item.status ? exist.push(item) : x403.push(jidToNum(item.id))))
const not = ison.filter((item) => !item.exist).map((item) => jidToNum(item.jid))
let msg = ''
if (not.length) {
msg += `*Not Exist on Whatsapp* (${not.length})\n`
for (const num of not) msg += `+${num}\n`
}
if (exist.length) {
msg += `\n*Exist on Whatsapp* (${exist.length})\n`
for (const about of exist) {
const num = jidToNum(about.id)
msg += `@${num}\n*Number :* +${num}\n*About :* ${about.status}\n*Date :* ${about.date}\n\n`
}
}
if (x403.length) {
msg += `*Privacy Settings on* (${x403.length})\n`
for (const num of x403) msg += `+${num}\n`
}
const mentionedJid = exist.map((user) => user.id)
return await message.send(msg.trim(), { contextInfo: { mentionedJid } })
}
)
|