@arcaelas/whatsapp 8.2.0 → 8.2.1

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.
@@ -645,7 +645,7 @@ class WhatsApp {
645
645
  if (kind === 'encEventResponseMessage') {
646
646
  const enc = msg.message?.encEventResponseMessage;
647
647
  const key = enc?.eventCreationMessageKey;
648
- const found = key?.id && key.remoteJid ? await locate(key.remoteJid, key.id) : null;
648
+ const found = key?.id ? ((key.remoteJid ? await locate(key.remoteJid, key.id) : null) ?? (await locate(cid, key.id))) : null;
649
649
  const raw_secret = found?.doc.raw.message?.messageContextInfo?.messageSecret;
650
650
  const secret = typeof raw_secret === 'string' ? Buffer.from(raw_secret, 'base64') : raw_secret;
651
651
  if (found && secret && enc?.encPayload && enc.encIv) {
@@ -684,7 +684,7 @@ class WhatsApp {
684
684
  if (kind === 'pollUpdateMessage') {
685
685
  const key = msg.message?.pollUpdateMessage?.pollCreationMessageKey;
686
686
  const vote = msg.message?.pollUpdateMessage?.vote;
687
- const found = key?.id && key.remoteJid ? await locate(key.remoteJid, key.id) : null;
687
+ const found = key?.id ? ((key.remoteJid ? await locate(key.remoteJid, key.id) : null) ?? (await locate(cid, key.id))) : null;
688
688
  const raw_secret = found?.doc.raw.message?.messageContextInfo?.messageSecret;
689
689
  const secret = typeof raw_secret === 'string' ? Buffer.from(raw_secret, 'base64') : raw_secret;
690
690
  if (found && secret && vote?.encPayload && vote.encIv) {
@@ -607,7 +607,7 @@ export default class WhatsApp {
607
607
  if (kind === 'encEventResponseMessage') {
608
608
  const enc = msg.message?.encEventResponseMessage;
609
609
  const key = enc?.eventCreationMessageKey;
610
- const found = key?.id && key.remoteJid ? await locate(key.remoteJid, key.id) : null;
610
+ const found = key?.id ? ((key.remoteJid ? await locate(key.remoteJid, key.id) : null) ?? (await locate(cid, key.id))) : null;
611
611
  const raw_secret = found?.doc.raw.message?.messageContextInfo?.messageSecret;
612
612
  const secret = typeof raw_secret === 'string' ? Buffer.from(raw_secret, 'base64') : raw_secret;
613
613
  if (found && secret && enc?.encPayload && enc.encIv) {
@@ -646,7 +646,7 @@ export default class WhatsApp {
646
646
  if (kind === 'pollUpdateMessage') {
647
647
  const key = msg.message?.pollUpdateMessage?.pollCreationMessageKey;
648
648
  const vote = msg.message?.pollUpdateMessage?.vote;
649
- const found = key?.id && key.remoteJid ? await locate(key.remoteJid, key.id) : null;
649
+ const found = key?.id ? ((key.remoteJid ? await locate(key.remoteJid, key.id) : null) ?? (await locate(cid, key.id))) : null;
650
650
  const raw_secret = found?.doc.raw.message?.messageContextInfo?.messageSecret;
651
651
  const secret = typeof raw_secret === 'string' ? Buffer.from(raw_secret, 'base64') : raw_secret;
652
652
  if (found && secret && vote?.encPayload && vote.encIv) {
package/package.json CHANGED
@@ -72,7 +72,7 @@
72
72
  "release": "npm publish --access public"
73
73
  },
74
74
  "types": "./build/esm/index.d.ts",
75
- "version": "8.2.0",
75
+ "version": "8.2.1",
76
76
  "engines": {
77
77
  "node": ">=20"
78
78
  },