amiudmodz 6.2.9 → 6.3.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.
- package/lib/Foundation/ai-rich.d.ts +123 -0
- package/lib/Foundation/ai-rich.d.ts.map +1 -0
- package/lib/Foundation/ai-rich.js +542 -0
- package/lib/Foundation/ai-rich.js.map +1 -0
- package/lib/Foundation/audio-duration.d.ts +3 -0
- package/lib/Foundation/audio-duration.d.ts.map +1 -0
- package/lib/Foundation/audio-duration.js +514 -0
- package/lib/Foundation/audio-duration.js.map +1 -0
- package/lib/Foundation/audio-samples.d.ts +3 -0
- package/lib/Foundation/audio-samples.d.ts.map +1 -0
- package/lib/Foundation/audio-samples.js +294 -0
- package/lib/Foundation/audio-samples.js.map +1 -0
- package/lib/Foundation/boom.d.ts +17 -0
- package/lib/Foundation/boom.d.ts.map +1 -0
- package/lib/Foundation/boom.js +37 -0
- package/lib/Foundation/boom.js.map +1 -0
- package/lib/Foundation/cache.d.ts +25 -0
- package/lib/Foundation/cache.d.ts.map +1 -0
- package/lib/Foundation/cache.js +112 -0
- package/lib/Foundation/cache.js.map +1 -0
- package/lib/Foundation/concurrency.d.ts +13 -0
- package/lib/Foundation/concurrency.d.ts.map +1 -0
- package/lib/Foundation/concurrency.js +62 -0
- package/lib/Foundation/concurrency.js.map +1 -0
- package/lib/Foundation/curve25519.d.ts +11 -0
- package/lib/Foundation/curve25519.d.ts.map +1 -0
- package/lib/Foundation/curve25519.js +178 -0
- package/lib/Foundation/curve25519.js.map +1 -0
- package/lib/Foundation/image-thumb.d.ts +13 -0
- package/lib/Foundation/image-thumb.d.ts.map +1 -0
- package/lib/Foundation/image-thumb.js +65 -0
- package/lib/Foundation/image-thumb.js.map +1 -0
- package/lib/Foundation/link-preview.d.ts +29 -0
- package/lib/Foundation/link-preview.d.ts.map +1 -0
- package/lib/Foundation/link-preview.js +309 -0
- package/lib/Foundation/link-preview.js.map +1 -0
- package/lib/Foundation/logger.d.ts +31 -0
- package/lib/Foundation/logger.d.ts.map +1 -0
- package/lib/Foundation/logger.js +54 -0
- package/lib/Foundation/logger.js.map +1 -0
- package/lib/Foundation/long.d.ts +33 -0
- package/lib/Foundation/long.d.ts.map +1 -0
- package/lib/Foundation/long.js +135 -0
- package/lib/Foundation/long.js.map +1 -0
- package/lib/Foundation/protobuf-minimal.d.ts +115 -0
- package/lib/Foundation/protobuf-minimal.d.ts.map +1 -0
- package/lib/Foundation/protobuf-minimal.js +614 -0
- package/lib/Foundation/protobuf-minimal.js.map +1 -0
- package/lib/Foundation/qrcode-terminal.d.ts +2 -0
- package/lib/Foundation/qrcode-terminal.d.ts.map +1 -0
- package/lib/Foundation/qrcode-terminal.js +405 -0
- package/lib/Foundation/qrcode-terminal.js.map +1 -0
- package/lib/Foundation/sql-database.d.ts +15 -0
- package/lib/Foundation/sql-database.d.ts.map +1 -0
- package/lib/Foundation/sql-database.js +719 -0
- package/lib/Foundation/sql-database.js.map +1 -0
- package/lib/Foundation/wa-crypto.d.ts +14 -0
- package/lib/Foundation/wa-crypto.d.ts.map +1 -0
- package/lib/Foundation/wa-crypto.js +48 -0
- package/lib/Foundation/wa-crypto.js.map +1 -0
- package/lib/Foundation/zip.d.ts +2 -0
- package/lib/Foundation/zip.d.ts.map +1 -0
- package/lib/Foundation/zip.js +98 -0
- package/lib/Foundation/zip.js.map +1 -0
- package/lib/Signal/libsignal.js +0 -3
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Socket/business.d.ts +3 -1
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/communities.d.ts +3 -1
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +19 -14
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +3 -1
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +6 -2
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +3 -1
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +298 -52
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +4 -5
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js +6 -7
- package/lib/Utils/crypto.js.map +1 -1
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +89 -26
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +6 -0
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +198 -27
- package/lib/Utils/messages.js.map +1 -1
- package/lib/VoIP/WaVoipCoordinator.d.ts +39 -0
- package/lib/VoIP/WaVoipCoordinator.d.ts.map +1 -0
- package/lib/VoIP/WaVoipCoordinator.js +156 -0
- package/lib/VoIP/WaVoipCoordinator.js.map +1 -0
- package/lib/VoIP/app-data/WaAppDataStream.d.ts +35 -0
- package/lib/VoIP/app-data/WaAppDataStream.d.ts.map +1 -0
- package/lib/VoIP/app-data/WaAppDataStream.js +174 -0
- package/lib/VoIP/app-data/WaAppDataStream.js.map +1 -0
- package/lib/VoIP/app-data/protocol.d.ts +28 -0
- package/lib/VoIP/app-data/protocol.d.ts.map +1 -0
- package/lib/VoIP/app-data/protocol.js +167 -0
- package/lib/VoIP/app-data/protocol.js.map +1 -0
- package/lib/VoIP/bytes.d.ts +19 -0
- package/lib/VoIP/bytes.d.ts.map +1 -0
- package/lib/VoIP/bytes.js +64 -0
- package/lib/VoIP/bytes.js.map +1 -0
- package/lib/VoIP/call/WaCallManager.d.ts +58 -0
- package/lib/VoIP/call/WaCallManager.d.ts.map +1 -0
- package/lib/VoIP/call/WaCallManager.js +434 -0
- package/lib/VoIP/call/WaCallManager.js.map +1 -0
- package/lib/VoIP/call/WaCallMediaSession.d.ts +143 -0
- package/lib/VoIP/call/WaCallMediaSession.d.ts.map +1 -0
- package/lib/VoIP/call/WaCallMediaSession.js +1674 -0
- package/lib/VoIP/call/WaCallMediaSession.js.map +1 -0
- package/lib/VoIP/call/call-state.d.ts +34 -0
- package/lib/VoIP/call/call-state.d.ts.map +1 -0
- package/lib/VoIP/call/call-state.js +189 -0
- package/lib/VoIP/call/call-state.js.map +1 -0
- package/lib/VoIP/crypto/encryption.d.ts +6 -0
- package/lib/VoIP/crypto/encryption.d.ts.map +1 -0
- package/lib/VoIP/crypto/encryption.js +14 -0
- package/lib/VoIP/crypto/encryption.js.map +1 -0
- package/lib/VoIP/crypto/primitives.d.ts +5 -0
- package/lib/VoIP/crypto/primitives.d.ts.map +1 -0
- package/lib/VoIP/crypto/primitives.js +22 -0
- package/lib/VoIP/crypto/primitives.js.map +1 -0
- package/lib/VoIP/crypto/rtcp.d.ts +6 -0
- package/lib/VoIP/crypto/rtcp.d.ts.map +1 -0
- package/lib/VoIP/crypto/rtcp.js +71 -0
- package/lib/VoIP/crypto/rtcp.js.map +1 -0
- package/lib/VoIP/crypto/srtp.d.ts +40 -0
- package/lib/VoIP/crypto/srtp.d.ts.map +1 -0
- package/lib/VoIP/crypto/srtp.js +174 -0
- package/lib/VoIP/crypto/srtp.js.map +1 -0
- package/lib/VoIP/crypto/ssrc.d.ts +4 -0
- package/lib/VoIP/crypto/ssrc.d.ts.map +1 -0
- package/lib/VoIP/crypto/ssrc.js +15 -0
- package/lib/VoIP/crypto/ssrc.js.map +1 -0
- package/lib/VoIP/index.d.ts +82 -104
- package/lib/VoIP/index.d.ts.map +1 -1
- package/lib/VoIP/index.js +596 -885
- package/lib/VoIP/index.js.map +1 -1
- package/lib/VoIP/media/WaAudioEngine.d.ts +79 -0
- package/lib/VoIP/media/WaAudioEngine.d.ts.map +1 -0
- package/lib/VoIP/media/WaAudioEngine.js +478 -0
- package/lib/VoIP/media/WaAudioEngine.js.map +1 -0
- package/lib/VoIP/media/WaVideoEngine.d.ts +31 -0
- package/lib/VoIP/media/WaVideoEngine.d.ts.map +1 -0
- package/lib/VoIP/media/WaVideoEngine.js +261 -0
- package/lib/VoIP/media/WaVideoEngine.js.map +1 -0
- package/lib/VoIP/media/audio-codec.d.ts +74 -0
- package/lib/VoIP/media/audio-codec.d.ts.map +1 -0
- package/lib/VoIP/media/audio-codec.js +0 -0
- package/lib/VoIP/media/audio-codec.js.map +1 -0
- package/lib/VoIP/media/audio-reorder.d.ts +19 -0
- package/lib/VoIP/media/audio-reorder.d.ts.map +1 -0
- package/lib/VoIP/media/audio-reorder.js +112 -0
- package/lib/VoIP/media/audio-reorder.js.map +1 -0
- package/lib/VoIP/media/h264.d.ts +21 -0
- package/lib/VoIP/media/h264.d.ts.map +1 -0
- package/lib/VoIP/media/h264.js +239 -0
- package/lib/VoIP/media/h264.js.map +1 -0
- package/lib/VoIP/media/mlow-codec.d.ts +77 -0
- package/lib/VoIP/media/mlow-codec.d.ts.map +1 -0
- package/lib/VoIP/media/mlow-codec.js +467 -0
- package/lib/VoIP/media/mlow-codec.js.map +1 -0
- package/lib/VoIP/media/rtcp.d.ts +10 -0
- package/lib/VoIP/media/rtcp.d.ts.map +1 -0
- package/lib/VoIP/media/rtcp.js +61 -0
- package/lib/VoIP/media/rtcp.js.map +1 -0
- package/lib/VoIP/media/rtp.d.ts +56 -0
- package/lib/VoIP/media/rtp.d.ts.map +1 -0
- package/lib/VoIP/media/rtp.js +225 -0
- package/lib/VoIP/media/rtp.js.map +1 -0
- package/lib/VoIP/protobuf.d.ts +3 -0
- package/lib/VoIP/protobuf.d.ts.map +1 -0
- package/lib/VoIP/protobuf.js +30 -0
- package/lib/VoIP/protobuf.js.map +1 -0
- package/lib/VoIP/relay/WaManualRelay.d.ts +62 -0
- package/lib/VoIP/relay/WaManualRelay.d.ts.map +1 -0
- package/lib/VoIP/relay/WaManualRelay.js +619 -0
- package/lib/VoIP/relay/WaManualRelay.js.map +1 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.d.ts +22 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.d.ts.map +1 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.js +34 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.js.map +1 -0
- package/lib/VoIP/relay/dtls/aead.d.ts +23 -0
- package/lib/VoIP/relay/dtls/aead.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/aead.js +41 -0
- package/lib/VoIP/relay/dtls/aead.js.map +1 -0
- package/lib/VoIP/relay/dtls/cert-builder.d.ts +6 -0
- package/lib/VoIP/relay/dtls/cert-builder.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/cert-builder.js +68 -0
- package/lib/VoIP/relay/dtls/cert-builder.js.map +1 -0
- package/lib/VoIP/relay/dtls/der.d.ts +19 -0
- package/lib/VoIP/relay/dtls/der.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/der.js +96 -0
- package/lib/VoIP/relay/dtls/der.js.map +1 -0
- package/lib/VoIP/relay/dtls/ecdhe.d.ts +9 -0
- package/lib/VoIP/relay/dtls/ecdhe.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/ecdhe.js +33 -0
- package/lib/VoIP/relay/dtls/ecdhe.js.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-framing.d.ts +49 -0
- package/lib/VoIP/relay/dtls/handshake-framing.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-framing.js +102 -0
- package/lib/VoIP/relay/dtls/handshake-framing.js.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-messages.d.ts +64 -0
- package/lib/VoIP/relay/dtls/handshake-messages.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-messages.js +154 -0
- package/lib/VoIP/relay/dtls/handshake-messages.js.map +1 -0
- package/lib/VoIP/relay/dtls/handshake.d.ts +28 -0
- package/lib/VoIP/relay/dtls/handshake.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/handshake.js +555 -0
- package/lib/VoIP/relay/dtls/handshake.js.map +1 -0
- package/lib/VoIP/relay/dtls/prf.d.ts +13 -0
- package/lib/VoIP/relay/dtls/prf.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/prf.js +35 -0
- package/lib/VoIP/relay/dtls/prf.js.map +1 -0
- package/lib/VoIP/relay/dtls/record.d.ts +25 -0
- package/lib/VoIP/relay/dtls/record.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/record.js +49 -0
- package/lib/VoIP/relay/dtls/record.js.map +1 -0
- package/lib/VoIP/relay/relay-ack.d.ts +31 -0
- package/lib/VoIP/relay/relay-ack.d.ts.map +1 -0
- package/lib/VoIP/relay/relay-ack.js +142 -0
- package/lib/VoIP/relay/relay-ack.js.map +1 -0
- package/lib/VoIP/relay/sctp/association.d.ts +22 -0
- package/lib/VoIP/relay/sctp/association.d.ts.map +1 -0
- package/lib/VoIP/relay/sctp/association.js +434 -0
- package/lib/VoIP/relay/sctp/association.js.map +1 -0
- package/lib/VoIP/relay/sctp/crc32c.d.ts +2 -0
- package/lib/VoIP/relay/sctp/crc32c.d.ts.map +1 -0
- package/lib/VoIP/relay/sctp/crc32c.js +20 -0
- package/lib/VoIP/relay/sctp/crc32c.js.map +1 -0
- package/lib/VoIP/relay/sctp/wire.d.ts +96 -0
- package/lib/VoIP/relay/sctp/wire.d.ts.map +1 -0
- package/lib/VoIP/relay/sctp/wire.js +206 -0
- package/lib/VoIP/relay/sctp/wire.js.map +1 -0
- package/lib/VoIP/relay/stun.d.ts +47 -0
- package/lib/VoIP/relay/stun.d.ts.map +1 -0
- package/lib/VoIP/relay/stun.js +459 -0
- package/lib/VoIP/relay/stun.js.map +1 -0
- package/lib/VoIP/shim/baileys-resolve.d.ts +2 -0
- package/lib/VoIP/shim/baileys-resolve.d.ts.map +1 -0
- package/lib/VoIP/shim/baileys-resolve.js +22 -0
- package/lib/VoIP/shim/baileys-resolve.js.map +1 -0
- package/lib/VoIP/shim/core.d.ts +32 -0
- package/lib/VoIP/shim/core.d.ts.map +1 -0
- package/lib/VoIP/shim/core.js +67 -0
- package/lib/VoIP/shim/core.js.map +1 -0
- package/lib/VoIP/shim/crypto.d.ts +2 -0
- package/lib/VoIP/shim/crypto.d.ts.map +1 -0
- package/lib/VoIP/shim/crypto.js +7 -0
- package/lib/VoIP/shim/crypto.js.map +1 -0
- package/lib/VoIP/shim/proto.d.ts +2 -0
- package/lib/VoIP/shim/proto.d.ts.map +1 -0
- package/lib/VoIP/shim/proto.js +10 -0
- package/lib/VoIP/shim/proto.js.map +1 -0
- package/lib/VoIP/shim/protocol.d.ts +32 -0
- package/lib/VoIP/shim/protocol.d.ts.map +1 -0
- package/lib/VoIP/shim/protocol.js +131 -0
- package/lib/VoIP/shim/protocol.js.map +1 -0
- package/lib/VoIP/shim/transport.d.ts +20 -0
- package/lib/VoIP/shim/transport.d.ts.map +1 -0
- package/lib/VoIP/shim/transport.js +83 -0
- package/lib/VoIP/shim/transport.js.map +1 -0
- package/lib/VoIP/shim/util.d.ts +13 -0
- package/lib/VoIP/shim/util.d.ts.map +1 -0
- package/lib/VoIP/shim/util.js +208 -0
- package/lib/VoIP/shim/util.js.map +1 -0
- package/lib/VoIP/signaling/bridge.d.ts +4 -0
- package/lib/VoIP/signaling/bridge.d.ts.map +1 -0
- package/lib/VoIP/signaling/bridge.js +103 -0
- package/lib/VoIP/signaling/bridge.js.map +1 -0
- package/lib/VoIP/signaling/screen-share.d.ts +40 -0
- package/lib/VoIP/signaling/screen-share.d.ts.map +1 -0
- package/lib/VoIP/signaling/screen-share.js +55 -0
- package/lib/VoIP/signaling/screen-share.js.map +1 -0
- package/lib/VoIP/signaling/signaling.d.ts +396 -0
- package/lib/VoIP/signaling/signaling.d.ts.map +1 -0
- package/lib/VoIP/signaling/signaling.js +488 -0
- package/lib/VoIP/signaling/signaling.js.map +1 -0
- package/lib/VoIP/types.d.ts +37 -12
- package/lib/VoIP/types.d.ts.map +1 -1
- package/lib/VoIP/types.js +65 -12
- package/lib/VoIP/types.js.map +1 -1
- package/lib/VoIP/voip-deps.d.ts +46 -0
- package/lib/VoIP/voip-deps.d.ts.map +1 -0
- package/lib/VoIP/voip-deps.js +244 -0
- package/lib/VoIP/voip-deps.js.map +1 -0
- package/lib/VoIP/voipClient.d.ts +34 -0
- package/lib/VoIP/voipClient.d.ts.map +1 -0
- package/lib/VoIP/voipClient.js +351 -0
- package/lib/VoIP/voipClient.js.map +1 -0
- package/lib/VoIP/wasm-engine.d.ts +2 -2
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/decode.js +10 -0
- package/lib/WABinary/decode.js.map +1 -1
- package/lib/WABinary/encode.d.ts.map +1 -1
- package/lib/WABinary/encode.js +10 -0
- package/lib/WABinary/encode.js.map +1 -1
- package/lib/WABinary/generic-utils.js +1 -1
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WABinary/jid-utils.d.ts.map +1 -1
- package/lib/WABinary/jid-utils.js +18 -17
- package/lib/WABinary/jid-utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import NodeCache from '@cacheable/node-cache';
|
|
2
2
|
import { Boom } from '@hapi/boom';
|
|
3
|
-
import crypto from 'crypto';
|
|
3
|
+
import crypto, { randomBytes } from 'crypto';
|
|
4
4
|
import { proto } from '../../WAProto/index.js';
|
|
5
|
+
import { AssociationType } from '../Types/Message.js';
|
|
5
6
|
import { BIZ_BOT_SUPPORT_PAYLOAD, DEFAULT_CACHE_TTLS, WA_DEFAULT_EPHEMERAL } from '../Defaults/index.js';
|
|
6
|
-
import { aggregateMessageKeysNotFromMe, assertMediaContent, assertMeId, bindWaitForEvent, decryptMediaRetryData, DEF_MEDIA_HOST, encodeNewsletterMessage, encodeSignedDeviceIdentity, encodeWAMessage, encryptMediaRetryRequest, extractDeviceJids, generateMessageIDV2, generateParticipantHashV2, generateWAMessage, getStatusCodeForMediaRetry, getUrlFromDirectPath, getWAUploadToServer, MessageRetryManager, normalizeMessageContent, shouldIncludeBizBinaryNode, parseAndInjectE2ESessions, unixTimestampSeconds } from '../Utils/index.js';
|
|
7
|
+
import { aggregateMessageKeysNotFromMe, assertMediaContent, assertMeId, bindWaitForEvent, decryptMediaRetryData, DEF_MEDIA_HOST, encodeNewsletterMessage, encodeSignedDeviceIdentity, encodeWAMessage, encryptMediaRetryRequest, extractDeviceJids, generateMessageIDV2, generateParticipantHashV2, generateWAMessage, generateWAMessageFromContent, hasValidAlbumMedia, getStatusCodeForMediaRetry, getUrlFromDirectPath, getWAUploadToServer, MessageRetryManager, normalizeMessageContent, shouldIncludeBizBinaryNode, parseAndInjectE2ESessions, unixTimestampSeconds } from '../Utils/index.js';
|
|
7
8
|
import { getUrlInfo } from '../Utils/link-preview.js';
|
|
8
9
|
import { makeKeyedMutex, makeMutex } from '../Utils/make-mutex.js';
|
|
9
10
|
import { getMessageReportingToken, shouldIncludeReportingToken } from '../Utils/reporting-utils.js';
|
|
@@ -12,7 +13,9 @@ import { areJidsSameUser, getBinaryNodeChild, getBinaryNodeChildren, getBizBinar
|
|
|
12
13
|
import { USyncQuery, USyncUser } from '../WAUSync/index.js';
|
|
13
14
|
import { makeNewsletterSocket } from './newsletter.js';
|
|
14
15
|
export const makeMessagesSocket = (config) => {
|
|
15
|
-
const { logger, linkPreviewImageThumbnailWidth, generateHighQualityLinkPreview, options: httpRequestOptions,
|
|
16
|
+
const { logger, linkPreviewImageThumbnailWidth, generateHighQualityLinkPreview, options: httpRequestOptions, cachedGroupMetadata, enableRecentMessageCache, maxMsgRetryCount } = config;
|
|
17
|
+
let currentPatchMessageBeforeSending = config.patchMessageBeforeSending;
|
|
18
|
+
const patchMessageBeforeSending = (message, jids) => currentPatchMessageBeforeSending(message, jids);
|
|
16
19
|
const sock = makeNewsletterSocket(config);
|
|
17
20
|
const { ev, authState, messageMutex, signalRepository, upsertMessage, query, fetchPrivacySettings, sendNode, groupMetadata, groupToggleEphemeral, registerSocketEndHandler } = sock;
|
|
18
21
|
const getLIDForPN = signalRepository.lidMapping.getLIDForPN.bind(signalRepository.lidMapping);
|
|
@@ -439,7 +442,8 @@ export const makeMessagesSocket = (config) => {
|
|
|
439
442
|
});
|
|
440
443
|
}
|
|
441
444
|
await authState.keys.transaction(async () => {
|
|
442
|
-
const
|
|
445
|
+
const innerMessage = normalizeMessageContent(message);
|
|
446
|
+
const mediaType = getMediaType(innerMessage || message);
|
|
443
447
|
if (mediaType) {
|
|
444
448
|
extraAttrs['mediatype'] = mediaType;
|
|
445
449
|
}
|
|
@@ -459,7 +463,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
459
463
|
attrs: {
|
|
460
464
|
to: jid,
|
|
461
465
|
id: msgId,
|
|
462
|
-
type: getMessageType(message),
|
|
466
|
+
type: getMessageType(innerMessage || message),
|
|
463
467
|
...(additionalAttributes || {})
|
|
464
468
|
},
|
|
465
469
|
content: binaryNodeContent
|
|
@@ -468,9 +472,36 @@ export const makeMessagesSocket = (config) => {
|
|
|
468
472
|
await sendNode(stanza);
|
|
469
473
|
return;
|
|
470
474
|
}
|
|
471
|
-
|
|
475
|
+
// Add meta node for certain message types
|
|
476
|
+
const isNeedMetaAttrs = innerMessage?.pinInChatMessage || innerMessage?.keepInChatMessage || innerMessage?.reactionMessage;
|
|
477
|
+
const isGroupStatus = message?.groupStatusMessage || message?.groupStatusMessageV2;
|
|
478
|
+
const isPollUpdate = innerMessage?.pollUpdateMessage;
|
|
479
|
+
if (isNeedMetaAttrs || isGroupStatus || isPollUpdate) {
|
|
480
|
+
const metaAttrs = {};
|
|
481
|
+
if (isNeedMetaAttrs) {
|
|
482
|
+
metaAttrs['content_type'] = 'add_on';
|
|
483
|
+
}
|
|
484
|
+
if (isPollUpdate && !isGroupStatus) {
|
|
485
|
+
metaAttrs['polltype'] = 'vote';
|
|
486
|
+
}
|
|
487
|
+
if (isGroupStatus) {
|
|
488
|
+
metaAttrs['is_group_status'] = 'true';
|
|
489
|
+
}
|
|
490
|
+
binaryNodeContent.push({
|
|
491
|
+
tag: 'meta',
|
|
492
|
+
attrs: metaAttrs,
|
|
493
|
+
content: undefined
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
if (isNeedMetaAttrs ||
|
|
497
|
+
innerMessage?.protocolMessage?.memberLabel ||
|
|
498
|
+
innerMessage?.protocolMessage?.editedMessage ||
|
|
499
|
+
innerMessage?.protocolMessage?.mediaNotifyMessage) {
|
|
472
500
|
extraAttrs['decrypt-fail'] = 'hide';
|
|
473
501
|
}
|
|
502
|
+
if (innerMessage?.interactiveResponseMessage?.nativeFlowResponseMessage) {
|
|
503
|
+
extraAttrs['native_flow_name'] = innerMessage.interactiveResponseMessage.nativeFlowResponseMessage.name;
|
|
504
|
+
}
|
|
474
505
|
if (isGroupOrStatus && !isRetryResend) {
|
|
475
506
|
const [groupData, senderKeyMap] = await Promise.all([
|
|
476
507
|
(async () => {
|
|
@@ -509,51 +540,103 @@ export const makeMessagesSocket = (config) => {
|
|
|
509
540
|
addressing_mode: groupData?.addressingMode || 'lid'
|
|
510
541
|
};
|
|
511
542
|
}
|
|
512
|
-
const patched = await patchMessageBeforeSending(message);
|
|
543
|
+
const patched = await patchMessageBeforeSending(message, isGroup ? devices.map(d => d.jid) : undefined);
|
|
513
544
|
if (Array.isArray(patched)) {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
545
|
+
// Per-jid patching: hybrid skmsg + per-recipient pkmsg
|
|
546
|
+
logger.debug({ jid, devices: devices.length }, 'per-jid group patch: skmsg+pkmsg hybrid');
|
|
547
|
+
const userMsgMap = new Map();
|
|
548
|
+
let fallbackPatchedMsg = message;
|
|
549
|
+
for (const { recipientJid, message: msg } of patched) {
|
|
550
|
+
if (!msg)
|
|
551
|
+
continue;
|
|
552
|
+
const decoded = jidDecode(recipientJid);
|
|
553
|
+
if (decoded)
|
|
554
|
+
userMsgMap.set(decoded.user, msg);
|
|
555
|
+
else
|
|
556
|
+
fallbackPatchedMsg = msg;
|
|
557
|
+
}
|
|
558
|
+
if (!userMsgMap.size)
|
|
559
|
+
fallbackPatchedMsg = patched.find(p => p.message)?.message || message;
|
|
560
|
+
const groupAddressingMode = additionalAttributes?.['addressing_mode'] || groupData?.addressingMode || 'lid';
|
|
561
|
+
const groupSenderIdentity = groupAddressingMode === 'lid' && meLid ? meLid : meId;
|
|
562
|
+
const { ciphertext, senderKeyDistributionMessage } = await signalRepository.encryptGroupMessage({
|
|
563
|
+
group: destinationJid,
|
|
564
|
+
data: encodeWAMessage(fallbackPatchedMsg),
|
|
565
|
+
meId: groupSenderIdentity
|
|
566
|
+
});
|
|
567
|
+
reportingMessage = fallbackPatchedMsg;
|
|
568
|
+
const senderKeyRecipients = [];
|
|
569
|
+
for (const device of devices) {
|
|
570
|
+
const deviceJid = device.jid;
|
|
571
|
+
if ((!senderKeyMap[deviceJid] || !!participant) &&
|
|
572
|
+
!isHostedLidUser(deviceJid) && !isHostedPnUser(deviceJid) && device.device !== 99) {
|
|
573
|
+
senderKeyRecipients.push(deviceJid);
|
|
574
|
+
senderKeyMap[deviceJid] = true;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
if (senderKeyRecipients.length) {
|
|
578
|
+
const senderKeyMsg = { senderKeyDistributionMessage: { axolotlSenderKeyDistributionMessage: senderKeyDistributionMessage, groupId: destinationJid } };
|
|
579
|
+
await assertSessions(senderKeyRecipients);
|
|
580
|
+
const r = await createParticipantNodes(senderKeyRecipients, senderKeyMsg, extraAttrs);
|
|
581
|
+
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || r.shouldIncludeDeviceIdentity;
|
|
582
|
+
participants.push(...r.nodes);
|
|
583
|
+
}
|
|
584
|
+
binaryNodeContent.push({ tag: 'enc', attrs: { v: '2', type: 'skmsg', ...extraAttrs }, content: ciphertext });
|
|
585
|
+
await authState.keys.set({ 'sender-key-memory': { [jid]: senderKeyMap } });
|
|
586
|
+
// Send per-recipient pkmsg for devices with custom patched messages
|
|
587
|
+
const customDevices = devices
|
|
588
|
+
.map(d => { const dec = jidDecode(d.jid); return dec && userMsgMap.has(dec.user) ? { recipientJid: d.jid, message: userMsgMap.get(dec.user) } : null; })
|
|
589
|
+
.filter(Boolean);
|
|
590
|
+
if (customDevices.length) {
|
|
591
|
+
await assertSessions(customDevices.map(d => d.recipientJid));
|
|
592
|
+
const r = await createParticipantNodes(customDevices.map(d => d.recipientJid), message, extraAttrs);
|
|
593
|
+
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || r.shouldIncludeDeviceIdentity;
|
|
594
|
+
participants.push(...r.nodes);
|
|
535
595
|
}
|
|
536
596
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
597
|
+
else {
|
|
598
|
+
const bytes = encodeWAMessage(patched);
|
|
599
|
+
reportingMessage = patched;
|
|
600
|
+
const groupAddressingMode = additionalAttributes?.['addressing_mode'] || groupData?.addressingMode || 'lid';
|
|
601
|
+
const groupSenderIdentity = groupAddressingMode === 'lid' && meLid ? meLid : meId;
|
|
602
|
+
const { ciphertext, senderKeyDistributionMessage } = await signalRepository.encryptGroupMessage({
|
|
603
|
+
group: destinationJid,
|
|
604
|
+
data: bytes,
|
|
605
|
+
meId: groupSenderIdentity
|
|
606
|
+
});
|
|
607
|
+
const senderKeyRecipients = [];
|
|
608
|
+
for (const device of devices) {
|
|
609
|
+
const deviceJid = device.jid;
|
|
610
|
+
const hasKey = !!senderKeyMap[deviceJid];
|
|
611
|
+
if ((!hasKey || !!participant) &&
|
|
612
|
+
!isHostedLidUser(deviceJid) &&
|
|
613
|
+
!isHostedPnUser(deviceJid) &&
|
|
614
|
+
device.device !== 99) {
|
|
615
|
+
senderKeyRecipients.push(deviceJid);
|
|
616
|
+
senderKeyMap[deviceJid] = true;
|
|
543
617
|
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
618
|
+
}
|
|
619
|
+
if (senderKeyRecipients.length) {
|
|
620
|
+
logger.debug({ senderKeyJids: senderKeyRecipients }, 'sending new sender key');
|
|
621
|
+
const senderKeyMsg = {
|
|
622
|
+
senderKeyDistributionMessage: {
|
|
623
|
+
axolotlSenderKeyDistributionMessage: senderKeyDistributionMessage,
|
|
624
|
+
groupId: destinationJid
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
const senderKeySessionTargets = senderKeyRecipients;
|
|
628
|
+
await assertSessions(senderKeySessionTargets);
|
|
629
|
+
const result = await createParticipantNodes(senderKeyRecipients, senderKeyMsg, extraAttrs);
|
|
630
|
+
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || result.shouldIncludeDeviceIdentity;
|
|
631
|
+
participants.push(...result.nodes);
|
|
632
|
+
}
|
|
633
|
+
binaryNodeContent.push({
|
|
634
|
+
tag: 'enc',
|
|
635
|
+
attrs: { v: '2', type: 'skmsg', ...extraAttrs },
|
|
636
|
+
content: ciphertext
|
|
637
|
+
});
|
|
638
|
+
await authState.keys.set({ 'sender-key-memory': { [jid]: senderKeyMap } });
|
|
550
639
|
}
|
|
551
|
-
binaryNodeContent.push({
|
|
552
|
-
tag: 'enc',
|
|
553
|
-
attrs: { v: '2', type: 'skmsg', ...extraAttrs },
|
|
554
|
-
content: ciphertext
|
|
555
|
-
});
|
|
556
|
-
await authState.keys.set({ 'sender-key-memory': { [jid]: senderKeyMap } });
|
|
557
640
|
}
|
|
558
641
|
else {
|
|
559
642
|
let ownId = meId;
|
|
@@ -705,7 +788,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
705
788
|
attrs: {
|
|
706
789
|
id: msgId,
|
|
707
790
|
to: destinationJid,
|
|
708
|
-
type: getMessageType(message),
|
|
791
|
+
type: getMessageType(innerMessage || message),
|
|
709
792
|
...(additionalAttributes || {})
|
|
710
793
|
},
|
|
711
794
|
content: binaryNodeContent
|
|
@@ -791,13 +874,14 @@ export const makeMessagesSocket = (config) => {
|
|
|
791
874
|
stanza.content.push(...additionalNodes);
|
|
792
875
|
alreadyHasBizNode = !addBizAttributes && additionalNodes.some(node => node.tag === 'biz');
|
|
793
876
|
}
|
|
794
|
-
|
|
795
|
-
|
|
877
|
+
const bizContent = innerMessage || message;
|
|
878
|
+
if ((!alreadyHasBizNode && shouldIncludeBizBinaryNode(bizContent)) || addBizAttributes) {
|
|
879
|
+
const bizNode = getBizBinaryNode(bizContent);
|
|
796
880
|
stanza.content.push(bizNode);
|
|
797
881
|
}
|
|
798
882
|
logger.debug({ msgId }, `sending message to ${participants.length} devices`);
|
|
799
883
|
await sendNode(stanza);
|
|
800
|
-
const isProtocolMsg = !!
|
|
884
|
+
const isProtocolMsg = !!innerMessage?.protocolMessage;
|
|
801
885
|
const isBotOrPSA = destinationJid === PSA_WID || isJidBot(destinationJid) || isJidMetaAI(destinationJid);
|
|
802
886
|
if (is1on1Send &&
|
|
803
887
|
!isProtocolMsg &&
|
|
@@ -936,6 +1020,9 @@ export const makeMessagesSocket = (config) => {
|
|
|
936
1020
|
else if (innerMsg.groupInviteMessage) {
|
|
937
1021
|
return 'url';
|
|
938
1022
|
}
|
|
1023
|
+
else if (innerMsg.albumMessage) {
|
|
1024
|
+
return 'collection';
|
|
1025
|
+
}
|
|
939
1026
|
return '';
|
|
940
1027
|
};
|
|
941
1028
|
/**
|
|
@@ -1064,6 +1151,8 @@ export const makeMessagesSocket = (config) => {
|
|
|
1064
1151
|
getUSyncDevices,
|
|
1065
1152
|
messageRetryManager,
|
|
1066
1153
|
updateMemberLabel,
|
|
1154
|
+
getPatchMessageBeforeSending: () => currentPatchMessageBeforeSending,
|
|
1155
|
+
setPatchMessageBeforeSending: (fn) => { currentPatchMessageBeforeSending = fn; },
|
|
1067
1156
|
sendHTML,
|
|
1068
1157
|
updateMediaMessage: async (message) => {
|
|
1069
1158
|
const content = assertMediaContent(message.message);
|
|
@@ -1108,7 +1197,95 @@ export const makeMessagesSocket = (config) => {
|
|
|
1108
1197
|
return message;
|
|
1109
1198
|
},
|
|
1110
1199
|
sendMessage: async (jid, content, options = {}) => {
|
|
1200
|
+
var _a;
|
|
1111
1201
|
const userJid = authState.creds.me.id;
|
|
1202
|
+
// Array-jid: broadcast status to multiple JIDs (groups + contacts)
|
|
1203
|
+
if (Array.isArray(jid)) {
|
|
1204
|
+
const { delayMs = 1500 } = options;
|
|
1205
|
+
const allUsers = new Set();
|
|
1206
|
+
const fullMsg = await generateWAMessage('status@broadcast', content, {
|
|
1207
|
+
logger,
|
|
1208
|
+
userJid,
|
|
1209
|
+
upload: waUploadToServer,
|
|
1210
|
+
mediaCache: config.mediaCache,
|
|
1211
|
+
options: config.options,
|
|
1212
|
+
messageId: generateMessageIDV2(userJid),
|
|
1213
|
+
...options
|
|
1214
|
+
});
|
|
1215
|
+
for (const id of jid) {
|
|
1216
|
+
if (isJidGroup(id)) {
|
|
1217
|
+
try {
|
|
1218
|
+
const groupData = (cachedGroupMetadata ? await cachedGroupMetadata(id) : null) || await groupMetadata(id);
|
|
1219
|
+
for (const participant of groupData.participants) {
|
|
1220
|
+
if (allUsers.has(participant.id))
|
|
1221
|
+
continue;
|
|
1222
|
+
allUsers.add(participant.id);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
catch (error) {
|
|
1226
|
+
logger.error(`Error getting metadata group from ${id}: ${error}`);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
else if (!allUsers.has(id)) {
|
|
1230
|
+
allUsers.add(id);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
await relayMessage('status@broadcast', fullMsg.message, {
|
|
1234
|
+
messageId: fullMsg.key.id,
|
|
1235
|
+
statusJidList: Array.from(allUsers),
|
|
1236
|
+
additionalNodes: [
|
|
1237
|
+
{
|
|
1238
|
+
tag: 'meta',
|
|
1239
|
+
attrs: {},
|
|
1240
|
+
content: [
|
|
1241
|
+
{
|
|
1242
|
+
tag: 'mentioned_users',
|
|
1243
|
+
attrs: {},
|
|
1244
|
+
content: jid.map(id => ({ tag: 'to', attrs: { jid: id }, content: undefined }))
|
|
1245
|
+
}
|
|
1246
|
+
]
|
|
1247
|
+
}
|
|
1248
|
+
]
|
|
1249
|
+
});
|
|
1250
|
+
if (config.emitOwnEvents) {
|
|
1251
|
+
process.nextTick(async () => {
|
|
1252
|
+
await messageMutex.mutex(() => upsertMessage(fullMsg, 'append'));
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
for (const id of jid) {
|
|
1256
|
+
const isGroup = isJidGroup(id);
|
|
1257
|
+
const sendType = isGroup ? 'groupStatusMentionMessage' : 'statusMentionMessage';
|
|
1258
|
+
const mentionMsg = generateWAMessageFromContent(id, {
|
|
1259
|
+
messageContextInfo: {
|
|
1260
|
+
messageSecret: randomBytes(32)
|
|
1261
|
+
},
|
|
1262
|
+
[sendType]: {
|
|
1263
|
+
message: {
|
|
1264
|
+
protocolMessage: {
|
|
1265
|
+
key: fullMsg.key,
|
|
1266
|
+
type: 25
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}, { userJid });
|
|
1271
|
+
await relayMessage(id, mentionMsg.message, {
|
|
1272
|
+
additionalNodes: [
|
|
1273
|
+
{
|
|
1274
|
+
tag: 'meta',
|
|
1275
|
+
attrs: isGroup ? { is_group_status_mention: 'true' } : { is_status_mention: 'true' },
|
|
1276
|
+
content: undefined
|
|
1277
|
+
}
|
|
1278
|
+
]
|
|
1279
|
+
});
|
|
1280
|
+
if (config.emitOwnEvents) {
|
|
1281
|
+
process.nextTick(async () => {
|
|
1282
|
+
await messageMutex.mutex(() => upsertMessage(mentionMsg, 'append'));
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
await new Promise(r => setTimeout(r, delayMs));
|
|
1286
|
+
}
|
|
1287
|
+
return fullMsg;
|
|
1288
|
+
}
|
|
1112
1289
|
// Direct sendHTML routing when { html: "..." } is passed to sendMessage
|
|
1113
1290
|
if (typeof content === 'object' && content && 'html' in content && typeof content.html === 'string') {
|
|
1114
1291
|
return await sendHTML(jid, content.html, {
|
|
@@ -1168,14 +1345,16 @@ export const makeMessagesSocket = (config) => {
|
|
|
1168
1345
|
const isDeleteMsg = 'delete' in content && !!content.delete;
|
|
1169
1346
|
const isEditMsg = 'edit' in content && !!content.edit;
|
|
1170
1347
|
const isPinMsg = 'pin' in content && !!content.pin;
|
|
1348
|
+
const isKeepMsg = 'keep' in content && !!content.keep;
|
|
1171
1349
|
const isPollMessage = 'poll' in content && !!content.poll;
|
|
1172
1350
|
const isQuizMsg = 'poll' in content && !!content.poll.pollType;
|
|
1173
1351
|
const isAiMsg = 'ai' in content && !!content.ai;
|
|
1174
1352
|
const isNeedBizAttrs = 'secureMetaServiceLabel' in content && !!content.secureMetaServiceLabel;
|
|
1175
1353
|
const additionalAttributes = options.additionalAttributes || {};
|
|
1176
1354
|
const additionalNodes = options.additionalNodes || [];
|
|
1177
|
-
if (isDeleteMsg) {
|
|
1178
|
-
|
|
1355
|
+
if (isDeleteMsg || isKeepMsg) {
|
|
1356
|
+
const deleteKey = content.delete;
|
|
1357
|
+
if (isJidGroup(deleteKey?.remoteJid) && !deleteKey?.fromMe) {
|
|
1179
1358
|
additionalAttributes.edit = '8';
|
|
1180
1359
|
}
|
|
1181
1360
|
else {
|
|
@@ -1231,11 +1410,78 @@ export const makeMessagesSocket = (config) => {
|
|
|
1231
1410
|
additionalNodes,
|
|
1232
1411
|
addBizAttributes: isNeedBizAttrs
|
|
1233
1412
|
});
|
|
1413
|
+
// Mark edited/deleted messages in retry manager
|
|
1414
|
+
if (messageRetryManager && (isDeleteMsg || isEditMsg)) {
|
|
1415
|
+
const targetKey = isDeleteMsg ? content.delete : content.edit;
|
|
1416
|
+
if (targetKey?.id) {
|
|
1417
|
+
messageRetryManager.markRetrySuccess(targetKey.id);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1234
1420
|
if (config.emitOwnEvents) {
|
|
1235
1421
|
process.nextTick(async () => {
|
|
1236
1422
|
await messageMutex.mutex(() => upsertMessage(fullMsg, 'append'));
|
|
1237
1423
|
});
|
|
1238
1424
|
}
|
|
1425
|
+
// aiRich: send a follow-up edit to provide rich media resolution
|
|
1426
|
+
if ('aiRich' in content && content.aiRich && options.bypassDownload !== false
|
|
1427
|
+
&& fullMsg.key?.id && fullMsg.message?.botForwardedMessage?.message?.richResponseMessage?.unifiedResponse) {
|
|
1428
|
+
try {
|
|
1429
|
+
const AIRichBuilder = (await import('../Utils/rich-message-utils.js')).prepareRichResponseMessage;
|
|
1430
|
+
const edit = AIRichBuilder.buildEdit?.(jid, fullMsg.key, fullMsg.message);
|
|
1431
|
+
if (edit) {
|
|
1432
|
+
await relayMessage(jid, edit, {
|
|
1433
|
+
messageId: generateMessageIDV2(userJid),
|
|
1434
|
+
additionalAttributes: { edit: '1' },
|
|
1435
|
+
additionalNodes: options.additionalNodes,
|
|
1436
|
+
useCachedGroupMetadata: options.useCachedGroupMetadata,
|
|
1437
|
+
statusJidList: options.statusJidList
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
catch (error) {
|
|
1442
|
+
error.relayedKey = fullMsg.key;
|
|
1443
|
+
throw error;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
// Album send: relay each album item with parent key association
|
|
1447
|
+
if ('album' in content && Array.isArray(content.album)) {
|
|
1448
|
+
const { delayMs = 1500 } = options;
|
|
1449
|
+
for (const albumMedia of content.album) {
|
|
1450
|
+
const albumMsg = await generateWAMessage(jid, albumMedia, {
|
|
1451
|
+
logger,
|
|
1452
|
+
userJid,
|
|
1453
|
+
upload: waUploadToServer,
|
|
1454
|
+
mediaCache: config.mediaCache,
|
|
1455
|
+
options: config.options,
|
|
1456
|
+
...options,
|
|
1457
|
+
messageId: generateMessageIDV2(userJid)
|
|
1458
|
+
});
|
|
1459
|
+
if (!hasValidAlbumMedia(normalizeMessageContent(albumMsg.message))) {
|
|
1460
|
+
throw new Boom('Invalid message type for album', { statusCode: 400 });
|
|
1461
|
+
}
|
|
1462
|
+
if (albumMsg.message) {
|
|
1463
|
+
(_a = albumMsg.message).messageContextInfo || (_a.messageContextInfo = {});
|
|
1464
|
+
albumMsg.message.messageContextInfo.messageAssociation = {
|
|
1465
|
+
parentMessageKey: fullMsg.key,
|
|
1466
|
+
associationType: AssociationType.MEDIA_ALBUM
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
await relayMessage(jid, albumMsg.message, {
|
|
1470
|
+
messageId: albumMsg.key.id,
|
|
1471
|
+
useCachedGroupMetadata: options.useCachedGroupMetadata,
|
|
1472
|
+
addBizAttributes: isNeedBizAttrs,
|
|
1473
|
+
statusJidList: options.statusJidList,
|
|
1474
|
+
additionalAttributes,
|
|
1475
|
+
additionalNodes
|
|
1476
|
+
});
|
|
1477
|
+
if (config.emitOwnEvents) {
|
|
1478
|
+
process.nextTick(async () => {
|
|
1479
|
+
await messageMutex.mutex(() => upsertMessage(albumMsg, 'append'));
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
await new Promise(r => setTimeout(r, delayMs));
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1239
1485
|
return fullMsg;
|
|
1240
1486
|
}
|
|
1241
1487
|
}
|