lordceaser-baileys 2.0.0 → 2.0.2
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/index.js +136901 -78899
- package/WASignalGroup/GroupProtocol.js +1697 -0
- package/WASignalGroup/ciphertext_message.js +16 -0
- package/WASignalGroup/group_cipher.js +120 -0
- package/WASignalGroup/group_session_builder.js +46 -0
- package/WASignalGroup/index.js +5 -0
- package/WASignalGroup/keyhelper.js +21 -0
- package/WASignalGroup/protobufs.js +3 -0
- package/WASignalGroup/queue_job.js +69 -0
- package/WASignalGroup/sender_chain_key.js +50 -0
- package/WASignalGroup/sender_key_distribution_message.js +78 -0
- package/WASignalGroup/sender_key_message.js +92 -0
- package/WASignalGroup/sender_key_name.js +70 -0
- package/WASignalGroup/sender_key_record.js +56 -0
- package/WASignalGroup/sender_key_state.js +129 -0
- package/{lib/Signal/Group/sender-message-key.js → WASignalGroup/sender_message_key.js} +16 -3
- package/index.js +17 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +15 -37
- package/lib/Defaults/index.js +60 -81
- package/lib/Signal/libsignal.d.ts +3 -5
- package/lib/Signal/libsignal.js +80 -359
- package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +5 -4
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.d.ts +3 -3
- package/lib/Socket/Client/index.js +19 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +2 -3
- package/lib/Socket/Client/web-socket-client.js +62 -0
- package/lib/Socket/business.d.ts +100 -147
- package/lib/Socket/business.js +43 -162
- package/lib/Socket/chats.d.ts +41 -85
- package/lib/Socket/chats.js +321 -569
- package/lib/Socket/groups.d.ts +57 -103
- package/lib/Socket/groups.js +84 -116
- package/lib/Socket/index.d.ts +106 -194
- package/lib/Socket/index.js +9 -11
- package/lib/Socket/messages-recv.d.ts +89 -134
- package/lib/Socket/messages-recv.js +475 -1275
- package/lib/Socket/messages-send.d.ts +97 -141
- package/lib/Socket/messages-send.js +633 -691
- package/lib/Socket/newsletter.d.ts +74 -112
- package/lib/Socket/newsletter.js +202 -147
- package/lib/Socket/registration.d.ts +264 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +19 -34
- package/lib/Socket/socket.js +219 -547
- package/lib/Socket/usync.d.ts +37 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/make-cache-manager-store.d.ts +14 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/lib/Store/make-in-memory-store.js +431 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.js +81 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +27 -0
- package/lib/Types/Auth.d.ts +11 -19
- package/lib/Types/Auth.js +2 -2
- package/lib/Types/Call.d.ts +1 -3
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Chat.d.ts +8 -25
- package/lib/Types/Chat.js +4 -8
- package/lib/Types/Contact.d.ts +1 -8
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Events.d.ts +17 -101
- package/lib/Types/Events.js +2 -2
- package/lib/Types/GroupMetadata.d.ts +3 -18
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/Label.d.ts +0 -1
- package/lib/Types/Label.js +5 -3
- package/lib/Types/LabelAssociation.d.ts +0 -1
- package/lib/Types/LabelAssociation.js +5 -3
- package/lib/Types/Message.d.ts +204 -91
- package/lib/Types/Message.js +9 -11
- package/lib/Types/Newsletter.d.ts +92 -0
- package/lib/Types/Newsletter.js +32 -0
- package/lib/Types/Product.d.ts +1 -2
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Signal.d.ts +2 -32
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Socket.d.ts +24 -44
- package/lib/Types/Socket.js +2 -3
- package/lib/Types/State.d.ts +2 -72
- package/lib/Types/State.js +2 -56
- package/lib/Types/USync.d.ts +2 -3
- package/lib/Types/USync.js +2 -2
- package/lib/Types/index.d.ts +16 -16
- package/lib/Types/index.js +31 -15
- package/lib/Utils/auth-utils.d.ts +6 -12
- package/lib/Utils/auth-utils.js +143 -239
- package/lib/Utils/baileys-event-stream.d.ts +16 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/business.d.ts +3 -4
- package/lib/Utils/business.js +69 -66
- package/lib/Utils/c4-compat.js +0 -8
- package/lib/Utils/chat-utils.d.ts +17 -47
- package/lib/Utils/chat-utils.js +237 -364
- package/lib/Utils/crypto.d.ts +21 -18
- package/lib/Utils/crypto.js +125 -44
- package/lib/Utils/decode-wa-message.d.ts +8 -38
- package/lib/Utils/decode-wa-message.js +90 -173
- package/lib/Utils/event-buffer.d.ts +8 -9
- package/lib/Utils/event-buffer.js +71 -176
- package/lib/Utils/generics.d.ts +22 -26
- package/lib/Utils/generics.js +175 -166
- package/lib/Utils/history.d.ts +11 -16
- package/lib/Utils/history.js +53 -93
- package/lib/Utils/index.d.ts +17 -22
- package/lib/Utils/index.js +34 -22
- package/lib/Utils/link-preview.d.ts +5 -5
- package/lib/Utils/link-preview.js +24 -16
- package/lib/Utils/logger.d.ts +1 -11
- package/lib/Utils/logger.js +7 -3
- package/lib/Utils/lt-hash.d.ts +12 -8
- package/lib/Utils/lt-hash.js +46 -3
- package/lib/Utils/make-mutex.d.ts +0 -2
- package/lib/Utils/make-mutex.js +34 -24
- package/lib/Utils/messages-media.d.ts +45 -65
- package/lib/Utils/messages-media.js +358 -425
- package/lib/Utils/messages.d.ts +18 -32
- package/lib/Utils/messages.js +720 -392
- package/lib/Utils/noise-handler.d.ts +13 -13
- package/lib/Utils/noise-handler.js +108 -149
- package/lib/Utils/process-message.d.ts +11 -30
- package/lib/Utils/process-message.js +166 -423
- package/lib/Utils/signal.d.ts +6 -20
- package/lib/Utils/signal.js +65 -107
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -2
- package/lib/Utils/use-multi-file-auth-state.js +103 -57
- package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
- package/lib/Utils/use-single-file-auth-state.js +76 -0
- package/lib/Utils/validate-connection.d.ts +6 -6
- package/lib/Utils/validate-connection.js +114 -119
- package/lib/WABinary/constants.d.ts +4 -5
- package/lib/WABinary/constants.js +20 -1281
- package/lib/WABinary/decode.d.ts +3 -4
- package/lib/WABinary/decode.js +53 -51
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +44 -12
- package/lib/WABinary/generic-utils.d.ts +6 -7
- package/lib/WABinary/generic-utils.js +43 -46
- package/lib/WABinary/index.d.ts +5 -6
- package/lib/WABinary/index.js +21 -6
- package/lib/WABinary/jid-utils.d.ts +7 -24
- package/lib/WABinary/jid-utils.js +40 -74
- package/lib/WABinary/types.d.ts +1 -2
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.d.ts +1 -2
- package/lib/WAM/BinaryInfo.js +5 -2
- package/lib/WAM/constants.d.ts +3 -5
- package/lib/WAM/constants.js +11958 -19461
- package/lib/WAM/encode.d.ts +2 -3
- package/lib/WAM/encode.js +22 -17
- package/lib/WAM/index.d.ts +3 -4
- package/lib/WAM/index.js +19 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +13 -33
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +14 -11
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -9
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +13 -9
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +22 -20
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -5
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +8 -13
- package/lib/WAUSync/Protocols/index.d.ts +4 -6
- package/lib/WAUSync/Protocols/index.js +20 -6
- package/lib/WAUSync/USyncQuery.d.ts +4 -6
- package/lib/WAUSync/USyncQuery.js +35 -44
- package/lib/WAUSync/USyncUser.d.ts +4 -11
- package/lib/WAUSync/USyncUser.js +5 -10
- package/lib/WAUSync/index.d.ts +3 -4
- package/lib/WAUSync/index.js +19 -4
- package/lib/index.js +31 -13
- package/package.json +19 -10
- package/WAProto/GenerateStatics.sh +0 -3
- package/WAProto/WAProto.proto +0 -5479
- package/WAProto/fix-imports.js +0 -85
- package/WAProto/index.d.ts +0 -14017
- 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 +0 -12
- 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 +0 -30
- 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 +0 -82
- 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 +0 -12
- 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 +0 -18
- 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 +0 -26
- 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 +0 -63
- 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 +0 -66
- 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 +0 -48
- 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 +0 -41
- 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 +0 -84
- 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.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.map +0 -1
- package/lib/Socket/Client/index.js.map +0 -1
- package/lib/Socket/Client/types.d.ts.map +0 -1
- package/lib/Socket/Client/types.js +0 -11
- package/lib/Socket/Client/types.js.map +0 -1
- package/lib/Socket/Client/websocket.d.ts.map +0 -1
- package/lib/Socket/Client/websocket.js +0 -54
- package/lib/Socket/Client/websocket.js.map +0 -1
- package/lib/Socket/business.d.ts.map +0 -1
- package/lib/Socket/business.js.map +0 -1
- 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.map +0 -1
- package/lib/Socket/groups.js.map +0 -1
- package/lib/Socket/index.d.ts.map +0 -1
- package/lib/Socket/index.js.map +0 -1
- 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.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.map +0 -1
- package/lib/Socket/newsletter.js.map +0 -1
- package/lib/Socket/socket.d.ts.map +0 -1
- package/lib/Socket/socket.js.map +0 -1
- 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.map +0 -1
- package/lib/Types/Call.js.map +0 -1
- package/lib/Types/Chat.d.ts.map +0 -1
- package/lib/Types/Chat.js.map +0 -1
- package/lib/Types/Contact.d.ts.map +0 -1
- package/lib/Types/Contact.js.map +0 -1
- package/lib/Types/Events.d.ts.map +0 -1
- package/lib/Types/Events.js.map +0 -1
- package/lib/Types/GroupMetadata.d.ts.map +0 -1
- package/lib/Types/GroupMetadata.js.map +0 -1
- package/lib/Types/Label.d.ts.map +0 -1
- package/lib/Types/Label.js.map +0 -1
- package/lib/Types/LabelAssociation.d.ts.map +0 -1
- package/lib/Types/LabelAssociation.js.map +0 -1
- 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.map +0 -1
- package/lib/Types/Product.js.map +0 -1
- package/lib/Types/Signal.d.ts.map +0 -1
- package/lib/Types/Signal.js.map +0 -1
- package/lib/Types/Socket.d.ts.map +0 -1
- package/lib/Types/Socket.js.map +0 -1
- package/lib/Types/State.d.ts.map +0 -1
- package/lib/Types/State.js.map +0 -1
- package/lib/Types/USync.d.ts.map +0 -1
- package/lib/Types/USync.js.map +0 -1
- package/lib/Types/index.d.ts.map +0 -1
- package/lib/Types/index.js.map +0 -1
- 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 +0 -29
- package/lib/Utils/browser-utils.js.map +0 -1
- package/lib/Utils/business.d.ts.map +0 -1
- package/lib/Utils/business.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/crypto.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/event-buffer.js.map +0 -1
- package/lib/Utils/generics.d.ts.map +0 -1
- package/lib/Utils/generics.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/index.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/logger.js.map +0 -1
- 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.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 +0 -265
- package/lib/Utils/message-retry-manager.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/messages.js.map +0 -1
- 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.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/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 -164
- package/lib/Utils/tc-token-utils.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/validate-connection.js.map +0 -1
- package/lib/WABinary/constants.d.ts.map +0 -1
- package/lib/WABinary/constants.js.map +0 -1
- package/lib/WABinary/decode.d.ts.map +0 -1
- package/lib/WABinary/decode.js.map +0 -1
- package/lib/WABinary/encode.d.ts.map +0 -1
- package/lib/WABinary/encode.js.map +0 -1
- 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.map +0 -1
- package/lib/WABinary/index.js.map +0 -1
- 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.map +0 -1
- package/lib/WABinary/types.js.map +0 -1
- package/lib/WAM/BinaryInfo.d.ts.map +0 -1
- package/lib/WAM/BinaryInfo.js.map +0 -1
- package/lib/WAM/constants.d.ts.map +0 -1
- package/lib/WAM/constants.js.map +0 -1
- package/lib/WAM/encode.d.ts.map +0 -1
- package/lib/WAM/encode.js.map +0 -1
- package/lib/WAM/index.d.ts.map +0 -1
- package/lib/WAM/index.js.map +0 -1
- 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.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
- 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.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.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
- 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.map +0 -1
- package/lib/WAUSync/Protocols/index.js.map +0 -1
- package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
- package/lib/WAUSync/USyncQuery.js.map +0 -1
- package/lib/WAUSync/USyncUser.d.ts.map +0 -1
- package/lib/WAUSync/USyncUser.js.map +0 -1
- 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
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { proto } from '../../WAProto
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { proto } from '../../WAProto';
|
|
3
|
+
import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
|
|
4
|
+
import { BinaryNode } from '../WABinary';
|
|
5
5
|
export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
6
|
+
groupQuery: (jid: string, type: 'get' | 'set', content: BinaryNode[]) => Promise<BinaryNode>;
|
|
6
7
|
groupMetadata: (jid: string) => Promise<GroupMetadata>;
|
|
7
8
|
groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
|
|
8
9
|
groupLeave: (id: string) => Promise<void>;
|
|
@@ -10,152 +11,105 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
10
11
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
11
12
|
[key: string]: string;
|
|
12
13
|
}[]>;
|
|
13
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action:
|
|
14
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
|
|
14
15
|
status: string;
|
|
15
|
-
jid: string
|
|
16
|
+
jid: string;
|
|
16
17
|
}[]>;
|
|
17
18
|
groupParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
|
|
18
19
|
status: string;
|
|
19
|
-
jid: string
|
|
20
|
+
jid: string;
|
|
20
21
|
content: BinaryNode;
|
|
21
22
|
}[]>;
|
|
22
23
|
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
23
24
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
24
25
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
25
26
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* revoke a v4 invite for someone
|
|
28
|
-
* @param groupJid group jid
|
|
29
|
-
* @param invitedJid jid of person you invited
|
|
30
|
-
* @returns true if successful
|
|
31
|
-
*/
|
|
32
|
-
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
|
|
33
27
|
/**
|
|
34
28
|
* accept a GroupInviteMessage
|
|
35
29
|
* @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
|
|
36
30
|
* @param inviteMessage the message to accept
|
|
37
31
|
*/
|
|
38
|
-
groupAcceptInviteV4: (key: string |
|
|
32
|
+
groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
|
|
39
33
|
groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
|
|
40
34
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
41
|
-
groupSettingUpdate: (jid: string, setting:
|
|
42
|
-
groupMemberAddMode: (jid: string, mode:
|
|
43
|
-
groupJoinApprovalMode: (jid: string, mode:
|
|
35
|
+
groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>;
|
|
36
|
+
groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>;
|
|
37
|
+
groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>;
|
|
44
38
|
groupFetchAllParticipating: () => Promise<{
|
|
45
39
|
[_: string]: GroupMetadata;
|
|
46
40
|
}>;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
lidTrustedTokenIssueToLid: boolean;
|
|
51
|
-
};
|
|
52
|
-
createCallLink: (type: "audio" | "video", event?: {
|
|
53
|
-
startTime: number;
|
|
54
|
-
}, timeoutMs?: number) => Promise<string | undefined>;
|
|
55
|
-
getBotListV2: () => Promise<import("../Types/index.js").BotListInfo[]>;
|
|
56
|
-
messageMutex: {
|
|
57
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
58
|
-
};
|
|
59
|
-
receiptMutex: {
|
|
60
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
61
|
-
};
|
|
62
|
-
appStatePatchMutex: {
|
|
63
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
64
|
-
};
|
|
65
|
-
notificationMutex: {
|
|
66
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
41
|
+
interactiveQuery: (userNodes: BinaryNode[], queryNode: BinaryNode) => Promise<BinaryNode[]>;
|
|
42
|
+
processingMutex: {
|
|
43
|
+
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
67
44
|
};
|
|
68
45
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
69
46
|
[_: string]: string;
|
|
70
47
|
}>;
|
|
71
|
-
upsertMessage: (msg:
|
|
72
|
-
appPatch: (patchCreate: import("../Types
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
48
|
+
upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
49
|
+
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
50
|
+
fetchUserLid: (jid: string) => Promise<string | undefined>;
|
|
51
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
|
|
52
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
|
|
53
|
+
onWhatsApp: (...jids: string[]) => Promise<{
|
|
54
|
+
jid: string;
|
|
55
|
+
exists: unknown;
|
|
56
|
+
}[] | undefined>;
|
|
57
|
+
fetchBlocklist: () => Promise<string[]>;
|
|
58
|
+
fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
|
|
59
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
|
|
60
|
+
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
83
61
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
84
62
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
85
63
|
updateProfileName: (name: string) => Promise<void>;
|
|
86
64
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
updateStatusPrivacy: (value: import("../Types/index.js").WAPrivacyValue) => Promise<void>;
|
|
94
|
-
updateReadReceiptsPrivacy: (value: import("../Types/index.js").WAReadReceiptsValue) => Promise<void>;
|
|
95
|
-
updateGroupsAddPrivacy: (value: import("../Types/index.js").WAPrivacyGroupAddValue) => Promise<void>;
|
|
65
|
+
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
66
|
+
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
67
|
+
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
68
|
+
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
69
|
+
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
70
|
+
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
96
71
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
97
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types
|
|
98
|
-
resyncAppState: (collections: readonly ("
|
|
99
|
-
chatModify: (mod: import("../Types
|
|
100
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number |
|
|
101
|
-
addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
|
|
102
|
-
removeContact: (jid: string) => Promise<void>;
|
|
103
|
-
placeholderResendCache: import("../Types/index.js").CacheStore;
|
|
104
|
-
addLabel: (jid: string, labels: import("../Types/Label.js").LabelActionBody) => Promise<void>;
|
|
72
|
+
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
|
|
73
|
+
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
74
|
+
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
75
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
|
|
105
76
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
106
77
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
107
78
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
108
79
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
109
80
|
star: (jid: string, messages: {
|
|
110
81
|
id: string;
|
|
111
|
-
fromMe?: boolean;
|
|
82
|
+
fromMe?: boolean | undefined;
|
|
112
83
|
}[], star: boolean) => Promise<void>;
|
|
113
|
-
|
|
114
|
-
removeQuickReply: (timestamp: string) => Promise<void>;
|
|
84
|
+
executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>;
|
|
115
85
|
type: "md";
|
|
116
|
-
ws:
|
|
117
|
-
ev: import("../Types
|
|
118
|
-
process(handler: (events: Partial<import("../Types
|
|
86
|
+
ws: any;
|
|
87
|
+
ev: import("../Types").BaileysEventEmitter & {
|
|
88
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
119
89
|
buffer(): void;
|
|
120
|
-
createBufferedFunction<A extends any[],
|
|
121
|
-
flush(): boolean;
|
|
90
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
|
91
|
+
flush(force?: boolean | undefined): boolean;
|
|
122
92
|
isBuffering(): boolean;
|
|
123
|
-
destroy(): void;
|
|
124
93
|
};
|
|
125
94
|
authState: {
|
|
126
|
-
creds: import("../Types
|
|
127
|
-
keys: import("../Types
|
|
95
|
+
creds: import("../Types").AuthenticationCreds;
|
|
96
|
+
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
128
97
|
};
|
|
129
|
-
signalRepository: import("../Types
|
|
130
|
-
user: import("../Types
|
|
98
|
+
signalRepository: import("../Types").SignalRepository;
|
|
99
|
+
user: import("../Types").Contact | undefined;
|
|
131
100
|
generateMessageTag: () => string;
|
|
132
|
-
query: (node: BinaryNode, timeoutMs?: number) => Promise<
|
|
133
|
-
waitForMessage: <
|
|
101
|
+
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
|
|
102
|
+
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
|
134
103
|
waitForSocketOpen: () => Promise<void>;
|
|
135
104
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
136
105
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
137
|
-
logout: (msg?: string) => Promise<void>;
|
|
138
|
-
end: (error: Error | undefined) =>
|
|
139
|
-
|
|
140
|
-
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
106
|
+
logout: (msg?: string | undefined) => Promise<void>;
|
|
107
|
+
end: (error: Error | undefined) => void;
|
|
108
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
141
109
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
142
110
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
updateServerTimeOffset: ({ attrs }: BinaryNode) => void;
|
|
147
|
-
sendUnifiedSession: () => Promise<void>;
|
|
148
|
-
wamBuffer: import("../index.js").BinaryInfo;
|
|
149
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types/index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
150
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
151
|
-
executeUSyncQuery: (usyncQuery: import("../index.js").USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
|
|
152
|
-
onWhatsApp: (...phoneNumber: string[]) => Promise<{
|
|
153
|
-
jid: string;
|
|
154
|
-
exists: boolean;
|
|
155
|
-
}[] | undefined>;
|
|
156
|
-
fetchAccountReachoutTimelock: () => Promise<import("../Types/index.js").ReachoutTimelockState>;
|
|
157
|
-
fetchNewChatMessageCap: () => Promise<import("../Types/index.js").NewChatMessageCapInfo>;
|
|
111
|
+
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
112
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
113
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
158
114
|
};
|
|
159
115
|
export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
|
|
160
|
-
export type GroupsSocket = ReturnType<typeof makeGroupsSocket>;
|
|
161
|
-
//# sourceMappingURL=groups.d.ts.map
|
package/lib/Socket/groups.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractGroupMetadata = exports.makeGroupsSocket = void 0;
|
|
4
|
+
const WAProto_1 = require("../../WAProto");
|
|
5
|
+
const Types_1 = require("../Types");
|
|
6
|
+
const Utils_1 = require("../Utils");
|
|
7
|
+
const WABinary_1 = require("../WABinary");
|
|
8
|
+
const chats_1 = require("./chats");
|
|
9
|
+
const makeGroupsSocket = (config) => {
|
|
10
|
+
const sock = (0, chats_1.makeChatsSocket)(config);
|
|
9
11
|
const { authState, ev, query, upsertMessage } = sock;
|
|
10
|
-
const groupQuery = async (jid, type, content) => query({
|
|
12
|
+
const groupQuery = async (jid, type, content) => (query({
|
|
11
13
|
tag: 'iq',
|
|
12
14
|
attrs: {
|
|
13
15
|
type,
|
|
14
16
|
xmlns: 'w:g2',
|
|
15
|
-
to: jid
|
|
17
|
+
to: jid,
|
|
16
18
|
},
|
|
17
19
|
content
|
|
18
|
-
});
|
|
20
|
+
}));
|
|
19
21
|
const groupMetadata = async (jid) => {
|
|
20
22
|
const result = await groupQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
|
|
21
|
-
return extractGroupMetadata(result);
|
|
23
|
+
return (0, exports.extractGroupMetadata)(result);
|
|
22
24
|
};
|
|
23
25
|
const groupFetchAllParticipating = async () => {
|
|
24
26
|
const result = await query({
|
|
@@ -26,7 +28,7 @@ export const makeGroupsSocket = (config) => {
|
|
|
26
28
|
attrs: {
|
|
27
29
|
to: '@g.us',
|
|
28
30
|
xmlns: 'w:g2',
|
|
29
|
-
type: 'get'
|
|
31
|
+
type: 'get',
|
|
30
32
|
},
|
|
31
33
|
content: [
|
|
32
34
|
{
|
|
@@ -40,11 +42,11 @@ export const makeGroupsSocket = (config) => {
|
|
|
40
42
|
]
|
|
41
43
|
});
|
|
42
44
|
const data = {};
|
|
43
|
-
const groupsChild = getBinaryNodeChild(result, 'groups');
|
|
45
|
+
const groupsChild = (0, WABinary_1.getBinaryNodeChild)(result, 'groups');
|
|
44
46
|
if (groupsChild) {
|
|
45
|
-
const groups = getBinaryNodeChildren(groupsChild, 'group');
|
|
47
|
+
const groups = (0, WABinary_1.getBinaryNodeChildren)(groupsChild, 'group');
|
|
46
48
|
for (const groupNode of groups) {
|
|
47
|
-
const meta = extractGroupMetadata({
|
|
49
|
+
const meta = (0, exports.extractGroupMetadata)({
|
|
48
50
|
tag: 'result',
|
|
49
51
|
attrs: {},
|
|
50
52
|
content: [groupNode]
|
|
@@ -52,12 +54,11 @@ export const makeGroupsSocket = (config) => {
|
|
|
52
54
|
data[meta.id] = meta;
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
|
-
// TODO: properly parse LID / PN DATA
|
|
56
57
|
sock.ev.emit('groups.update', Object.values(data));
|
|
57
58
|
return data;
|
|
58
59
|
};
|
|
59
60
|
sock.ws.on('CB:ib,,dirty', async (node) => {
|
|
60
|
-
const { attrs } = getBinaryNodeChild(node, 'dirty');
|
|
61
|
+
const { attrs } = (0, WABinary_1.getBinaryNodeChild)(node, 'dirty');
|
|
61
62
|
if (attrs.type !== 'groups') {
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
@@ -66,9 +67,10 @@ export const makeGroupsSocket = (config) => {
|
|
|
66
67
|
});
|
|
67
68
|
return {
|
|
68
69
|
...sock,
|
|
70
|
+
groupQuery,
|
|
69
71
|
groupMetadata,
|
|
70
72
|
groupCreate: async (subject, participants) => {
|
|
71
|
-
const key =
|
|
73
|
+
const key = await config.generateMessageID() ?? (0, Utils_1.generateMessageID)();
|
|
72
74
|
const result = await groupQuery('@g.us', 'set', [
|
|
73
75
|
{
|
|
74
76
|
tag: 'create',
|
|
@@ -82,14 +84,16 @@ export const makeGroupsSocket = (config) => {
|
|
|
82
84
|
}))
|
|
83
85
|
}
|
|
84
86
|
]);
|
|
85
|
-
return extractGroupMetadata(result);
|
|
87
|
+
return (0, exports.extractGroupMetadata)(result);
|
|
86
88
|
},
|
|
87
89
|
groupLeave: async (id) => {
|
|
88
90
|
await groupQuery('@g.us', 'set', [
|
|
89
91
|
{
|
|
90
92
|
tag: 'leave',
|
|
91
93
|
attrs: {},
|
|
92
|
-
content: [
|
|
94
|
+
content: [
|
|
95
|
+
{ tag: 'group', attrs: { id } }
|
|
96
|
+
]
|
|
93
97
|
}
|
|
94
98
|
]);
|
|
95
99
|
},
|
|
@@ -109,13 +113,12 @@ export const makeGroupsSocket = (config) => {
|
|
|
109
113
|
attrs: {}
|
|
110
114
|
}
|
|
111
115
|
]);
|
|
112
|
-
const node = getBinaryNodeChild(result, 'membership_approval_requests');
|
|
113
|
-
const participants = getBinaryNodeChildren(node, 'membership_approval_request');
|
|
116
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(result, 'membership_approval_requests');
|
|
117
|
+
const participants = (0, WABinary_1.getBinaryNodeChildren)(node, 'membership_approval_request');
|
|
114
118
|
return participants.map(v => v.attrs);
|
|
115
119
|
},
|
|
116
120
|
groupRequestParticipantsUpdate: async (jid, participants, action) => {
|
|
117
|
-
const result = await groupQuery(jid, 'set', [
|
|
118
|
-
{
|
|
121
|
+
const result = await groupQuery(jid, 'set', [{
|
|
119
122
|
tag: 'membership_requests_action',
|
|
120
123
|
attrs: {},
|
|
121
124
|
content: [
|
|
@@ -128,11 +131,10 @@ export const makeGroupsSocket = (config) => {
|
|
|
128
131
|
}))
|
|
129
132
|
}
|
|
130
133
|
]
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const participantsAffected = getBinaryNodeChildren(nodeAction, 'participant');
|
|
134
|
+
}]);
|
|
135
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(result, 'membership_requests_action');
|
|
136
|
+
const nodeAction = (0, WABinary_1.getBinaryNodeChild)(node, action);
|
|
137
|
+
const participantsAffected = (0, WABinary_1.getBinaryNodeChildren)(nodeAction, 'participant');
|
|
136
138
|
return participantsAffected.map(p => {
|
|
137
139
|
return { status: p.attrs.error || '200', jid: p.attrs.jid };
|
|
138
140
|
});
|
|
@@ -148,40 +150,43 @@ export const makeGroupsSocket = (config) => {
|
|
|
148
150
|
}))
|
|
149
151
|
}
|
|
150
152
|
]);
|
|
151
|
-
const node = getBinaryNodeChild(result, action);
|
|
152
|
-
const participantsAffected = getBinaryNodeChildren(node, 'participant');
|
|
153
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(result, action);
|
|
154
|
+
const participantsAffected = (0, WABinary_1.getBinaryNodeChildren)(node, 'participant');
|
|
153
155
|
return participantsAffected.map(p => {
|
|
154
156
|
return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p };
|
|
155
157
|
});
|
|
156
158
|
},
|
|
157
159
|
groupUpdateDescription: async (jid, description) => {
|
|
160
|
+
var _a;
|
|
158
161
|
const metadata = await groupMetadata(jid);
|
|
159
|
-
const prev = metadata.descId
|
|
162
|
+
const prev = (_a = metadata.descId) !== null && _a !== void 0 ? _a : null;
|
|
160
163
|
await groupQuery(jid, 'set', [
|
|
161
164
|
{
|
|
162
165
|
tag: 'description',
|
|
163
166
|
attrs: {
|
|
164
|
-
...(description ? { id:
|
|
167
|
+
...(description ? { id: await config.generateMessageID() ?? (0, Utils_1.generateMessageID)() } : { delete: 'true' }),
|
|
165
168
|
...(prev ? { prev } : {})
|
|
166
169
|
},
|
|
167
|
-
content: description ? [
|
|
170
|
+
content: description ? [
|
|
171
|
+
{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }
|
|
172
|
+
] : undefined
|
|
168
173
|
}
|
|
169
174
|
]);
|
|
170
175
|
},
|
|
171
176
|
groupInviteCode: async (jid) => {
|
|
172
177
|
const result = await groupQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]);
|
|
173
|
-
const inviteNode = getBinaryNodeChild(result, 'invite');
|
|
174
|
-
return inviteNode
|
|
178
|
+
const inviteNode = (0, WABinary_1.getBinaryNodeChild)(result, 'invite');
|
|
179
|
+
return inviteNode === null || inviteNode === void 0 ? void 0 : inviteNode.attrs.code;
|
|
175
180
|
},
|
|
176
181
|
groupRevokeInvite: async (jid) => {
|
|
177
182
|
const result = await groupQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]);
|
|
178
|
-
const inviteNode = getBinaryNodeChild(result, 'invite');
|
|
179
|
-
return inviteNode
|
|
183
|
+
const inviteNode = (0, WABinary_1.getBinaryNodeChild)(result, 'invite');
|
|
184
|
+
return inviteNode === null || inviteNode === void 0 ? void 0 : inviteNode.attrs.code;
|
|
180
185
|
},
|
|
181
186
|
groupAcceptInvite: async (code) => {
|
|
182
187
|
const results = await groupQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]);
|
|
183
|
-
const result = getBinaryNodeChild(results, 'group');
|
|
184
|
-
return result
|
|
188
|
+
const result = (0, WABinary_1.getBinaryNodeChild)(results, 'group');
|
|
189
|
+
return result === null || result === void 0 ? void 0 : result.attrs.jid;
|
|
185
190
|
},
|
|
186
191
|
/**
|
|
187
192
|
* revoke a v4 invite for someone
|
|
@@ -190,9 +195,7 @@ export const makeGroupsSocket = (config) => {
|
|
|
190
195
|
* @returns true if successful
|
|
191
196
|
*/
|
|
192
197
|
groupRevokeInviteV4: async (groupJid, invitedJid) => {
|
|
193
|
-
const result = await groupQuery(groupJid, 'set', [
|
|
194
|
-
{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }
|
|
195
|
-
]);
|
|
198
|
+
const result = await groupQuery(groupJid, 'set', [{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }]);
|
|
196
199
|
return !!result;
|
|
197
200
|
},
|
|
198
201
|
/**
|
|
@@ -201,22 +204,21 @@ export const makeGroupsSocket = (config) => {
|
|
|
201
204
|
* @param inviteMessage the message to accept
|
|
202
205
|
*/
|
|
203
206
|
groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
|
|
207
|
+
var _a;
|
|
204
208
|
key = typeof key === 'string' ? { remoteJid: key } : key;
|
|
205
|
-
const results = await groupQuery(inviteMessage.groupJid, 'set', [
|
|
206
|
-
{
|
|
209
|
+
const results = await groupQuery(inviteMessage.groupJid, 'set', [{
|
|
207
210
|
tag: 'accept',
|
|
208
211
|
attrs: {
|
|
209
212
|
code: inviteMessage.inviteCode,
|
|
210
213
|
expiration: inviteMessage.inviteExpiration.toString(),
|
|
211
214
|
admin: key.remoteJid
|
|
212
215
|
}
|
|
213
|
-
}
|
|
214
|
-
]);
|
|
216
|
+
}]);
|
|
215
217
|
// if we have the full message key
|
|
216
218
|
// update the invite message to be expired
|
|
217
219
|
if (key.id) {
|
|
218
220
|
// create new invite message that is expired
|
|
219
|
-
inviteMessage = proto.Message.GroupInviteMessage.fromObject(inviteMessage);
|
|
221
|
+
inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage);
|
|
220
222
|
inviteMessage.inviteExpiration = 0;
|
|
221
223
|
inviteMessage.inviteCode = '';
|
|
222
224
|
ev.emit('messages.update', [
|
|
@@ -234,25 +236,27 @@ export const makeGroupsSocket = (config) => {
|
|
|
234
236
|
await upsertMessage({
|
|
235
237
|
key: {
|
|
236
238
|
remoteJid: inviteMessage.groupJid,
|
|
237
|
-
id: generateMessageIDV2(sock.user
|
|
239
|
+
id: await config.generateMessageIDV2((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id) ?? (0, Utils_1.generateMessageIDV2)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id),
|
|
238
240
|
fromMe: false,
|
|
239
|
-
participant: key.remoteJid
|
|
241
|
+
participant: key.remoteJid,
|
|
240
242
|
},
|
|
241
|
-
messageStubType: WAMessageStubType.GROUP_PARTICIPANT_ADD,
|
|
242
|
-
messageStubParameters: [
|
|
243
|
+
messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
|
|
244
|
+
messageStubParameters: [
|
|
245
|
+
authState.creds.me.id
|
|
246
|
+
],
|
|
243
247
|
participant: key.remoteJid,
|
|
244
|
-
messageTimestamp: unixTimestampSeconds()
|
|
248
|
+
messageTimestamp: (0, Utils_1.unixTimestampSeconds)()
|
|
245
249
|
}, 'notify');
|
|
246
250
|
return results.attrs.from;
|
|
247
251
|
}),
|
|
248
252
|
groupGetInviteInfo: async (code) => {
|
|
249
253
|
const results = await groupQuery('@g.us', 'get', [{ tag: 'invite', attrs: { code } }]);
|
|
250
|
-
return extractGroupMetadata(results);
|
|
254
|
+
return (0, exports.extractGroupMetadata)(results);
|
|
251
255
|
},
|
|
252
256
|
groupToggleEphemeral: async (jid, ephemeralExpiration) => {
|
|
253
|
-
const content = ephemeralExpiration
|
|
254
|
-
|
|
255
|
-
|
|
257
|
+
const content = ephemeralExpiration ?
|
|
258
|
+
{ tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } } :
|
|
259
|
+
{ tag: 'not_ephemeral', attrs: {} };
|
|
256
260
|
await groupQuery(jid, 'set', [content]);
|
|
257
261
|
},
|
|
258
262
|
groupSettingUpdate: async (jid, setting) => {
|
|
@@ -262,86 +266,50 @@ export const makeGroupsSocket = (config) => {
|
|
|
262
266
|
await groupQuery(jid, 'set', [{ tag: 'member_add_mode', attrs: {}, content: mode }]);
|
|
263
267
|
},
|
|
264
268
|
groupJoinApprovalMode: async (jid, mode) => {
|
|
265
|
-
await groupQuery(jid, 'set', [
|
|
266
|
-
{ tag: 'membership_approval_mode', attrs: {}, content: [{ tag: 'group_join', attrs: { state: mode } }] }
|
|
267
|
-
]);
|
|
269
|
+
await groupQuery(jid, 'set', [{ tag: 'membership_approval_mode', attrs: {}, content: [{ tag: 'group_join', attrs: { state: mode } }] }]);
|
|
268
270
|
},
|
|
269
271
|
groupFetchAllParticipating
|
|
270
272
|
};
|
|
271
273
|
};
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (errorNode) {
|
|
278
|
-
const code = errorNode.attrs.code ? +errorNode.attrs.code : 500;
|
|
279
|
-
const text = errorNode.attrs.text || 'group metadata query failed';
|
|
280
|
-
throw new Boom(text, { statusCode: code, data: errorNode });
|
|
281
|
-
}
|
|
282
|
-
throw new Boom('Invalid group metadata response: missing <group> node', { data: result });
|
|
283
|
-
}
|
|
284
|
-
if (!group.attrs.id) {
|
|
285
|
-
throw new Boom('Invalid group metadata response: missing group id', { data: group });
|
|
286
|
-
}
|
|
287
|
-
const descChild = getBinaryNodeChild(group, 'description');
|
|
274
|
+
exports.makeGroupsSocket = makeGroupsSocket;
|
|
275
|
+
const extractGroupMetadata = (result) => {
|
|
276
|
+
var _a, _b;
|
|
277
|
+
const group = (0, WABinary_1.getBinaryNodeChild)(result, 'group');
|
|
278
|
+
const descChild = (0, WABinary_1.getBinaryNodeChild)(group, 'description');
|
|
288
279
|
let desc;
|
|
289
280
|
let descId;
|
|
290
|
-
let descOwner;
|
|
291
|
-
let descOwnerPn;
|
|
292
|
-
let descOwnerUsername;
|
|
293
|
-
let descTime;
|
|
294
281
|
if (descChild) {
|
|
295
|
-
desc = getBinaryNodeChildString(descChild, 'body');
|
|
296
|
-
descOwner = descChild.attrs.participant ? jidNormalizedUser(descChild.attrs.participant) : undefined;
|
|
297
|
-
descOwnerPn = descChild.attrs.participant_pn ? jidNormalizedUser(descChild.attrs.participant_pn) : undefined;
|
|
298
|
-
descOwnerUsername = descChild.attrs.participant_username || undefined;
|
|
299
|
-
descTime = +descChild.attrs.t;
|
|
282
|
+
desc = (0, WABinary_1.getBinaryNodeChildString)(descChild, 'body');
|
|
300
283
|
descId = descChild.attrs.id;
|
|
301
284
|
}
|
|
302
|
-
const groupId = group.attrs.id.includes('@') ? group.attrs.id : jidEncode(group.attrs.id, 'g.us');
|
|
303
|
-
const eph = getBinaryNodeChild(group, 'ephemeral')
|
|
304
|
-
const memberAddMode = getBinaryNodeChildString(group, 'member_add_mode') === 'all_member_add';
|
|
285
|
+
const groupId = group.attrs.id.includes('@') ? group.attrs.id : (0, WABinary_1.jidEncode)(group.attrs.id, 'g.us');
|
|
286
|
+
const eph = (_a = (0, WABinary_1.getBinaryNodeChild)(group, 'ephemeral')) === null || _a === void 0 ? void 0 : _a.attrs.expiration;
|
|
287
|
+
const memberAddMode = (0, WABinary_1.getBinaryNodeChildString)(group, 'member_add_mode') === 'all_member_add';
|
|
305
288
|
const metadata = {
|
|
306
289
|
id: groupId,
|
|
307
|
-
notify: group.attrs.notify,
|
|
308
|
-
addressingMode: group.attrs.addressing_mode === 'lid' ? WAMessageAddressingMode.LID : WAMessageAddressingMode.PN,
|
|
309
290
|
subject: group.attrs.subject,
|
|
310
291
|
subjectOwner: group.attrs.s_o,
|
|
311
|
-
subjectOwnerPn: group.attrs.s_o_pn,
|
|
312
|
-
subjectOwnerUsername: group.attrs.s_o_username,
|
|
313
292
|
subjectTime: +group.attrs.s_t,
|
|
314
|
-
size:
|
|
293
|
+
size: (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').length,
|
|
315
294
|
creation: +group.attrs.creation,
|
|
316
|
-
owner: group.attrs.creator ? jidNormalizedUser(group.attrs.creator) : undefined,
|
|
317
|
-
ownerPn: group.attrs.creator_pn ? jidNormalizedUser(group.attrs.creator_pn) : undefined,
|
|
318
|
-
ownerUsername: group.attrs.creator_username || undefined,
|
|
319
|
-
owner_country_code: group.attrs.creator_country_code,
|
|
295
|
+
owner: group.attrs.creator ? (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) : undefined,
|
|
320
296
|
desc,
|
|
321
297
|
descId,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
announce: !!getBinaryNodeChild(group, 'announcement'),
|
|
329
|
-
isCommunity: !!getBinaryNodeChild(group, 'parent'),
|
|
330
|
-
isCommunityAnnounce: !!getBinaryNodeChild(group, 'default_sub_group'),
|
|
331
|
-
joinApprovalMode: !!getBinaryNodeChild(group, 'membership_approval_mode'),
|
|
298
|
+
linkedParent: ((_b = (0, WABinary_1.getBinaryNodeChild)(group, 'linked_parent')) === null || _b === void 0 ? void 0 : _b.attrs.jid) || undefined,
|
|
299
|
+
restrict: !!(0, WABinary_1.getBinaryNodeChild)(group, 'locked'),
|
|
300
|
+
announce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'announcement'),
|
|
301
|
+
isCommunity: !!(0, WABinary_1.getBinaryNodeChild)(group, 'parent'),
|
|
302
|
+
isCommunityAnnounce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'default_sub_group'),
|
|
303
|
+
joinApprovalMode: !!(0, WABinary_1.getBinaryNodeChild)(group, 'membership_approval_mode'),
|
|
332
304
|
memberAddMode,
|
|
333
|
-
participants: getBinaryNodeChildren(group, 'participant').map(({ attrs }) => {
|
|
334
|
-
// TODO: Store LID MAPPINGS
|
|
305
|
+
participants: (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').map(({ attrs }) => {
|
|
335
306
|
return {
|
|
336
|
-
id: attrs.jid,
|
|
337
|
-
|
|
338
|
-
lid: isPnUser(attrs.jid) && isLidUser(attrs.lid) ? attrs.lid : undefined,
|
|
339
|
-
username: attrs.participant_username || attrs.username || undefined,
|
|
340
|
-
admin: (attrs.type || null)
|
|
307
|
+
id: attrs.phone_number ?? attrs.jid,
|
|
308
|
+
admin: (attrs.type || null),
|
|
341
309
|
};
|
|
342
310
|
}),
|
|
343
311
|
ephemeralDuration: eph ? +eph : undefined
|
|
344
312
|
};
|
|
345
313
|
return metadata;
|
|
346
314
|
};
|
|
347
|
-
|
|
315
|
+
exports.extractGroupMetadata = extractGroupMetadata;
|