Skip to content

Commit

Permalink
fix: Error when checking number!
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed Mar 12, 2021
1 parent 4c32f86 commit 39d0f17
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/lib/wapi/functions/check-send-exist.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,16 @@ export async function sendExist(chatId, returnChat = true, Send = true) {
}
}

// Check chat exists (group is always a chat)
let chat = await window.WAPI.getChat(chatId);
let ck = await window.WAPI.checkNumberStatus(chatId);

// Check if contact number exists
if (!chat && !chatId.includes('@g')) {
let ck = await window.WAPI.checkNumberStatus(chatId);
if (!ck.numberExists) {
return scope(chatId, true, ck.status, 'The number does not exist');
}

if (!ck.numberExists) {
return scope(chatId, true, ck.status, 'The number does not exist');
}
let chat = await window.WAPI.getChat(chatId);

// Load chat ID for non contact
if (!chat && !chatId.includes('@g')) {
await window.Store.Chat.find(ck.id);

chatId = ck.id._serialized;
chat = await window.WAPI.getChat(chatId);
}
Expand Down

1 comment on commit 39d0f17

@jonalan7
Copy link
Contributor Author

@jonalan7 jonalan7 commented on 39d0f17 Mar 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checks correctly if the number exists! #720 #718

Please sign in to comment.