From 842c4f0e06ff7220c4f5e982973833489ed70930 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 29 Mar 2020 22:58:08 -0400 Subject: [PATCH] feat: check if ID is a valid whatsapp user close #120 --- src/Client.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Client.js b/src/Client.js index 0141cd5..a6985db 100644 --- a/src/Client.js +++ b/src/Client.js @@ -507,6 +507,17 @@ class Client extends EventEmitter { }); } + /** + * Check if a given ID is registered in whatsapp + * @returns {Promise} + */ + async isRegisteredUser(id) { + return await this.pupPage.evaluate(async (id) => { + let result = await window.Store.Wap.queryExist(id); + return result.jid !== undefined; + }, id); + } + } module.exports = Client;