Closed JoaoNetoDev closed 2 years ago
I don't know how to use Baileys functions...
If you can at least guide how I invoke the functions that are on the path "Baileys/src/WABinary/jid-utils.ts", I think I can do the rest...
If you can at least guide how I invoke the functions that are on the path "Baileys/src/WABinary/jid-utils.ts", I think I can do the rest..
If you can at least guide how I invoke the functions that are on the path "Baileys/src/WABinary/jid-utils.ts", I think I can do the rest..
@salman0ansari
It is like this:
getWhatsAppId(id) {
if (id.includes('@g.us') || id.includes('@s.whatsapp.net')) return id
return id.includes('-') ? ${id}@g.us
: ${id}@s.whatsapp.net
}
It should be like this: async getWhatsAppId2(id) { const jidFull = await this.instance.sock?.onWhatsApp(id) return jidFull }
The difference in results:
"this is": "55849XXXXXXXX@s.whatsapp.net", "must be": [ { "exists": true, "jid": "5584XXXXXXXX@s.whatsapp.net" } ]
Do you think we can push this? Or disagree?
If you can at least guide how I invoke the functions that are on the path "Baileys/src/WABinary/jid-utils.ts", I think I can do the rest..
@salman0ansari
* It is like this: getWhatsAppId(id) { if (id.includes('@g.us') || id.includes('@s.whatsapp.net')) return id return id.includes('-') ? `${id}@g.us` : `${id}@s.whatsapp.net` } * It should be like this: async getWhatsAppId2(id) { const jidFull = await this.instance.sock?.onWhatsApp(id) return jidFull }
The difference in results:
"this is": "55849XXXXXXXX@s.whatsapp.net", "must be": [ { "exists": true, "jid": "5584XXXXXXXX@s.whatsapp.net" } ]
Do you think we can push this? Or disagree?
The onWhatsapp function (present in instance.sock) already returns if the account exists (true or false) and the JID, in the correct way, regardless of the ninth digit or if not allowing it...
If I request this function with the ninth digit, but the JID doesn't have it, it returns with eight... In this case, it shouldn't be requested without the ninth digit, but that's not a problem because the systems in Brazil already work with this new one mobile number format that has already spread across the nation...
I also think this function will operate normally for any country as the function enhances the JID return feature only...
Sorry to come back to this topic...
But I followed the instruction received here to look for support at Baileys... There they told me that the isUser function correctly returns the JID, and that the sending is successful through the JID.
But here, I put to return the JID in onWhatsapp and it erroneously brings me with nine on the left in accounts that do not allow this and the sending gives an error consequently.
My knowledge is still too little for me to correct myself... so if you can help me, I'm grateful!