@ubedsockets/baileys 1.6.9 → 1.7.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/WAProto/GenerateStatics.sh +26 -3
- package/WAProto/WAProto.proto +432 -180
- package/WAProto/add-missing-proto-deps.js +134 -0
- package/WAProto/imports-elaina.js +48 -0
- package/WAProto/index.js +78044 -140686
- package/WAProto/merge-elaina-ai-proto.js +187 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/elaina-version.json +3 -0
- package/lib/Defaults/index.js +57 -55
- package/lib/Signal/Group/group_cipher.js +1 -1
- package/lib/Signal/Group/keyhelper.js +1 -1
- package/lib/Signal/Group/sender-chain-key.js +1 -1
- package/lib/Signal/Group/sender-key-message.js +1 -1
- package/lib/Signal/Group/sender-message-key.js +1 -1
- package/lib/Signal/libsignal.js +1 -1
- package/lib/Signal/libsignalnode/LICENSE +621 -0
- package/lib/Signal/libsignalnode/README.md +11 -0
- package/lib/Signal/libsignalnode/generate-proto.sh +1 -0
- package/lib/Signal/libsignalnode/index.js +10 -0
- package/lib/Signal/libsignalnode/protos/WhisperTextProtocol.proto +28 -0
- package/lib/Signal/libsignalnode/src/.eslintrc.json +31 -0
- package/lib/Signal/libsignalnode/src/WhisperTextProtocol.js +948 -0
- package/lib/Signal/libsignalnode/src/base_key_type.js +6 -0
- package/lib/Signal/libsignalnode/src/chain_type.js +6 -0
- package/lib/Signal/libsignalnode/src/crypto.js +98 -0
- package/lib/Signal/libsignalnode/src/curve.js +142 -0
- package/lib/Signal/libsignalnode/src/errors.js +33 -0
- package/lib/Signal/libsignalnode/src/keyhelper.js +45 -0
- package/lib/Signal/libsignalnode/src/numeric_fingerprint.js +70 -0
- package/lib/Signal/libsignalnode/src/protobufs.js +10 -0
- package/lib/Signal/libsignalnode/src/protocol_address.js +40 -0
- package/lib/Signal/libsignalnode/src/queue_job.js +70 -0
- package/lib/Signal/libsignalnode/src/session_builder.js +164 -0
- package/lib/Signal/libsignalnode/src/session_cipher.js +332 -0
- package/lib/Signal/libsignalnode/src/session_record.js +325 -0
- package/lib/Socket/Client/websocket.js +2 -41
- package/lib/Socket/RHandler.js +533 -0
- package/lib/Socket/chats.js +249 -123
- package/lib/Socket/index.js +1 -1
- package/lib/Socket/messages-recv.js +57 -5
- package/lib/Socket/messages-send.js +47 -280
- package/lib/Socket/newsletter.js +100 -132
- package/lib/Socket/socket.js +79 -87
- package/lib/Socket/usync.js +0 -2
- package/lib/Store/make-in-memory-store.js +1 -1
- package/lib/Utils/browser-utils.js +30 -23
- package/lib/Utils/crypto.js +22 -18
- package/lib/Utils/decode-wa-message.js +12 -2
- package/lib/Utils/{baileys-event-stream.js → elaina-event-stream.js} +1 -1
- package/lib/Utils/event-buffer.js +2 -2
- package/lib/Utils/generics.js +36 -10
- package/lib/Utils/index.js +3 -1
- package/lib/Utils/message-retry-manager.js +48 -185
- package/lib/Utils/messages-media.js +127 -236
- package/lib/Utils/messages.js +746 -232
- package/lib/Utils/noise-handler.js +1 -2
- package/lib/Utils/process-message.js +108 -25
- package/lib/Utils/signal.js +1 -10
- package/lib/Utils/use-multi-file-auth-state.js +1 -1
- package/lib/Utils/validate-connection.js +3 -7
- package/lib/Voip/audio-feeder.js +166 -0
- package/lib/Voip/index.js +639 -0
- package/lib/Voip/relay-transport.js +829 -0
- package/lib/Voip/signaling.js +1102 -0
- package/lib/Voip/types.js +23 -0
- package/lib/Voip/wasm-engine.js +1255 -0
- package/lib/Voip/worker-bootstrap.js +1078 -0
- package/lib/WABinary/jid-utils.js +17 -1
- package/lib/assets/wasm/loader.js +5 -0
- package/lib/assets/wasm/whatsapp.wasm +0 -0
- package/lib/assets/wasm/worker-modules.js +273 -0
- package/lib/index.js +21 -18
- package/package.json +32 -18
- package/WAProto/AICommon.js +0 -27981
- package/WAProto/AICommon.proto +0 -713
- package/WAProto/Ephemeral.js +0 -295
- package/WAProto/Ephemeral.proto +0 -7
- package/WAProto/fix-imports.js +0 -85
- package/WAProto/index.d.ts +0 -14017
- package/WAProto/vyzen.js +0 -7
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/index.d.ts +0 -75
- package/lib/Defaults/index.d.ts.map +0 -1
- package/lib/Defaults/index.js.map +0 -1
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -10
- package/lib/Signal/Group/ciphertext-message.d.ts.map +0 -1
- package/lib/Signal/Group/ciphertext-message.js.map +0 -1
- package/lib/Signal/Group/group-session-builder.d.ts +0 -15
- package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
- package/lib/Signal/Group/group-session-builder.js.map +0 -1
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
- package/lib/Signal/Group/group_cipher.js.map +0 -1
- package/lib/Signal/Group/index.d.ts +0 -12
- package/lib/Signal/Group/index.d.ts.map +0 -1
- package/lib/Signal/Group/index.js.map +0 -1
- package/lib/Signal/Group/keyhelper.d.ts +0 -11
- package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
- package/lib/Signal/Group/keyhelper.js.map +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
- package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-chain-key.js.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-message.d.ts +0 -19
- package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-name.d.ts +0 -18
- package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-name.js.map +0 -1
- package/lib/Signal/Group/sender-key-record.d.ts +0 -31
- package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-record.js.map +0 -1
- package/lib/Signal/Group/sender-key-state.d.ts +0 -39
- package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-state.js.map +0 -1
- package/lib/Signal/Group/sender-message-key.d.ts +0 -12
- package/lib/Signal/Group/sender-message-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-message-key.js.map +0 -1
- package/lib/Signal/libsignal.d.ts +0 -5
- package/lib/Signal/libsignal.d.ts.map +0 -1
- package/lib/Signal/libsignal.js.map +0 -1
- package/lib/Signal/lid-mapping.d.ts +0 -23
- package/lib/Signal/lid-mapping.d.ts.map +0 -1
- package/lib/Signal/lid-mapping.js +0 -277
- package/lib/Signal/lid-mapping.js.map +0 -1
- package/lib/Socket/Client/index.d.ts +0 -3
- package/lib/Socket/Client/index.d.ts.map +0 -1
- package/lib/Socket/Client/index.js.map +0 -1
- package/lib/Socket/Client/types.d.ts +0 -16
- package/lib/Socket/Client/types.d.ts.map +0 -1
- package/lib/Socket/Client/types.js.map +0 -1
- package/lib/Socket/Client/websocket.d.ts +0 -13
- package/lib/Socket/Client/websocket.d.ts.map +0 -1
- package/lib/Socket/Client/websocket.js.map +0 -1
- package/lib/Socket/business.d.ts +0 -217
- package/lib/Socket/business.d.ts.map +0 -1
- package/lib/Socket/business.js.map +0 -1
- package/lib/Socket/chats.d.ts +0 -124
- package/lib/Socket/chats.d.ts.map +0 -1
- package/lib/Socket/chats.js.map +0 -1
- package/lib/Socket/communities.d.ts +0 -273
- package/lib/Socket/communities.d.ts.map +0 -1
- package/lib/Socket/communities.js +0 -431
- package/lib/Socket/communities.js.map +0 -1
- package/lib/Socket/groups.d.ts +0 -161
- package/lib/Socket/groups.d.ts.map +0 -1
- package/lib/Socket/groups.js.map +0 -1
- package/lib/Socket/index.d.ts +0 -260
- package/lib/Socket/index.d.ts.map +0 -1
- package/lib/Socket/index.js.map +0 -1
- package/lib/Socket/messages-recv.d.ts +0 -203
- package/lib/Socket/messages-recv.d.ts.map +0 -1
- package/lib/Socket/messages-recv.js.map +0 -1
- package/lib/Socket/messages-send.d.ts +0 -199
- package/lib/Socket/messages-send.d.ts.map +0 -1
- package/lib/Socket/messages-send.js.map +0 -1
- package/lib/Socket/mex.d.ts +0 -3
- package/lib/Socket/mex.d.ts.map +0 -1
- package/lib/Socket/mex.js +0 -42
- package/lib/Socket/mex.js.map +0 -1
- package/lib/Socket/newsletter.d.ts +0 -170
- package/lib/Socket/newsletter.d.ts.map +0 -1
- package/lib/Socket/newsletter.js.map +0 -1
- package/lib/Socket/setup.js +0 -433
- package/lib/Socket/socket.d.ts +0 -59
- package/lib/Socket/socket.d.ts.map +0 -1
- package/lib/Socket/socket.js.map +0 -1
- package/lib/Types/Auth.d.ts +0 -117
- package/lib/Types/Auth.d.ts.map +0 -1
- package/lib/Types/Auth.js.map +0 -1
- package/lib/Types/Bussines.d.ts +0 -25
- package/lib/Types/Bussines.d.ts.map +0 -1
- package/lib/Types/Bussines.js +0 -2
- package/lib/Types/Bussines.js.map +0 -1
- package/lib/Types/Call.d.ts +0 -15
- package/lib/Types/Call.d.ts.map +0 -1
- package/lib/Types/Call.js.map +0 -1
- package/lib/Types/Chat.d.ts +0 -124
- package/lib/Types/Chat.d.ts.map +0 -1
- package/lib/Types/Chat.js.map +0 -1
- package/lib/Types/Contact.d.ts +0 -26
- package/lib/Types/Contact.d.ts.map +0 -1
- package/lib/Types/Contact.js.map +0 -1
- package/lib/Types/Events.d.ts +0 -256
- package/lib/Types/Events.d.ts.map +0 -1
- package/lib/Types/Events.js.map +0 -1
- package/lib/Types/GroupMetadata.d.ts +0 -71
- package/lib/Types/GroupMetadata.d.ts.map +0 -1
- package/lib/Types/GroupMetadata.js.map +0 -1
- package/lib/Types/Label.d.ts +0 -47
- package/lib/Types/Label.d.ts.map +0 -1
- package/lib/Types/Label.js.map +0 -1
- package/lib/Types/LabelAssociation.d.ts +0 -30
- package/lib/Types/LabelAssociation.d.ts.map +0 -1
- package/lib/Types/LabelAssociation.js.map +0 -1
- package/lib/Types/Message.d.ts +0 -320
- package/lib/Types/Message.d.ts.map +0 -1
- package/lib/Types/Message.js.map +0 -1
- package/lib/Types/Mex.d.ts +0 -141
- package/lib/Types/Mex.d.ts.map +0 -1
- package/lib/Types/Mex.js +0 -37
- package/lib/Types/Mex.js.map +0 -1
- package/lib/Types/Product.d.ts +0 -79
- package/lib/Types/Product.d.ts.map +0 -1
- package/lib/Types/Product.js.map +0 -1
- package/lib/Types/RichType.d.ts +0 -3
- package/lib/Types/RichType.d.ts.map +0 -1
- package/lib/Types/RichType.js +0 -31
- package/lib/Types/Signal.d.ts +0 -87
- package/lib/Types/Signal.d.ts.map +0 -1
- package/lib/Types/Signal.js.map +0 -1
- package/lib/Types/Socket.d.ts +0 -136
- package/lib/Types/Socket.d.ts.map +0 -1
- package/lib/Types/Socket.js.map +0 -1
- package/lib/Types/State.d.ts +0 -97
- package/lib/Types/State.d.ts.map +0 -1
- package/lib/Types/State.js.map +0 -1
- package/lib/Types/USync.d.ts +0 -26
- package/lib/Types/USync.d.ts.map +0 -1
- package/lib/Types/USync.js.map +0 -1
- package/lib/Types/index.d.ts +0 -65
- package/lib/Types/index.d.ts.map +0 -1
- package/lib/Types/index.js.map +0 -1
- package/lib/Utils/Tiktok.js +0 -80
- package/lib/Utils/auth-utils.d.ts +0 -24
- package/lib/Utils/auth-utils.d.ts.map +0 -1
- package/lib/Utils/auth-utils.js.map +0 -1
- package/lib/Utils/browser-utils.d.ts +0 -4
- package/lib/Utils/browser-utils.d.ts.map +0 -1
- package/lib/Utils/browser-utils.js.map +0 -1
- package/lib/Utils/business.d.ts +0 -23
- package/lib/Utils/business.d.ts.map +0 -1
- package/lib/Utils/business.js.map +0 -1
- package/lib/Utils/chaanel/vyzen.js +0 -0
- package/lib/Utils/chat-utils.d.ts +0 -100
- package/lib/Utils/chat-utils.d.ts.map +0 -1
- package/lib/Utils/chat-utils.js.map +0 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
- package/lib/Utils/companion-reg-client-utils.d.ts.map +0 -1
- package/lib/Utils/companion-reg-client-utils.js +0 -35
- package/lib/Utils/companion-reg-client-utils.js.map +0 -1
- package/lib/Utils/crypto.d.ts +0 -37
- package/lib/Utils/crypto.d.ts.map +0 -1
- package/lib/Utils/crypto.js.map +0 -1
- package/lib/Utils/decode-wa-message.d.ts +0 -66
- package/lib/Utils/decode-wa-message.d.ts.map +0 -1
- package/lib/Utils/decode-wa-message.js.map +0 -1
- package/lib/Utils/event-buffer.d.ts +0 -36
- package/lib/Utils/event-buffer.d.ts.map +0 -1
- package/lib/Utils/event-buffer.js.map +0 -1
- package/lib/Utils/facebook.js +0 -48
- package/lib/Utils/generics.d.ts +0 -91
- package/lib/Utils/generics.d.ts.map +0 -1
- package/lib/Utils/generics.js.map +0 -1
- package/lib/Utils/history.d.ts +0 -24
- package/lib/Utils/history.d.ts.map +0 -1
- package/lib/Utils/history.js.map +0 -1
- package/lib/Utils/identity-change-handler.d.ts +0 -44
- package/lib/Utils/identity-change-handler.d.ts.map +0 -1
- package/lib/Utils/identity-change-handler.js +0 -50
- package/lib/Utils/identity-change-handler.js.map +0 -1
- package/lib/Utils/index.d.ts +0 -22
- package/lib/Utils/index.d.ts.map +0 -1
- package/lib/Utils/index.js.map +0 -1
- package/lib/Utils/instagram.js +0 -50
- package/lib/Utils/link-preview.d.ts +0 -21
- package/lib/Utils/link-preview.d.ts.map +0 -1
- package/lib/Utils/link-preview.js.map +0 -1
- package/lib/Utils/logger.d.ts +0 -12
- package/lib/Utils/logger.d.ts.map +0 -1
- package/lib/Utils/logger.js.map +0 -1
- package/lib/Utils/lt-hash.d.ts +0 -8
- package/lib/Utils/lt-hash.d.ts.map +0 -1
- package/lib/Utils/lt-hash.js.map +0 -1
- package/lib/Utils/make-mutex.d.ts +0 -9
- package/lib/Utils/make-mutex.d.ts.map +0 -1
- package/lib/Utils/make-mutex.js.map +0 -1
- package/lib/Utils/message-retry-manager.d.ts +0 -115
- package/lib/Utils/message-retry-manager.d.ts.map +0 -1
- package/lib/Utils/message-retry-manager.js.map +0 -1
- package/lib/Utils/messages-media.d.ts +0 -133
- package/lib/Utils/messages-media.d.ts.map +0 -1
- package/lib/Utils/messages-media.js.map +0 -1
- package/lib/Utils/messages.d.ts +0 -91
- package/lib/Utils/messages.d.ts.map +0 -1
- package/lib/Utils/messages.js.map +0 -1
- package/lib/Utils/noise-handler.d.ts +0 -20
- package/lib/Utils/noise-handler.d.ts.map +0 -1
- package/lib/Utils/noise-handler.js.map +0 -1
- package/lib/Utils/offline-node-processor.d.ts +0 -17
- package/lib/Utils/offline-node-processor.d.ts.map +0 -1
- package/lib/Utils/offline-node-processor.js +0 -40
- package/lib/Utils/offline-node-processor.js.map +0 -1
- package/lib/Utils/pre-key-manager.d.ts +0 -28
- package/lib/Utils/pre-key-manager.d.ts.map +0 -1
- package/lib/Utils/pre-key-manager.js +0 -106
- package/lib/Utils/pre-key-manager.js.map +0 -1
- package/lib/Utils/process-message.d.ts +0 -60
- package/lib/Utils/process-message.d.ts.map +0 -1
- package/lib/Utils/process-message.js.map +0 -1
- package/lib/Utils/reporting-utils.d.ts +0 -11
- package/lib/Utils/reporting-utils.d.ts.map +0 -1
- package/lib/Utils/reporting-utils.js +0 -258
- package/lib/Utils/reporting-utils.js.map +0 -1
- package/lib/Utils/rich-message-utils.js +0 -387
- package/lib/Utils/signal.d.ts +0 -47
- package/lib/Utils/signal.d.ts.map +0 -1
- package/lib/Utils/signal.js.map +0 -1
- package/lib/Utils/stanza-ack.d.ts +0 -11
- package/lib/Utils/stanza-ack.d.ts.map +0 -1
- package/lib/Utils/stanza-ack.js +0 -38
- package/lib/Utils/stanza-ack.js.map +0 -1
- package/lib/Utils/sync-action-utils.d.ts +0 -19
- package/lib/Utils/sync-action-utils.d.ts.map +0 -1
- package/lib/Utils/sync-action-utils.js +0 -49
- package/lib/Utils/sync-action-utils.js.map +0 -1
- package/lib/Utils/tc-token-utils.d.ts +0 -37
- package/lib/Utils/tc-token-utils.d.ts.map +0 -1
- package/lib/Utils/tc-token-utils.js +0 -163
- package/lib/Utils/tc-token-utils.js.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.js.map +0 -1
- package/lib/Utils/validate-connection.d.ts +0 -11
- package/lib/Utils/validate-connection.d.ts.map +0 -1
- package/lib/Utils/validate-connection.js.map +0 -1
- package/lib/Utils/youtube.js +0 -44
- package/lib/WABinary/constants.d.ts +0 -28
- package/lib/WABinary/constants.d.ts.map +0 -1
- package/lib/WABinary/constants.js.map +0 -1
- package/lib/WABinary/decode.d.ts +0 -7
- package/lib/WABinary/decode.d.ts.map +0 -1
- package/lib/WABinary/decode.js.map +0 -1
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/encode.d.ts.map +0 -1
- package/lib/WABinary/encode.js.map +0 -1
- package/lib/WABinary/generic-utils.d.ts +0 -15
- package/lib/WABinary/generic-utils.d.ts.map +0 -1
- package/lib/WABinary/generic-utils.js.map +0 -1
- package/lib/WABinary/index.d.ts +0 -6
- package/lib/WABinary/index.d.ts.map +0 -1
- package/lib/WABinary/index.js.map +0 -1
- package/lib/WABinary/jid-utils.d.ts +0 -48
- package/lib/WABinary/jid-utils.d.ts.map +0 -1
- package/lib/WABinary/jid-utils.js.map +0 -1
- package/lib/WABinary/types.d.ts +0 -19
- package/lib/WABinary/types.d.ts.map +0 -1
- package/lib/WABinary/types.js.map +0 -1
- package/lib/WAM/BinaryInfo.d.ts +0 -9
- package/lib/WAM/BinaryInfo.d.ts.map +0 -1
- package/lib/WAM/BinaryInfo.js.map +0 -1
- package/lib/WAM/constants.d.ts +0 -40
- package/lib/WAM/constants.d.ts.map +0 -1
- package/lib/WAM/constants.js.map +0 -1
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/encode.d.ts.map +0 -1
- package/lib/WAM/encode.js.map +0 -1
- package/lib/WAM/index.d.ts +0 -4
- package/lib/WAM/index.d.ts.map +0 -1
- package/lib/WAM/index.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -23
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -13
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -13
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -25
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -26
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/index.d.ts +0 -6
- package/lib/WAUSync/Protocols/index.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/index.js.map +0 -1
- package/lib/WAUSync/USyncQuery.d.ts +0 -30
- package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
- package/lib/WAUSync/USyncQuery.js.map +0 -1
- package/lib/WAUSync/USyncUser.d.ts +0 -17
- package/lib/WAUSync/USyncUser.d.ts.map +0 -1
- package/lib/WAUSync/USyncUser.js.map +0 -1
- package/lib/WAUSync/index.d.ts +0 -4
- package/lib/WAUSync/index.d.ts.map +0 -1
- package/lib/WAUSync/index.js.map +0 -1
- package/lib/index.d.ts +0 -12
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
|
@@ -33,7 +33,55 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
33
33
|
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
|
|
34
34
|
useClones: false
|
|
35
35
|
});
|
|
36
|
+
const groupParticipantJidCache = new node_cache_1.default({
|
|
37
|
+
stdTTL: 10 * 60, // 10 mins
|
|
38
|
+
useClones: false
|
|
39
|
+
});
|
|
40
|
+
const groupMetadataWarmupCache = new node_cache_1.default({
|
|
41
|
+
stdTTL: 60, // avoid repeated warmup calls per group
|
|
42
|
+
useClones: false
|
|
43
|
+
});
|
|
36
44
|
let sendActiveReceipts = false;
|
|
45
|
+
const cacheGroupParticipants = (metadata) => {
|
|
46
|
+
for (const participant of metadata.participants || []) {
|
|
47
|
+
if (!participant.id || !participant.jid) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
groupParticipantJidCache.set(`${metadata.id}:${participant.id}`, participant.jid);
|
|
51
|
+
if (participant.lid) {
|
|
52
|
+
groupParticipantJidCache.set(`${metadata.id}:${participant.lid}`, participant.jid);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const warmupGroupParticipants = async (groupJid) => {
|
|
57
|
+
if (groupMetadataWarmupCache.get(groupJid)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
groupMetadataWarmupCache.set(groupJid, true);
|
|
61
|
+
try {
|
|
62
|
+
const metadata = await groupMetadata(groupJid);
|
|
63
|
+
cacheGroupParticipants(metadata);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
logger.debug({ error, groupJid }, 'failed to warm up group participant cache');
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const resolveGroupParticipantJid = async (groupJid, participantLid) => {
|
|
70
|
+
const cacheKey = `${groupJid}:${participantLid}`;
|
|
71
|
+
const cachedParticipant = groupParticipantJidCache.get(cacheKey);
|
|
72
|
+
if (cachedParticipant) {
|
|
73
|
+
return cachedParticipant;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const metadata = await groupMetadata(groupJid);
|
|
77
|
+
cacheGroupParticipants(metadata);
|
|
78
|
+
return groupParticipantJidCache.get(cacheKey);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
logger.debug({ error, groupJid, participantLid }, 'failed to resolve group participant jid');
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
37
85
|
const sendMessageAck = async ({ tag, attrs, content }, errorCode) => {
|
|
38
86
|
const stanza = {
|
|
39
87
|
tag: 'ack',
|
|
@@ -332,7 +380,7 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
332
380
|
break;
|
|
333
381
|
break;
|
|
334
382
|
default:
|
|
335
|
-
// console.log("
|
|
383
|
+
// console.log("WILEYS-DEBUG:", JSON.stringify({ ...child, content: Buffer.isBuffer(child.content) ? child.content.toString() : child.content, participant }, null, 2))
|
|
336
384
|
}
|
|
337
385
|
};
|
|
338
386
|
const handleNewsletterNotification = (id, node) => {
|
|
@@ -778,14 +826,18 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
778
826
|
}
|
|
779
827
|
if ((0, WABinary_1.isJidGroup)(msg.key.remoteJid) && ((_f = (_e = (_d = (_c = msg.message) === null || _c === void 0 ? void 0 : _c.extendedTextMessage) === null || _d === void 0 ? void 0 : _d.contextInfo) === null || _e === void 0 ? void 0 : _e.participant) === null || _f === void 0 ? void 0 : _f.endsWith('@lid'))) {
|
|
780
828
|
if (msg.message.extendedTextMessage.contextInfo) {
|
|
781
|
-
const metadata = await groupMetadata(msg.key.remoteJid);
|
|
782
829
|
const sender = msg.message.extendedTextMessage.contextInfo.participant;
|
|
783
|
-
const
|
|
784
|
-
msg.message.extendedTextMessage.contextInfo.participant =
|
|
830
|
+
const resolvedSender = await resolveGroupParticipantJid(msg.key.remoteJid, sender);
|
|
831
|
+
msg.message.extendedTextMessage.contextInfo.participant = resolvedSender || sender;
|
|
785
832
|
}
|
|
786
833
|
}
|
|
834
|
+
else if ((0, WABinary_1.isJidGroup)(msg.key.remoteJid)) {
|
|
835
|
+
void warmupGroupParticipants(msg.key.remoteJid);
|
|
836
|
+
}
|
|
787
837
|
if (!(0, WABinary_1.isJidGroup)(msg.key.remoteJid) && (0, WABinary_1.isLidUser)(msg.key.remoteJid)) {
|
|
788
|
-
msg.key.remoteJid = node.attrs.sender_pn
|
|
838
|
+
msg.key.remoteJid = node.attrs.sender_pn
|
|
839
|
+
|| node.attrs.peer_recipient_pn
|
|
840
|
+
|| (0, WABinary_1.lidToJid)(msg.key.remoteJid);
|
|
789
841
|
}
|
|
790
842
|
let participant = msg.key.participant;
|
|
791
843
|
if (category === 'peer') { // special peer message
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.makeMessagesSocket = void 0;
|
|
7
|
-
|
|
8
7
|
const boom_1 = require("@hapi/boom");
|
|
9
8
|
const node_cache_1 = __importDefault(require("@cacheable/node-cache"));
|
|
10
9
|
const crypto_1 = require("crypto");
|
|
10
|
+
const RexxHayanasi = require('./RHandler');
|
|
11
11
|
const WAProto_1 = require("../../WAProto");
|
|
12
12
|
const Defaults_1 = require("../Defaults");
|
|
13
13
|
const Utils_1 = require("../Utils");
|
|
@@ -15,31 +15,10 @@ const link_preview_1 = require("../Utils/link-preview");
|
|
|
15
15
|
const WABinary_1 = require("../WABinary");
|
|
16
16
|
const WAUSync_1 = require("../WAUSync");
|
|
17
17
|
const newsletter_1 = require("./newsletter");
|
|
18
|
-
const aveline = require("./setup");
|
|
19
|
-
|
|
20
18
|
const makeMessagesSocket = (config) => {
|
|
21
|
-
const { logger,
|
|
22
|
-
linkPreviewImageThumbnailWidth,
|
|
23
|
-
generateHighQualityLinkPreview,
|
|
24
|
-
options: axiosOptions,
|
|
25
|
-
patchMessageBeforeSending,
|
|
26
|
-
cachedGroupMetadata,
|
|
27
|
-
} = config;
|
|
28
|
-
|
|
19
|
+
const { logger, linkPreviewImageThumbnailWidth, generateHighQualityLinkPreview, options: axiosOptions, patchMessageBeforeSending, cachedGroupMetadata, albumMessageItemDelayMs = 0, } = config;
|
|
29
20
|
const sock = (0, newsletter_1.makeNewsletterSocket)(config);
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
ev,
|
|
33
|
-
authState,
|
|
34
|
-
processingMutex,
|
|
35
|
-
signalRepository,
|
|
36
|
-
upsertMessage,
|
|
37
|
-
query,
|
|
38
|
-
fetchPrivacySettings,
|
|
39
|
-
sendNode,
|
|
40
|
-
groupMetadata,
|
|
41
|
-
groupToggleEphemeral,
|
|
42
|
-
} = sock;
|
|
21
|
+
const { ev, authState, processingMutex, signalRepository, upsertMessage, query, fetchPrivacySettings, sendNode, groupMetadata, groupToggleEphemeral, } = sock;
|
|
43
22
|
const userDevicesCache = config.userDevicesCache || new node_cache_1.default({
|
|
44
23
|
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.USER_DEVICES, // 5 minutes
|
|
45
24
|
useClones: false
|
|
@@ -77,7 +56,7 @@ const makeMessagesSocket = (config) => {
|
|
|
77
56
|
/**
|
|
78
57
|
* generic send receipt function
|
|
79
58
|
* used for receipts of phone call, read, delivery etc.
|
|
80
|
-
*/
|
|
59
|
+
* */
|
|
81
60
|
const sendReceipt = async (jid, participant, messageIds, type) => {
|
|
82
61
|
const node = {
|
|
83
62
|
tag: 'receipt',
|
|
@@ -281,30 +260,16 @@ const makeMessagesSocket = (config) => {
|
|
|
281
260
|
}));
|
|
282
261
|
return { nodes, shouldIncludeDeviceIdentity };
|
|
283
262
|
};
|
|
284
|
-
const relayMessage = async (
|
|
285
|
-
jid,
|
|
286
|
-
message,
|
|
287
|
-
{
|
|
288
|
-
messageId:
|
|
289
|
-
msgId,
|
|
290
|
-
participant,
|
|
291
|
-
additionalAttributes,
|
|
292
|
-
additionalNodes,
|
|
293
|
-
useUserDevicesCache,
|
|
294
|
-
useCachedGroupMetadata,
|
|
295
|
-
statusJidList, AI = true }) => {
|
|
263
|
+
const relayMessage = async (jid, message, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }) => {
|
|
296
264
|
var _a;
|
|
297
265
|
const meId = authState.creds.me.id;
|
|
298
266
|
let shouldIncludeDeviceIdentity = false;
|
|
299
267
|
const { user, server } = (0, WABinary_1.jidDecode)(jid);
|
|
300
268
|
const statusJid = 'status@broadcast';
|
|
301
269
|
const isGroup = server === 'g.us';
|
|
302
|
-
const isPrivatee = server === 's.whatsapp.net'
|
|
303
270
|
const isNewsletter = server === 'newsletter';
|
|
304
271
|
const isStatus = jid === statusJid;
|
|
305
272
|
const isLid = server === 'lid';
|
|
306
|
-
const messages = Utils_1.normalizeMessageContent(message)
|
|
307
|
-
const pollMessage = messages.pollCreationMessage || messages.pollCreationMessageV2 || messages.pollCreationMessageV3
|
|
308
273
|
msgId = msgId || (0, Utils_1.generateMessageIDV2)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id);
|
|
309
274
|
useUserDevicesCache = useUserDevicesCache !== false;
|
|
310
275
|
useCachedGroupMetadata = useCachedGroupMetadata !== false && !isStatus;
|
|
@@ -524,33 +489,9 @@ const makeMessagesSocket = (config) => {
|
|
|
524
489
|
});
|
|
525
490
|
logger.debug({ jid }, 'adding device identity');
|
|
526
491
|
}
|
|
527
|
-
if (pollMessage || messages.eventMessage) {
|
|
528
|
-
let attrs = {};
|
|
529
|
-
if (messages.eventMessage) {
|
|
530
|
-
attrs.event_type = 'creation';
|
|
531
|
-
} else {
|
|
532
|
-
attrs.polltype = 'creation';
|
|
533
|
-
if (isNewsletter) {
|
|
534
|
-
attrs.contenttype = (pollMessage && pollMessage.pollContentType === 2) ? 'image' : 'text';
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
stanza.content.push({
|
|
538
|
-
tag: 'meta',
|
|
539
|
-
attrs: attrs
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
492
|
if (additionalNodes && additionalNodes.length > 0) {
|
|
543
493
|
stanza.content.push(...additionalNodes);
|
|
544
494
|
}
|
|
545
|
-
if (AI && isPrivatee) {
|
|
546
|
-
const botNode = {
|
|
547
|
-
tag: 'bot',
|
|
548
|
-
attrs: {
|
|
549
|
-
biz_bot: '1'
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
stanza.content.push(botNode);
|
|
553
|
-
}
|
|
554
495
|
const content = (0, Utils_1.normalizeMessageContent)(message);
|
|
555
496
|
const contentType = (0, Utils_1.getContentType)(content);
|
|
556
497
|
if (((0, WABinary_1.isJidGroup)(jid) || (0, WABinary_1.isJidUser)(jid)) && (contentType === 'interactiveMessage' ||
|
|
@@ -620,13 +561,7 @@ const makeMessagesSocket = (config) => {
|
|
|
620
561
|
if (message.imageMessage) {
|
|
621
562
|
return 'image';
|
|
622
563
|
}
|
|
623
|
-
else if (message.ptvMessage) {
|
|
624
|
-
return 'ptv';
|
|
625
|
-
}
|
|
626
564
|
else if (message.videoMessage) {
|
|
627
|
-
if (message.videoMessage.ptv) {
|
|
628
|
-
return 'ptv';
|
|
629
|
-
}
|
|
630
565
|
return message.videoMessage.gifPlayback ? 'gif' : 'video';
|
|
631
566
|
}
|
|
632
567
|
else if (message.audioMessage) {
|
|
@@ -665,9 +600,6 @@ const makeMessagesSocket = (config) => {
|
|
|
665
600
|
else if (message.interactiveResponseMessage) {
|
|
666
601
|
return 'native_flow_response';
|
|
667
602
|
}
|
|
668
|
-
else if (message.richResponseMessage) {
|
|
669
|
-
return 'rich_response';
|
|
670
|
-
}
|
|
671
603
|
else if (message.groupInviteMessage) {
|
|
672
604
|
return 'url';
|
|
673
605
|
}
|
|
@@ -699,16 +631,16 @@ const makeMessagesSocket = (config) => {
|
|
|
699
631
|
return result;
|
|
700
632
|
};
|
|
701
633
|
const waUploadToServer = (0, Utils_1.getWAUploadToServer)(config, refreshMediaConn);
|
|
702
|
-
const
|
|
634
|
+
const rexx = new RexxHayanasi(Utils_1, waUploadToServer, relayMessage);
|
|
703
635
|
const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(ev, 'messages.media-update');
|
|
704
636
|
return {
|
|
705
637
|
...sock,
|
|
638
|
+
rexx,
|
|
706
639
|
getPrivacyTokens,
|
|
707
640
|
assertSessions,
|
|
708
641
|
relayMessage,
|
|
709
642
|
sendReceipt,
|
|
710
643
|
sendReceipts,
|
|
711
|
-
avelinel,
|
|
712
644
|
readMessages,
|
|
713
645
|
refreshMediaConn,
|
|
714
646
|
waUploadToServer,
|
|
@@ -757,206 +689,9 @@ const makeMessagesSocket = (config) => {
|
|
|
757
689
|
]);
|
|
758
690
|
return message;
|
|
759
691
|
},
|
|
760
|
-
sendStatusMentions: async (content, jids = []) => {
|
|
761
|
-
const userJid = WABinary_1.jidNormalizedUser(authState.creds.me.id)
|
|
762
|
-
let allUsers = new Set()
|
|
763
|
-
allUsers.add(userJid)
|
|
764
|
-
|
|
765
|
-
for (const id of jids) {
|
|
766
|
-
const isGroup = WABinary_1.isJidGroup(id)
|
|
767
|
-
const isPrivate = WABinary_1.isJidUser(id)
|
|
768
|
-
|
|
769
|
-
if (isGroup) {
|
|
770
|
-
try {
|
|
771
|
-
const metadata = await cachedGroupMetadata(id) || await global.groupMetadataCache(id)
|
|
772
|
-
const participants = metadata.participants.map(p => WABinary_1.jidNormalizedUser(p.id))
|
|
773
|
-
participants.forEach(jid => allUsers.add(jid))
|
|
774
|
-
} catch (error) {
|
|
775
|
-
logger.error(`Error getting metadata for group ${id}: ${error}`)
|
|
776
|
-
}
|
|
777
|
-
} else if (isPrivate) {
|
|
778
|
-
allUsers.add(WABinary_1.jidNormalizedUser(id))
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
const uniqueUsers = Array.from(allUsers)
|
|
783
|
-
const getRandomHexColor = () => "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")
|
|
784
|
-
|
|
785
|
-
const isMedia = content.image || content.video || content.audio
|
|
786
|
-
const isAudio = !!content.audio
|
|
787
|
-
|
|
788
|
-
const messageContent = {
|
|
789
|
-
...content
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
if (isMedia && !isAudio) {
|
|
793
|
-
if (messageContent.text) {
|
|
794
|
-
messageContent.caption = messageContent.text
|
|
795
|
-
|
|
796
|
-
delete messageContent.text
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
delete messageContent.ptt
|
|
800
|
-
delete messageContent.font
|
|
801
|
-
delete messageContent.backgroundColor
|
|
802
|
-
delete messageContent.textColor
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
if (isAudio) {
|
|
806
|
-
delete messageContent.text
|
|
807
|
-
delete messageContent.caption
|
|
808
|
-
delete messageContent.font
|
|
809
|
-
delete messageContent.textColor
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
const font = !isMedia ? (content.font || Math.floor(Math.random() * 9)) : undefined
|
|
813
|
-
const textColor = !isMedia ? (content.textColor || getRandomHexColor()) : undefined
|
|
814
|
-
const backgroundColor = (!isMedia || isAudio) ? (content.backgroundColor || getRandomHexColor()) : undefined
|
|
815
|
-
const ptt = isAudio ? (typeof content.ptt === 'boolean' ? content.ptt : true) : undefined
|
|
816
|
-
|
|
817
|
-
let msg
|
|
818
|
-
let mediaHandle
|
|
819
|
-
try {
|
|
820
|
-
msg = await Utils_1.generateWAMessage(WABinary_1.STORIES_JID, messageContent, {
|
|
821
|
-
logger,
|
|
822
|
-
userJid,
|
|
823
|
-
getUrlInfo: text => link_preview_1.getUrlInfo(text, {
|
|
824
|
-
thumbnailWidth: linkPreviewImageThumbnailWidth,
|
|
825
|
-
fetchOpts: {
|
|
826
|
-
timeout: 3000,
|
|
827
|
-
...axiosOptions || {}
|
|
828
|
-
},
|
|
829
|
-
logger,
|
|
830
|
-
uploadImage: generateHighQualityLinkPreview ? waUploadToServer : undefined
|
|
831
|
-
}),
|
|
832
|
-
upload: async (encFilePath, opts) => {
|
|
833
|
-
const up = await waUploadToServer(encFilePath, {
|
|
834
|
-
...opts
|
|
835
|
-
})
|
|
836
|
-
mediaHandle = up.handle
|
|
837
|
-
return up
|
|
838
|
-
},
|
|
839
|
-
mediaCache: config.mediaCache,
|
|
840
|
-
options: config.options,
|
|
841
|
-
font,
|
|
842
|
-
textColor,
|
|
843
|
-
backgroundColor,
|
|
844
|
-
ptt
|
|
845
|
-
})
|
|
846
|
-
} catch (error) {
|
|
847
|
-
logger.error(`Error generating message: ${error}`)
|
|
848
|
-
throw error
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
await relayMessage(WABinary_1.STORIES_JID, msg.message, {
|
|
852
|
-
messageId: msg.key.id,
|
|
853
|
-
statusJidList: uniqueUsers,
|
|
854
|
-
additionalNodes: [{
|
|
855
|
-
tag: 'meta',
|
|
856
|
-
attrs: {},
|
|
857
|
-
content: [{
|
|
858
|
-
tag: 'mentioned_users',
|
|
859
|
-
attrs: {},
|
|
860
|
-
content: jids.map(jid => ({
|
|
861
|
-
tag: 'to',
|
|
862
|
-
attrs: {
|
|
863
|
-
jid: WABinary_1.jidNormalizedUser(jid)
|
|
864
|
-
}
|
|
865
|
-
}))
|
|
866
|
-
}]
|
|
867
|
-
}]
|
|
868
|
-
})
|
|
869
|
-
|
|
870
|
-
for (const id of jids) {
|
|
871
|
-
try {
|
|
872
|
-
const normalizedId = WABinary_1.jidNormalizedUser(id)
|
|
873
|
-
const isPrivate = WABinary_1.isJidUser(normalizedId)
|
|
874
|
-
const type = isPrivate ? 'statusMentionMessage' : 'groupStatusMentionMessage'
|
|
875
|
-
|
|
876
|
-
const protocolMessage = {
|
|
877
|
-
[type]: {
|
|
878
|
-
message: {
|
|
879
|
-
protocolMessage: {
|
|
880
|
-
key: msg.key,
|
|
881
|
-
type: 25
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
},
|
|
885
|
-
messageContextInfo: {
|
|
886
|
-
messageSecret: crypto_1.randomBytes(32)
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
const statusMsg = await Utils_1.generateWAMessageFromContent(normalizedId,
|
|
891
|
-
protocolMessage, {}
|
|
892
|
-
)
|
|
893
|
-
|
|
894
|
-
await relayMessage(
|
|
895
|
-
normalizedId,
|
|
896
|
-
statusMsg.message, {
|
|
897
|
-
additionalNodes: [{
|
|
898
|
-
tag: 'meta',
|
|
899
|
-
attrs: isPrivate ? {
|
|
900
|
-
is_status_mention: 'true'
|
|
901
|
-
} : {
|
|
902
|
-
is_group_status_mention: 'true'
|
|
903
|
-
}
|
|
904
|
-
}]
|
|
905
|
-
}
|
|
906
|
-
)
|
|
907
|
-
|
|
908
|
-
await Utils_1.delay(2000)
|
|
909
|
-
} catch (error) {
|
|
910
|
-
logger.error(`Error sending to ${id}: ${error}`)
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
return msg
|
|
915
|
-
},
|
|
916
692
|
sendMessage: async (jid, content, options = {}) => {
|
|
917
693
|
var _a, _b, _c;
|
|
918
694
|
const userJid = authState.creds.me.id;
|
|
919
|
-
const getParticipantAttr = () => filter ? { participant: { jid } } : {};
|
|
920
|
-
const { filter = false, quoted } = options;
|
|
921
|
-
const messageType = avelinel.detectType(content);
|
|
922
|
-
|
|
923
|
-
if (messageType) {
|
|
924
|
-
switch (messageType) {
|
|
925
|
-
case 'PAYMENT':
|
|
926
|
-
const paymentContent = await avelinel.handlePayment(content, quoted);
|
|
927
|
-
return await relayMessage(jid, paymentContent, {
|
|
928
|
-
messageId: Utils_1.generateMessageID(),
|
|
929
|
-
...getParticipantAttr()
|
|
930
|
-
});
|
|
931
|
-
|
|
932
|
-
case 'PRODUCT':
|
|
933
|
-
const productContent = await avelinel.handleProduct(content, jid, quoted);
|
|
934
|
-
const productMsg = await Utils_1.generateWAMessageFromContent(jid, productContent, { quoted });
|
|
935
|
-
return await relayMessage(jid, productMsg.message, {
|
|
936
|
-
messageId: productMsg.key.id,
|
|
937
|
-
...getParticipantAttr()
|
|
938
|
-
});
|
|
939
|
-
|
|
940
|
-
case 'INTERACTIVE':
|
|
941
|
-
const interactiveContent = await avelinel.handleInteractive(content, jid, quoted);
|
|
942
|
-
const interactiveMsg = await Utils_1.generateWAMessageFromContent(jid, interactiveContent, { quoted });
|
|
943
|
-
return await relayMessage(jid, interactiveMsg.message, {
|
|
944
|
-
messageId: interactiveMsg.key.id,
|
|
945
|
-
...getParticipantAttr()
|
|
946
|
-
});
|
|
947
|
-
|
|
948
|
-
case 'ALBUM':
|
|
949
|
-
const albumContent = await avelinel.handleAlbum(content, jid, quoted);
|
|
950
|
-
return albumContent;
|
|
951
|
-
|
|
952
|
-
case 'EVENT':
|
|
953
|
-
return await avelinel.handleEvent(content, jid, quoted);
|
|
954
|
-
|
|
955
|
-
case 'POLL_RESULT':
|
|
956
|
-
return await avelinel.handlePollResult(content, jid, quoted);
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
|
|
960
695
|
if (!options.ephemeralExpiration) {
|
|
961
696
|
if ((0, WABinary_1.isJidGroup)(jid)) {
|
|
962
697
|
const groups = await sock.groupQuery(jid, 'get', [{
|
|
@@ -970,7 +705,6 @@ const makeMessagesSocket = (config) => {
|
|
|
970
705
|
options.ephemeralExpiration = expiration;
|
|
971
706
|
}
|
|
972
707
|
}
|
|
973
|
-
|
|
974
708
|
if (typeof content === 'object' &&
|
|
975
709
|
'disappearingMessagesInChat' in content &&
|
|
976
710
|
typeof content['disappearingMessagesInChat'] !== 'undefined' &&
|
|
@@ -1046,6 +780,36 @@ const makeMessagesSocket = (config) => {
|
|
|
1046
780
|
}
|
|
1047
781
|
return albumMsg;
|
|
1048
782
|
}
|
|
783
|
+
else if (typeof content === 'object' && 'stickerPack' in content) {
|
|
784
|
+
const msg = (0, Utils_1.generateWAMessageFromContent)(
|
|
785
|
+
jid,
|
|
786
|
+
content,
|
|
787
|
+
{
|
|
788
|
+
userJid,
|
|
789
|
+
upload: waUploadToServer,
|
|
790
|
+
logger,
|
|
791
|
+
options: config.options,
|
|
792
|
+
mediaUploadTimeoutMs: options.mediaUploadTimeoutMs
|
|
793
|
+
}
|
|
794
|
+
);
|
|
795
|
+
|
|
796
|
+
await relayMessage(jid, msg.message, {
|
|
797
|
+
messageId: msg.key.id,
|
|
798
|
+
useCachedGroupMetadata: options.useCachedGroupMetadata
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
if (config.emitOwnEvents) {
|
|
802
|
+
process.nextTick(() => {
|
|
803
|
+
processingMutex.mutex(() => upsertMessage(msg, 'append'));
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
return msg;
|
|
808
|
+
}
|
|
809
|
+
else if (content.groupStatusMessage) {
|
|
810
|
+
const { quoted } = options;
|
|
811
|
+
return await rexx.handleGroupStory(content, jid, quoted);
|
|
812
|
+
}
|
|
1049
813
|
else {
|
|
1050
814
|
let mediaHandle;
|
|
1051
815
|
const fullMsg = await (0, Utils_1.generateWAMessage)(jid, content, {
|
|
@@ -1078,7 +842,7 @@ const makeMessagesSocket = (config) => {
|
|
|
1078
842
|
const isPinMsg = 'pin' in content && !!content.pin;
|
|
1079
843
|
const isKeepMsg = 'keep' in content && content.keep;
|
|
1080
844
|
const isPollMessage = 'poll' in content && !!content.poll;
|
|
1081
|
-
const isAiMsg =
|
|
845
|
+
const isAiMsg = content && content.ai === true;
|
|
1082
846
|
const additionalAttributes = {};
|
|
1083
847
|
const additionalNodes = [];
|
|
1084
848
|
// required for delete
|
|
@@ -1113,13 +877,16 @@ const makeMessagesSocket = (config) => {
|
|
|
1113
877
|
});
|
|
1114
878
|
// required to display AI icon on message
|
|
1115
879
|
}
|
|
880
|
+
|
|
1116
881
|
else if (isAiMsg) {
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
882
|
+
fullMsg.message.messageContextInfo = {
|
|
883
|
+
...(fullMsg.message.messageContextInfo || {}),
|
|
884
|
+
businessMessageType: 3,
|
|
885
|
+
aiMessageMetadata: {
|
|
886
|
+
isAiMessage: true
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
}
|
|
1123
890
|
if (mediaHandle) {
|
|
1124
891
|
additionalAttributes['media_id'] = mediaHandle;
|
|
1125
892
|
}
|