diff --git a/src/inject.js b/src/inject.js index 70fa4ec..bc72c05 100644 --- a/src/inject.js +++ b/src/inject.js @@ -154,17 +154,18 @@ async function processMessages(data) { WAPI.sendSeen(message.chatId._serialized); response = response.fillVariables({ name: message.sender.pushname, phoneNumber: message.sender.id.user, greetings: greetings() }) await waitBeforeSending(exactMatch, PartialMatch) - WAPI.sendMessage2(message.chatId._serialized, response); if (exactMatch != undefined || PartialMatch != undefined) { //returning if there is no file if ((exactMatch || PartialMatch).file != undefined) { files = await resolveSpintax((exactMatch || PartialMatch).file); window.getFile(files).then((base64Data) => { //console.log(file); - WAPI.sendImage(base64Data, message.chatId._serialized, (exactMatch || PartialMatch).file); + WAPI.sendImage(base64Data, message.chatId._serialized, (exactMatch || PartialMatch).file, response); }).catch((error) => { window.log("Error in sending file\n" + error); }) + } else { + WAPI.sendMessage2(message.chatId._serialized, response); } } //sending file if there is any