feat : Check if the given number is a whatsapp number (#54)

* feat : Check if the given number is a whatsapp number

- Avoids sending message to non whatsapp number
- Gets the id of the user from whatsapp server rather than generating on client
This commit is contained in:
sahalMoidu
2020-02-17 18:40:07 +05:30
committed by GitHub
parent 6ade08e814
commit 1840826e2b
3 changed files with 17 additions and 7 deletions

View File

@@ -25,7 +25,13 @@ exports.ExposeStore = (moduleRaidStr) => {
exports.LoadUtils = () => {
window.WWebJS = {};
window.WWebJS.getNumberId = async (id) => {
let result = await window.Store.Wap.queryExist(id);
if (result.jid === undefined)
throw 'The number provided is not a registered whatsapp user';
return result.jid;
};
window.WWebJS.sendMessage = async (chat, content, options = {}) => {
let attOptions = {};
if (options.attachment) {