@open-wa/wa-automate 4.36.2 → 4.36.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -386,12 +386,13 @@ export declare class Client {
386
386
  * Send VCARD
387
387
  *
388
388
  * @param {string} chatId '000000000000@c.us'
389
- * @param {string} vcard vcard as a string
390
- * @param {string} contactName The display name for the contact. CANNOT BE NULL OTHERWISE IT WILL SEND SOME RANDOM CONTACT FROM YOUR ADDRESS BOOK.
389
+ * @param {string} vcard vcard as a string, you can send multiple contacts vcard also.
390
+ * @param {string} contactName The display name for the contact. Ignored on multiple vcards
391
391
  * @param {string} contactNumber If supplied, this will be injected into the vcard (VERSION 3 ONLY FROM VCARDJS) with the WA id to make it show up with the correct buttons on WA. The format of this param should be including country code, without any other formating. e.g:
392
392
  * `4477777777777`
393
+ * Ignored on multiple vcards
393
394
  */
394
- sendVCard(chatId: ChatId, vcard: string, contactName: string, contactNumber?: string): Promise<boolean>;
395
+ sendVCard(chatId: ChatId, vcard: string, contactName?: string, contactNumber?: string): Promise<boolean>;
395
396
  /**
396
397
  * Set your profile name
397
398
  *
@@ -1062,10 +1062,11 @@ class Client {
1062
1062
  * Send VCARD
1063
1063
  *
1064
1064
  * @param {string} chatId '000000000000@c.us'
1065
- * @param {string} vcard vcard as a string
1066
- * @param {string} contactName The display name for the contact. CANNOT BE NULL OTHERWISE IT WILL SEND SOME RANDOM CONTACT FROM YOUR ADDRESS BOOK.
1065
+ * @param {string} vcard vcard as a string, you can send multiple contacts vcard also.
1066
+ * @param {string} contactName The display name for the contact. Ignored on multiple vcards
1067
1067
  * @param {string} contactNumber If supplied, this will be injected into the vcard (VERSION 3 ONLY FROM VCARDJS) with the WA id to make it show up with the correct buttons on WA. The format of this param should be including country code, without any other formating. e.g:
1068
1068
  * `4477777777777`
1069
+ * Ignored on multiple vcards
1069
1070
  */
1070
1071
  sendVCard(chatId, vcard, contactName, contactNumber) {
1071
1072
  return __awaiter(this, void 0, void 0, function* () {
@@ -2188,6 +2189,10 @@ class Client {
2188
2189
  return __awaiter(this, void 0, void 0, function* () {
2189
2190
  const membersIds = yield this.getGroupMembersId(groupId);
2190
2191
  logging_1.log.info("group members ids", membersIds);
2192
+ if (!Array.isArray(membersIds)) {
2193
+ console.error("group members ids is not an array", membersIds);
2194
+ return [];
2195
+ }
2191
2196
  const actions = membersIds.map(memberId => {
2192
2197
  return this.getContact(memberId);
2193
2198
  });
@@ -3511,6 +3516,8 @@ class Client {
3511
3516
  this._registeredWebhooks = {};
3512
3517
  const validListeners = [];
3513
3518
  events.map(event => {
3519
+ if (!event.startsWith("on"))
3520
+ event = `on${event}`;
3514
3521
  if (this[event]) {
3515
3522
  validListeners.push(event);
3516
3523
  if (this._registeredWebhookListeners[event] === undefined) {
@@ -10,6 +10,7 @@ export interface SessionInfo {
10
10
  START_TS?: number;
11
11
  PHONE_VERSION?: string;
12
12
  NUM_HASH?: string;
13
+ PATCH_HASH?: string;
13
14
  OW_KEY?: string;
14
15
  INSTANCE_ID?: string;
15
16
  RAM_INFO?: string;
package/dist/cli/index.js CHANGED
@@ -184,7 +184,6 @@ function start() {
184
184
  server_1.server.listen(PORT, () => __awaiter(this, void 0, void 0, function* () {
185
185
  spinner.succeed(`\n• Listening on port ${PORT}!`);
186
186
  (0, index_1.processSendData)({ port: PORT });
187
- yield ready(Object.assign(Object.assign(Object.assign(Object.assign({}, cliConfig), createConfig), client.getSessionInfo()), { hostAccountNumber: yield client.getHostNumber() }));
188
187
  }));
189
188
  process.on('message', function (data) {
190
189
  var _a;
@@ -199,6 +198,7 @@ function start() {
199
198
  if (cliConfig.tunnel) {
200
199
  spinner.info(`\n• Setting up external tunnel`);
201
200
  const tunnel = yield (0, localtunnel_1.default)({ port: PORT });
201
+ cliConfig.tunnel = tunnel.url;
202
202
  spinner.succeed(`\n\t${(0, terminal_link_1.default)('External address', tunnel.url)}`);
203
203
  }
204
204
  const apiDocsUrl = cliConfig.apiHost ? `${cliConfig.apiHost}/api-docs/ ` : `${cliConfig.host.includes('http') ? '' : 'http://'}${cliConfig.host}:${PORT}/api-docs/ `;
@@ -211,8 +211,7 @@ function start() {
211
211
  spinner.succeed(`\n\t${statsLink}`);
212
212
  }
213
213
  }
214
- else
215
- ready(Object.assign(Object.assign(Object.assign(Object.assign({}, cliConfig), createConfig), client.getSessionInfo()), { hostAccountNumber: yield client.getHostNumber() }));
214
+ yield ready(Object.assign(Object.assign(Object.assign(Object.assign({}, createConfig), cliConfig), client.getSessionInfo()), { hostAccountNumber: yield client.getHostNumber() }));
216
215
  if (cliConfig.emitUnread) {
217
216
  yield client.emitUnreadMessages();
218
217
  }
@@ -333,6 +333,7 @@ const setupSocketServer = (cliConfig, client) => __awaiter(void 0, void 0, void
333
333
  socketListenerCallbacks[socket.id] = {};
334
334
  });
335
335
  socket.onAny((m, ...args) => __awaiter(void 0, void 0, void 0, function* () {
336
+ __1.log.info("🔌", m);
336
337
  if (m === "register_ev") {
337
338
  __1.ev.onAny((event, value) => socket.emit(event, value));
338
339
  }
@@ -17,7 +17,7 @@ export declare function getPatch(config: ConfigObject, spinner?: Spin, sessionIn
17
17
  export declare function injectLivePatch(page: Page, patch: {
18
18
  data: any;
19
19
  tag: string;
20
- }, spinner?: Spin): Promise<void>;
20
+ }, spinner?: Spin): Promise<string>;
21
21
  /**
22
22
  * @private
23
23
  */
@@ -122,6 +122,7 @@ function injectLivePatch(page, patch, spinner) {
122
122
  spinner === null || spinner === void 0 ? void 0 : spinner.info('Installing patches');
123
123
  yield Promise.all(data.map(patch => page.evaluate(`${patch}`)));
124
124
  spinner === null || spinner === void 0 ? void 0 : spinner.succeed(`Patches Installed: ${tag}`);
125
+ return tag;
125
126
  });
126
127
  }
127
128
  exports.injectLivePatch = injectLivePatch;
@@ -133,7 +134,8 @@ function getAndInjectLivePatch(page, spinner, preloadedPatch, config, sessionInf
133
134
  let patch = preloadedPatch;
134
135
  if (!patch)
135
136
  patch = yield getPatch(config, spinner, sessionInfo);
136
- yield injectLivePatch(page, patch, spinner);
137
+ const patch_hash = yield injectLivePatch(page, patch, spinner);
138
+ sessionInfo.PATCH_HASH = patch_hash;
137
139
  });
138
140
  }
139
141
  exports.getAndInjectLivePatch = getAndInjectLivePatch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.36.2",
3
+ "version": "4.36.5",
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",