mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Add "+" to the beginning of jids if not present in the onWhatsApp method
In Baileys 5.x a "+" was always added at the beginning of the jids provided to the onWhatsApp method. This was removed later in the 6.x version and has created a subtle problem. Many phone numbers where correctly verified but for some reason french mobile number (starting with 336 or 337) always returned an undefined result (maybe there were problems with some other countries too, I couldn't verify). Adding back the "+" (if missing) should fix the problem.
This commit is contained in:
committed by
Codeboss
parent
bdbff517ce
commit
1d57f38323
@@ -168,15 +168,19 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
|
||||
const onWhatsApp = async(...jids: string[]) => {
|
||||
const query = { tag: 'contact', attrs: {} }
|
||||
const list = jids.map((jid) => ({
|
||||
tag: 'user',
|
||||
attrs: {},
|
||||
content: [{
|
||||
tag: 'contact',
|
||||
const list = jids.map((jid) => (
|
||||
const content = (!jid.startsWith('+')) ? `+${jid}` : jid;
|
||||
|
||||
return {
|
||||
tag: 'user',
|
||||
attrs: {},
|
||||
content: jid,
|
||||
}],
|
||||
}))
|
||||
content: [{
|
||||
tag: 'contact',
|
||||
attrs: {},
|
||||
content,
|
||||
}],
|
||||
}
|
||||
))
|
||||
const results = await interactiveQuery(list, query)
|
||||
|
||||
return results.map(user => {
|
||||
|
||||
Reference in New Issue
Block a user