fix: onWhatsApp query for multiple jids (#85)

This commit is contained in:
Adrien
2023-05-26 19:12:58 +08:00
committed by GitHub
parent 720fd3d003
commit bb25723b6a

View File

@@ -167,22 +167,17 @@ export const makeChatsSocket = (config: SocketConfig) => {
}
const onWhatsApp = async(...jids: string[]) => {
const results = await interactiveQuery(
[
{
tag: 'user',
attrs: {},
content: jids.map(
jid => ({
tag: 'contact',
attrs: {},
content: `+${jid}`
})
)
}
],
{ tag: 'contact', attrs: {} }
)
const query = { tag: 'contact', attrs: {} }
const list = jids.map((jid) => ({
tag: 'user',
attrs: {},
content: [{
tag: 'contact',
attrs: {},
content: jid,
}],
}))
const results = await interactiveQuery(list, query)
return results.map(user => {
const contact = getBinaryNodeChild(user, 'contact')