@open-wa/wa-automate 4.35.6 → 4.35.9

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.
@@ -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
@@ -258,7 +258,7 @@ class Client {
258
258
  if ((((_d = this._createConfig) === null || _d === void 0 ? void 0 : _d.autoEmoji) === undefined || ((_e = this._createConfig) === null || _e === void 0 ? void 0 : _e.autoEmoji)) && !this._autoEmojiSet) {
259
259
  const ident = typeof ((_f = this._createConfig) === null || _f === void 0 ? void 0 : _f.autoEmoji) === "string" ? (_g = this._createConfig) === null || _g === void 0 ? void 0 : _g.autoEmoji : ":";
260
260
  this.onMessage((message) => __awaiter(this, void 0, void 0, function* () {
261
- if (message.body && message.body.startsWith(ident) && message.body.endsWith(ident)) {
261
+ if ((message === null || message === void 0 ? void 0 : message.body) && message.body.startsWith(ident) && message.body.endsWith(ident)) {
262
262
  const emojiId = message.body.replace(new RegExp(ident, 'g'), "");
263
263
  if (!emojiId)
264
264
  return;
@@ -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
- logging_1.log.info(`IN ${invocation_id}`, Object.assign({ _method: (wapis === null || wapis === void 0 ? void 0 : wapis.length) === 1 ? wapis[0] : wapis }, args[0]));
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
  /**
@@ -341,6 +341,10 @@ function create(config = {}) {
341
341
  WAToken1: localStorage.WAToken1,
342
342
  WAToken2: localStorage.WAToken2
343
343
  };
344
+ if (config.multiDevice) {
345
+ delete sessionData.WABrowserId;
346
+ logging_1.log.info("Multi-device detected. Removing Browser ID from session data to prevent session reauth corruption");
347
+ }
344
348
  const sdB64 = Buffer.from(JSON.stringify(sessionData)).toString('base64');
345
349
  spinner.emit(sessionData, "sessionData");
346
350
  spinner.emit(sdB64, "sessionDataBase64");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.35.6",
3
+ "version": "4.35.9",
4
4
  "licenseCheckUrl": "https://funcs.openwa.dev/license-check",
5
5
  "brokenMethodReportUrl": "https://funcs.openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",