@open-wa/wa-automate 4.22.5 → 4.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/Client.d.ts +3 -3
- package/dist/api/Client.js +7 -7
- package/dist/cli/server.js +14 -1
- package/dist/controllers/initializer.js +1 -1
- package/package.json +1 -1
package/dist/api/Client.d.ts
CHANGED
@@ -535,7 +535,7 @@ export declare class Client {
|
|
535
535
|
* @param hideTags boolean default: false [INSIDERS] set this to try silent tag someone in the caption
|
536
536
|
* @returns Promise <boolean | string> This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
|
537
537
|
*/
|
538
|
-
sendImage(to: ChatId, file: DataURL | FilePath, filename: string, caption: Content, quotedMsgId?: MessageId, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean): Promise<MessageId | boolean>;
|
538
|
+
sendImage(to: ChatId, file: DataURL | FilePath, filename: string, caption: Content, quotedMsgId?: MessageId, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean, viewOnce?: boolean): Promise<MessageId | boolean>;
|
539
539
|
/**
|
540
540
|
* Automatically sends a youtube link with the auto generated link preview. You can also add a custom message.
|
541
541
|
* @param chatId
|
@@ -594,7 +594,7 @@ export declare class Client {
|
|
594
594
|
* @param hideTags boolean default: false [INSIDERS] set this to try silent tag someone in the caption
|
595
595
|
* @returns Promise <boolean | MessageId> This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
|
596
596
|
*/
|
597
|
-
sendFile(to: ChatId, file: DataURL | FilePath, filename: string, caption: Content, quotedMsgId?: MessageId, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean): Promise<MessageId | boolean>;
|
597
|
+
sendFile(to: ChatId, file: DataURL | FilePath, filename: string, caption: Content, quotedMsgId?: MessageId, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean, viewOnce?: boolean): Promise<MessageId | boolean>;
|
598
598
|
/**
|
599
599
|
* [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
600
600
|
*
|
@@ -647,7 +647,7 @@ export declare class Client {
|
|
647
647
|
* @param ptt boolean default: false set this to true if you want to send the file as a push to talk file.
|
648
648
|
* @param withoutPreview boolean default: false set this to true if you want to send the file without a preview (i.e as a file). This is useful for preventing auto downloads on recipient devices.
|
649
649
|
*/
|
650
|
-
sendFileFromUrl(to: ChatId, url: string, filename: string, caption: Content, quotedMsgId?: MessageId, requestConfig?: AxiosRequestConfig, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean): Promise<MessageId | boolean>;
|
650
|
+
sendFileFromUrl(to: ChatId, url: string, filename: string, caption: Content, quotedMsgId?: MessageId, requestConfig?: AxiosRequestConfig, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean, viewOnce?: boolean): Promise<MessageId | boolean>;
|
651
651
|
/**
|
652
652
|
* Returns an object with all of your host device details
|
653
653
|
*/
|
package/dist/api/Client.js
CHANGED
@@ -1313,7 +1313,7 @@ class Client {
|
|
1313
1313
|
* @param hideTags boolean default: false [INSIDERS] set this to try silent tag someone in the caption
|
1314
1314
|
* @returns Promise <boolean | string> This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
|
1315
1315
|
*/
|
1316
|
-
sendImage(to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags) {
|
1316
|
+
sendImage(to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags, viewOnce) {
|
1317
1317
|
return __awaiter(this, void 0, void 0, function* () {
|
1318
1318
|
//check if the 'base64' file exists
|
1319
1319
|
if (!tools_1.isDataURL(file) && !tools_1.isBase64(file) && !file.includes("data:")) {
|
@@ -1323,7 +1323,7 @@ class Client {
|
|
1323
1323
|
file = yield datauri_1.default(fs.existsSync(file) ? file : relativePath);
|
1324
1324
|
}
|
1325
1325
|
else if (is_url_superb_1.default(file)) {
|
1326
|
-
return yield this.sendFileFromUrl(to, file, filename, caption, quotedMsgId, {}, waitForId, ptt, withoutPreview, hideTags);
|
1326
|
+
return yield this.sendFileFromUrl(to, file, filename, caption, quotedMsgId, {}, waitForId, ptt, withoutPreview, hideTags, viewOnce);
|
1327
1327
|
}
|
1328
1328
|
else
|
1329
1329
|
throw new errors_1.CustomError(errors_1.ERROR_NAME.FILE_NOT_FOUND, `Cannot find file. Make sure the file reference is relative, a valid URL or a valid DataURL: ${file.slice(0, 25)}`);
|
@@ -1337,7 +1337,7 @@ class Client {
|
|
1337
1337
|
'Error: Number not linked to WhatsApp Account',
|
1338
1338
|
'ERROR: Please make sure you have at least one chat'
|
1339
1339
|
];
|
1340
|
-
const res = yield this.pup(({ to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags }) => WAPI.sendImage(file, to, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags), { to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags });
|
1340
|
+
const res = yield this.pup(({ to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags, viewOnce }) => WAPI.sendImage(file, to, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags, viewOnce), { to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags, viewOnce });
|
1341
1341
|
if (err.includes(res))
|
1342
1342
|
console.error(res);
|
1343
1343
|
return (err.includes(res) ? false : res);
|
@@ -1419,9 +1419,9 @@ class Client {
|
|
1419
1419
|
* @param hideTags boolean default: false [INSIDERS] set this to try silent tag someone in the caption
|
1420
1420
|
* @returns Promise <boolean | MessageId> This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
|
1421
1421
|
*/
|
1422
|
-
sendFile(to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags) {
|
1422
|
+
sendFile(to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags, viewOnce) {
|
1423
1423
|
return __awaiter(this, void 0, void 0, function* () {
|
1424
|
-
return this.sendImage(to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags);
|
1424
|
+
return this.sendImage(to, file, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags, viewOnce);
|
1425
1425
|
});
|
1426
1426
|
}
|
1427
1427
|
/**
|
@@ -1531,10 +1531,10 @@ class Client {
|
|
1531
1531
|
* @param ptt boolean default: false set this to true if you want to send the file as a push to talk file.
|
1532
1532
|
* @param withoutPreview boolean default: false set this to true if you want to send the file without a preview (i.e as a file). This is useful for preventing auto downloads on recipient devices.
|
1533
1533
|
*/
|
1534
|
-
sendFileFromUrl(to, url, filename, caption, quotedMsgId, requestConfig = {}, waitForId, ptt, withoutPreview, hideTags) {
|
1534
|
+
sendFileFromUrl(to, url, filename, caption, quotedMsgId, requestConfig = {}, waitForId, ptt, withoutPreview, hideTags, viewOnce) {
|
1535
1535
|
return __awaiter(this, void 0, void 0, function* () {
|
1536
1536
|
const base64 = yield tools_1.getDUrl(url, requestConfig);
|
1537
|
-
return yield this.sendFile(to, base64, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags);
|
1537
|
+
return yield this.sendFile(to, base64, filename, caption, quotedMsgId, waitForId, ptt, withoutPreview, hideTags, viewOnce);
|
1538
1538
|
});
|
1539
1539
|
}
|
1540
1540
|
/**
|
package/dist/cli/server.js
CHANGED
@@ -250,7 +250,20 @@ const setupBotPressHandler = (cliConfig, client) => {
|
|
250
250
|
if (response.type == "file") {
|
251
251
|
return client.sendFile(chatId, response.url, `file.${response.url.split(/[#?]/)[0].split('.').pop().trim()}`, response.title || "");
|
252
252
|
}
|
253
|
-
if (response.type == "
|
253
|
+
if (response.type == "image") {
|
254
|
+
return client.sendFile(chatId, response.image, `file.${response.image.split(/[#?]/)[0].split('.').pop().trim()}`, response.title || "");
|
255
|
+
}
|
256
|
+
if (response.type == "single-choice") {
|
257
|
+
if (response["choices"] && response["choices"].length >= 1 && response["choices"].length <= 3) {
|
258
|
+
return client.sendButtons(chatId, response.text, response["choices"].map(qr => {
|
259
|
+
return {
|
260
|
+
id: qr.value,
|
261
|
+
text: qr.title
|
262
|
+
};
|
263
|
+
}), "");
|
264
|
+
}
|
265
|
+
}
|
266
|
+
if (response.type == "quick_replies") {
|
254
267
|
if (response["quick_replies"] && response["quick_replies"].length >= 1 && response["quick_replies"].length <= 3) {
|
255
268
|
return client.sendButtons(chatId, response.wrapped.text, response["quick_replies"].map(qr => {
|
256
269
|
return {
|
@@ -277,8 +277,8 @@ function create(config = {}) {
|
|
277
277
|
}
|
278
278
|
if (attemptingReauth) {
|
279
279
|
yield waPage.evaluate("window.Store = undefined");
|
280
|
-
spinner.start("Waiting for ripe session...");
|
281
280
|
if (config === null || config === void 0 ? void 0 : config.waitForRipeSession) {
|
281
|
+
spinner.start("Waiting for ripe session...");
|
282
282
|
if (yield auth_1.waitForRipeSession(waPage))
|
283
283
|
spinner.succeed("Session ready for injection");
|
284
284
|
else
|
package/package.json
CHANGED