Skip to content

Commit

Permalink
Bug Fix: Response return
Browse files Browse the repository at this point in the history
  • Loading branch information
Orkestral authored and Orkestral committed Nov 18, 2022
1 parent 488fbf7 commit afea4e4
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions src/lib/wapi/functions/send-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,38 +69,6 @@ export async function sendButtons(to, title, buttons, subtitle) {
return WAPI.scope(to, true, 404, 'It is necessary to write a subtitle!');
}

// const chat = await WAPI.sendExist(to);

// if (chat && chat.status != 404 && chat.id) {
// let inChat = await WAPI.getchatId(chat.id).catch(() => {});

// if (inChat) {
// chat.lastReceivedKey._serialized = inChat._serialized;
// chat.lastReceivedKey.id = inChat.id;
// }

// const message = {
// id: newMsgId,
// ack: 0,
// from: fromwWid,
// to: chat.id,
// local: !0,
// self: 'out',
// t: parseInt(new Date().getTime() / 1000),
// isNewMsg: !0,
// type: 'chat',
// body: title,
// caption: title,
// content: title,
// footer: subtitle,
// isDynamicReplyButtonsMsg: true,
// isForwarded: false,
// isFromTemplate: false,
// invis: true,
// fromMe: false
// };
const wid = await WPP.contact.queryExists(to);

let options = {
useTemplateButtons: false,
createChat: true,
Expand All @@ -120,14 +88,11 @@ export async function sendButtons(to, title, buttons, subtitle) {

if (result.sendMsgResult._value === 'OK') {
let obj = WAPI.scope(newMsgId, false, result.sendMsgResult._value, null);
Object.assign(obj, wid);
return { wid: wid.wid, erro: false };
Object.assign(obj, m);
return obj;
} else {
let obj = WAPI.scope(newMsgId, true, result.sendMsgResult._value, null);
Object.assign(obj, wid);
Object.assign(obj, m);
return obj;
}
// } else {
// return chat;
// }
}

0 comments on commit afea4e4

Please sign in to comment.