@open-wa/wa-automate 4.35.7 → 4.35.10
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
CHANGED
|
@@ -467,13 +467,12 @@ export declare class Client {
|
|
|
467
467
|
* "@4474747474747 how are you?"
|
|
468
468
|
* Basically, add a @ symbol before the number of the contact you want to mention.
|
|
469
469
|
*
|
|
470
|
-
* Please note that the hideTag parameter only works with an Insider's License Key
|
|
471
|
-
*
|
|
472
470
|
* @param to chat id: `xxxxx@c.us`
|
|
473
471
|
* @param content text message
|
|
474
472
|
* @param hideTags Removes all tags within the message
|
|
473
|
+
* @param mentions You can optionally add an array of contact IDs to tag only specific people
|
|
475
474
|
*/
|
|
476
|
-
sendTextWithMentions(to: ChatId, content: Content, hideTags?: boolean): Promise<boolean | MessageId>;
|
|
475
|
+
sendTextWithMentions(to: ChatId, content: Content, hideTags?: boolean, mentions?: ContactId[]): Promise<boolean | MessageId>;
|
|
477
476
|
/**
|
|
478
477
|
* [UNTESTED - REQUIRES FEEDBACK]
|
|
479
478
|
* Sends a payment request message to given chat
|
package/dist/api/Client.js
CHANGED
|
@@ -479,7 +479,11 @@ class Client {
|
|
|
479
479
|
if (logging) {
|
|
480
480
|
const wapis = (_e = (((_d = pageFunction === null || pageFunction === void 0 ? void 0 : pageFunction.toString()) === null || _d === void 0 ? void 0 : _d.match(/WAPI\.(\w*)\(/g)) || [])) === null || _e === void 0 ? void 0 : _e.map(s => s.replace(/WAPI|\.|\(/g, ''));
|
|
481
481
|
_t = Date.now();
|
|
482
|
-
|
|
482
|
+
const _args = ["string", "number", "boolean"].includes(typeof args[0]) ? args[0] : Object.assign({}, args[0]);
|
|
483
|
+
logging_1.log.info(`IN ${invocation_id}`, {
|
|
484
|
+
_method: (wapis === null || wapis === void 0 ? void 0 : wapis.length) === 1 ? wapis[0] : wapis,
|
|
485
|
+
_args
|
|
486
|
+
});
|
|
483
487
|
}
|
|
484
488
|
if (callTimeout)
|
|
485
489
|
return yield Promise.race([this._page.evaluate(pageFunction, ...args), new Promise((resolve, reject) => { var _a; return setTimeout(reject, (_a = this._createConfig) === null || _a === void 0 ? void 0 : _a.callTimeout, new errors_1.PageEvaluationTimeout()); })]);
|
|
@@ -1239,20 +1243,19 @@ class Client {
|
|
|
1239
1243
|
* "@4474747474747 how are you?"
|
|
1240
1244
|
* Basically, add a @ symbol before the number of the contact you want to mention.
|
|
1241
1245
|
*
|
|
1242
|
-
* Please note that the hideTag parameter only works with an Insider's License Key
|
|
1243
|
-
*
|
|
1244
1246
|
* @param to chat id: `xxxxx@c.us`
|
|
1245
1247
|
* @param content text message
|
|
1246
1248
|
* @param hideTags Removes all tags within the message
|
|
1249
|
+
* @param mentions You can optionally add an array of contact IDs to tag only specific people
|
|
1247
1250
|
*/
|
|
1248
|
-
sendTextWithMentions(to, content, hideTags) {
|
|
1251
|
+
sendTextWithMentions(to, content, hideTags, mentions) {
|
|
1249
1252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1250
1253
|
//remove all @c.us from the content
|
|
1251
1254
|
content = content.replace(/@c.us/, "");
|
|
1252
|
-
return yield this.pup(({ to, content, hideTags }) => {
|
|
1255
|
+
return yield this.pup(({ to, content, hideTags, mentions }) => {
|
|
1253
1256
|
WAPI.sendSeen(to);
|
|
1254
|
-
return WAPI.sendMessageWithMentions(to, content, hideTags);
|
|
1255
|
-
}, { to, content, hideTags });
|
|
1257
|
+
return WAPI.sendMessageWithMentions(to, content, hideTags, mentions);
|
|
1258
|
+
}, { to, content, hideTags, mentions });
|
|
1256
1259
|
});
|
|
1257
1260
|
}
|
|
1258
1261
|
/**
|
|
@@ -75,7 +75,7 @@ exports.pkg = (0, fs_extra_1.readJsonSync)(path.join(__dirname, '../../package.j
|
|
|
75
75
|
*/
|
|
76
76
|
//@ts-ignore
|
|
77
77
|
function create(config = {}) {
|
|
78
|
-
var _a, _b, _c;
|
|
78
|
+
var _a, _b, _c, _d;
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
const START_TIME = Date.now();
|
|
81
81
|
if (config.logging) {
|
|
@@ -151,6 +151,8 @@ function create(config = {}) {
|
|
|
151
151
|
const qrManager = new auth_1.QRManager(config);
|
|
152
152
|
const RAM_INFO = `Total: ${parseFloat(`${os.totalmem() / 1000000000}`).toFixed(2)} GB | Free: ${parseFloat(`${os.freemem() / 1000000000}`).toFixed(2)} GB`;
|
|
153
153
|
logging_1.log.info("RAM INFO", RAM_INFO);
|
|
154
|
+
const PPTR_VERSION = ((_a = (0, fs_extra_1.readJsonSync)(path.join(__dirname, '../../node_modules/puppeteer/package.json'), { throws: false })) === null || _a === void 0 ? void 0 : _a.version) || "UNKNOWN";
|
|
155
|
+
logging_1.log.info("PPTR VERSION INFO", PPTR_VERSION);
|
|
154
156
|
try {
|
|
155
157
|
if (typeof config === 'string')
|
|
156
158
|
console.error("AS OF VERSION 3+ YOU CAN NO LONGER SET THE SESSION ID AS THE FIRST PARAMETER OF CREATE. CREATE CAN ONLY TAKE A CONFIG OBJECT. IF YOU STILL HAVE CONFIGS AS A SECOND PARAMETER, THEY WILL HAVE NO EFFECT! PLEASE SEE DOCS.");
|
|
@@ -207,7 +209,8 @@ function create(config = {}) {
|
|
|
207
209
|
BROWSER_VERSION,
|
|
208
210
|
OS,
|
|
209
211
|
START_TS,
|
|
210
|
-
RAM_INFO
|
|
212
|
+
RAM_INFO,
|
|
213
|
+
PPTR_VERSION
|
|
211
214
|
};
|
|
212
215
|
if ((config === null || config === void 0 ? void 0 : config.logDebugInfoAsObject) || (config === null || config === void 0 ? void 0 : config.disableSpins))
|
|
213
216
|
spinner.succeed(`Debug info: ${JSON.stringify(debugInfo, null, 2)}`);
|
|
@@ -332,7 +335,7 @@ function create(config = {}) {
|
|
|
332
335
|
return JSON.stringify(window.localStorage);
|
|
333
336
|
}));
|
|
334
337
|
const stdSessionJsonPath = ((config === null || config === void 0 ? void 0 : config.sessionDataPath) && (config === null || config === void 0 ? void 0 : config.sessionDataPath.includes('.data.json'))) ? path.join(path.resolve(process.cwd(), (config === null || config === void 0 ? void 0 : config.sessionDataPath) || '')) : path.join(path.resolve(process.cwd(), (config === null || config === void 0 ? void 0 : config.sessionDataPath) || ''), `${sessionId || 'session'}.data.json`);
|
|
335
|
-
const altMainModulePath = ((
|
|
338
|
+
const altMainModulePath = ((_b = require === null || require === void 0 ? void 0 : require.main) === null || _b === void 0 ? void 0 : _b.path) || ((_c = process === null || process === void 0 ? void 0 : process.mainModule) === null || _c === void 0 ? void 0 : _c.path);
|
|
336
339
|
const altSessionJsonPath = !altMainModulePath ? null : ((config === null || config === void 0 ? void 0 : config.sessionDataPath) && (config === null || config === void 0 ? void 0 : config.sessionDataPath.includes('.data.json'))) ? path.join(path.resolve(altMainModulePath, (config === null || config === void 0 ? void 0 : config.sessionDataPath) || '')) : path.join(path.resolve(altMainModulePath, (config === null || config === void 0 ? void 0 : config.sessionDataPath) || ''), `${sessionId || 'session'}.data.json`);
|
|
337
340
|
const sessionjsonpath = altSessionJsonPath && fs.existsSync(altSessionJsonPath) ? altSessionJsonPath : stdSessionJsonPath;
|
|
338
341
|
const sessionData = {
|
|
@@ -454,7 +457,7 @@ function create(config = {}) {
|
|
|
454
457
|
console.error(error.stack);
|
|
455
458
|
}
|
|
456
459
|
yield (0, browser_1.kill)(waPage);
|
|
457
|
-
if (error.name === "ProtocolError" && ((
|
|
460
|
+
if (error.name === "ProtocolError" && ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes("Target closed"))) {
|
|
458
461
|
spinner.fail(error.message);
|
|
459
462
|
process.exit();
|
|
460
463
|
}
|
package/package.json
CHANGED