feat: check if ID is a valid whatsapp user

close #120
This commit is contained in:
Pedro Lopez
2020-03-29 22:58:08 -04:00
parent 2dddc781c5
commit 842c4f0e06

View File

@@ -507,6 +507,17 @@ class Client extends EventEmitter {
});
}
/**
* Check if a given ID is registered in whatsapp
* @returns {Promise<Boolean>}
*/
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;