diff --git a/.wwebjs_cache/2.3000.1017045687.html b/.wwebjs_cache/2.3000.1017045687.html
new file mode 100644
index 00000000..ffcdb277
--- /dev/null
+++ b/.wwebjs_cache/2.3000.1017045687.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+WhatsApp Web
+
+WhatsApp
Protegida com a criptografia de ponta a ponta
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.wwebjs_cache/2.3000.1017050905.html b/.wwebjs_cache/2.3000.1017050905.html
new file mode 100644
index 00000000..49778259
--- /dev/null
+++ b/.wwebjs_cache/2.3000.1017050905.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+WhatsApp Web
+
+WhatsApp
Protegida com a criptografia de ponta a ponta
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/package.json b/package.json
index 03d22873..5f2f3000 100644
--- a/package.json
+++ b/package.json
@@ -233,7 +233,7 @@
"washyourmouthoutwithsoap": "1.0.2",
"webdav-server": "2.6.2",
"whatsapp-cloud-api": "0.3.1",
- "whatsapp-web.js": "https://github.com/Julzk/whatsapp-web.js/tarball/jkr_hotfix_7",
+ "whatsapp-web.js": "1.26.1-alpha.1",
"winston": "3.14.2",
"ws": "8.18.0",
"yaml": "2.5.0",
diff --git a/packages/basic.gblib/services/DialogKeywords.ts b/packages/basic.gblib/services/DialogKeywords.ts
index c7b66846..fa6cf834 100644
--- a/packages/basic.gblib/services/DialogKeywords.ts
+++ b/packages/basic.gblib/services/DialogKeywords.ts
@@ -1429,7 +1429,7 @@ export class DialogKeywords {
);
GBLog.verbose(`Translated text(playMarkdown): ${text}.`);
- if (step) {
+ if (!isNaN(user.userSystemId)){
await min.conversationalService.sendText(min, step, text, user);
} else {
await min.conversationalService['sendOnConversation'](min, user, text);
diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts
index a43121d1..f8dc8849 100644
--- a/packages/core.gbapp/services/GBConversationalService.ts
+++ b/packages/core.gbapp/services/GBConversationalService.ts
@@ -1253,15 +1253,12 @@ export class GBConversationalService {
analytics.createMessage(min.instance.instanceId, conversation, null, text);
}
-
- try{
- // TODO: Remove MS BOT Framework and put GBNative.
-
- await step.context.sendActivity(text);
+ if (!isNaN(user.userSystemId)){
- } catch {
- await min.whatsAppDirectLine.sendToDevice(user.userSystemId,
- text);
+ await min.whatsAppDirectLine.sendToDevice(user.userSystemId, text);
+ }
+ else{
+ await step.context.sendActivity(text);
}
}
diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts
index 4128b78d..67d3799b 100644
--- a/packages/core.gbapp/services/GBMinService.ts
+++ b/packages/core.gbapp/services/GBMinService.ts
@@ -1329,20 +1329,21 @@ export class GBMinService {
const localFileName = path.join(localFolder, packagePath, 'cache', attachment.name);
let buffer;
- // if (url.startsWith('data:')) {
- // const base64Data = url.split(';base64,')[1];
- // buffer = Buffer.from(base64Data, 'base64');
- // } else {
- // const options = {
- // method: 'GET',
- // encoding: 'binary'
- // };
- // const res = await fetch(url, options);
- // buffer = arrayBufferToBuffer(await res.arrayBuffer());
- // }
- //write
- buffer = await fs.readFile(localFileName);
+ if (url.startsWith('data:')) {
+ const base64Data = url.split(';base64,')[1];
+ buffer = Buffer.from(base64Data, 'base64');
+ } else {
+ const options = {
+ method: 'GET',
+ encoding: 'binary'
+ };
+ const res = await fetch(url, options);
+ buffer = arrayBufferToBuffer(await res.arrayBuffer());
+ }
+
+ await fs.writeFile(localFileName, buffer);
+
return {
name: attachment.name,
filename: localFileName,
diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts
index cba9e982..0f1e2ce4 100644
--- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts
+++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts
@@ -159,10 +159,10 @@ export class WhatsappDirectLine extends GBService {
const createClient = async () => {
const client = (this.customClient = new Client({
puppeteer: await GBSSR.preparePuppeteer(localName),
- webVersionCache: {
- type: 'remote',
- remotePath: `https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/${webVersion}.html`
- }
+ // webVersionCache: {
+ // type: 'remote',
+ // remotePath: `https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/${webVersion}.html`
+ // }
}));
client.on(
'message',
@@ -226,7 +226,7 @@ export class WhatsappDirectLine extends GBService {
if (chat.isGroup) {
// await chat.clearMessages();
} else if (!chat.pinned) {
- await chat.delete();
+ //await chat.delete();
}
});
});
@@ -744,7 +744,7 @@ export class WhatsappDirectLine extends GBService {
}
}
- await this.customClient.sendMessage(to, attachment, { caption: caption });
+ await this.customClient.sendMessage(to, attachment, { caption: caption , viewOnce});
break;
}
@@ -923,7 +923,7 @@ export class WhatsappDirectLine extends GBService {
}
- public async sendToDevice(to: any, msg: string, conversationId) {
+ public async sendToDevice(to: any, msg: string, conversationId, viewOnce= false) {
try {
const cmd = '/audio ';
let url;
@@ -984,7 +984,7 @@ export class WhatsappDirectLine extends GBService {
}
}
if ((await this.customClient.getState()) === WAState.CONNECTED) {
- await this.customClient.sendMessage(to, msg);
+ await this.customClient.sendMessage(to, msg, { isViewOnce: isViewOnce });
} else {
GBLogEx.info(this.min, `WhatsApp OFFLINE ${to}: ${msg}`);
}
@@ -1013,7 +1013,7 @@ export class WhatsappDirectLine extends GBService {
private async WhatsAppCallback(req, res, botId = null) {
try {
- if (!req.body && req.type !== 'ptt') {
+ if (!req.body && req.type !== 'ptt' && !req.hasMedia) {
return;
}