phantom-baileys 0.0.9 → 0.1.3
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/LICENSE +21 -0
- package/README.md +592 -0
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +5479 -0
- package/WAProto/fix-imports.js +81 -0
- package/WAProto/index.d.ts +5147 -41513
- package/WAProto/index.js +84008 -142014
- package/lib/Defaults/index.d.ts +29 -8
- package/lib/Defaults/index.d.ts.map +1 -0
- package/lib/Defaults/index.js +80 -60
- package/lib/Defaults/index.js.map +1 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/ciphertext-message.js.map +1 -0
- package/lib/Signal/Group/group-session-builder.d.ts +15 -0
- package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group-session-builder.js.map +1 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -0
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.d.ts.map +1 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/index.js.map +1 -0
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/keyhelper.js.map +1 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-chain-key.js.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-name.js.map +1 -0
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-record.js.map +1 -0
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-key-state.js.map +1 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
- package/{WASignalGroup/sender_message_key.js → lib/Signal/Group/sender-message-key.js} +3 -16
- package/lib/Signal/Group/sender-message-key.js.map +1 -0
- package/lib/Signal/libsignal.d.ts +5 -3
- package/lib/Signal/libsignal.d.ts.map +1 -0
- package/lib/Signal/libsignal.js +331 -80
- package/lib/Signal/libsignal.js.map +1 -0
- package/lib/Signal/lid-mapping.d.ts +19 -0
- package/lib/Signal/lid-mapping.d.ts.map +1 -0
- package/lib/Signal/lid-mapping.js +271 -0
- package/lib/Signal/lid-mapping.js.map +1 -0
- package/lib/Socket/Client/index.d.ts +3 -3
- package/lib/Socket/Client/index.d.ts.map +1 -0
- package/lib/Socket/Client/index.js +3 -19
- package/lib/Socket/Client/index.js.map +1 -0
- package/lib/Socket/Client/{abstract-socket-client.d.ts → types.d.ts} +4 -5
- package/lib/Socket/Client/types.d.ts.map +1 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/types.js.map +1 -0
- package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +3 -2
- package/lib/Socket/Client/websocket.d.ts.map +1 -0
- package/lib/Socket/Client/websocket.js +54 -0
- package/lib/Socket/Client/websocket.js.map +1 -0
- package/lib/Socket/business.d.ts +184 -101
- package/lib/Socket/business.d.ts.map +1 -0
- package/lib/Socket/business.js +162 -43
- package/lib/Socket/business.js.map +1 -0
- package/lib/Socket/chats.d.ts +72 -42
- package/lib/Socket/chats.d.ts.map +1 -0
- package/lib/Socket/chats.js +340 -299
- package/lib/Socket/chats.js.map +1 -0
- package/lib/Socket/communities.d.ts +309 -0
- package/lib/Socket/communities.d.ts.map +1 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/communities.js.map +1 -0
- package/lib/Socket/dugong.d.ts +79 -0
- package/lib/Socket/dugong.d.ts.map +1 -0
- package/lib/Socket/dugong.js +527 -0
- package/lib/Socket/dugong.js.map +1 -0
- package/lib/Socket/groups.d.ts +93 -58
- package/lib/Socket/groups.d.ts.map +1 -0
- package/lib/Socket/groups.js +96 -84
- package/lib/Socket/groups.js.map +1 -0
- package/lib/Socket/index.d.ts +232 -107
- package/lib/Socket/index.d.ts.map +1 -0
- package/lib/Socket/index.js +13 -10
- package/lib/Socket/index.js.map +1 -0
- package/lib/Socket/messages-recv.d.ts +170 -90
- package/lib/Socket/messages-recv.d.ts.map +1 -0
- package/lib/Socket/messages-recv.js +798 -462
- package/lib/Socket/messages-recv.js.map +1 -0
- package/lib/Socket/messages-send.d.ts +180 -99
- package/lib/Socket/messages-send.d.ts.map +1 -0
- package/lib/Socket/messages-send.js +833 -709
- package/lib/Socket/messages-send.js.map +1 -0
- package/lib/Socket/mex.d.ts +3 -0
- package/lib/Socket/mex.d.ts.map +1 -0
- package/lib/Socket/mex.js +42 -0
- package/lib/Socket/mex.js.map +1 -0
- package/lib/Socket/newsletter.d.ts +120 -75
- package/lib/Socket/newsletter.d.ts.map +1 -0
- package/lib/Socket/newsletter.js +227 -198
- package/lib/Socket/newsletter.js.map +1 -0
- package/lib/Socket/socket.d.ts +31 -20
- package/lib/Socket/socket.d.ts.map +1 -0
- package/lib/Socket/socket.js +508 -215
- package/lib/Socket/socket.js.map +1 -0
- package/lib/Types/Auth.d.ts +18 -11
- package/lib/Types/Auth.d.ts.map +1 -0
- package/lib/Types/Auth.js +2 -2
- package/lib/Types/Auth.js.map +1 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.d.ts.map +1 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Bussines.js.map +1 -0
- package/lib/Types/Call.d.ts +2 -0
- package/lib/Types/Call.d.ts.map +1 -0
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Call.js.map +1 -0
- package/lib/Types/Chat.d.ts +24 -8
- package/lib/Types/Chat.d.ts.map +1 -0
- package/lib/Types/Chat.js +8 -4
- package/lib/Types/Chat.js.map +1 -0
- package/lib/Types/Contact.d.ts +6 -1
- package/lib/Types/Contact.d.ts.map +1 -0
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Contact.js.map +1 -0
- package/lib/Types/Events.d.ts +82 -17
- package/lib/Types/Events.d.ts.map +1 -0
- package/lib/Types/Events.js +2 -2
- package/lib/Types/Events.js.map +1 -0
- package/lib/Types/GroupMetadata.d.ts +15 -3
- package/lib/Types/GroupMetadata.d.ts.map +1 -0
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/GroupMetadata.js.map +1 -0
- package/lib/Types/Label.d.ts +1 -0
- package/lib/Types/Label.d.ts.map +1 -0
- package/lib/Types/Label.js +3 -5
- package/lib/Types/Label.js.map +1 -0
- package/lib/Types/LabelAssociation.d.ts +1 -0
- package/lib/Types/LabelAssociation.d.ts.map +1 -0
- package/lib/Types/LabelAssociation.js +3 -5
- package/lib/Types/LabelAssociation.js.map +1 -0
- package/lib/Types/Message.d.ts +77 -202
- package/lib/Types/Message.d.ts.map +1 -0
- package/lib/Types/Message.js +11 -9
- package/lib/Types/Message.js.map +1 -0
- package/lib/Types/Newsletter.d.ts +128 -85
- package/lib/Types/Newsletter.d.ts.map +1 -0
- package/lib/Types/Newsletter.js +25 -26
- package/lib/Types/Newsletter.js.map +1 -0
- package/lib/Types/Product.d.ts +2 -1
- package/lib/Types/Product.d.ts.map +1 -0
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Product.js.map +1 -0
- package/lib/Types/Signal.d.ts +20 -1
- package/lib/Types/Signal.d.ts.map +1 -0
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Signal.js.map +1 -0
- package/lib/Types/Socket.d.ts +41 -24
- package/lib/Types/Socket.d.ts.map +1 -0
- package/lib/Types/Socket.js +3 -2
- package/lib/Types/Socket.js.map +1 -0
- package/lib/Types/State.d.ts +14 -2
- package/lib/Types/State.d.ts.map +1 -0
- package/lib/Types/State.js +13 -2
- package/lib/Types/State.js.map +1 -0
- package/lib/Types/USync.d.ts +3 -2
- package/lib/Types/USync.d.ts.map +1 -0
- package/lib/Types/USync.js +2 -2
- package/lib/Types/USync.js.map +1 -0
- package/lib/Types/index.d.ts +15 -16
- package/lib/Types/index.d.ts.map +1 -0
- package/lib/Types/index.js +15 -31
- package/lib/Types/index.js.map +1 -0
- package/lib/Utils/auth-utils.d.ts +7 -6
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +228 -165
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/browser-utils.js.map +1 -0
- package/lib/Utils/business.d.ts +4 -3
- package/lib/Utils/business.d.ts.map +1 -0
- package/lib/Utils/business.js +66 -69
- package/lib/Utils/business.js.map +1 -0
- package/lib/Utils/chat-utils.d.ts +16 -16
- package/lib/Utils/chat-utils.d.ts.map +1 -0
- package/lib/Utils/chat-utils.js +299 -232
- package/lib/Utils/chat-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +18 -21
- package/lib/Utils/crypto.d.ts.map +1 -0
- package/lib/Utils/crypto.js +44 -125
- package/lib/Utils/crypto.js.map +1 -0
- package/lib/Utils/decode-wa-message.d.ts +20 -8
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +139 -90
- package/lib/Utils/decode-wa-message.js.map +1 -0
- package/lib/Utils/event-buffer.d.ts +7 -8
- package/lib/Utils/event-buffer.d.ts.map +1 -0
- package/lib/Utils/event-buffer.js +129 -72
- package/lib/Utils/event-buffer.js.map +1 -0
- package/lib/Utils/generics.d.ts +25 -22
- package/lib/Utils/generics.d.ts.map +1 -0
- package/lib/Utils/generics.js +157 -175
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/history.d.ts +14 -11
- package/lib/Utils/history.d.ts.map +1 -0
- package/lib/Utils/history.js +83 -46
- package/lib/Utils/history.js.map +1 -0
- package/lib/Utils/identity-change-handler.d.ts +37 -0
- package/lib/Utils/identity-change-handler.d.ts.map +1 -0
- package/lib/Utils/identity-change-handler.js +49 -0
- package/lib/Utils/identity-change-handler.js.map +1 -0
- package/lib/Utils/index.d.ts +22 -17
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +22 -33
- package/lib/Utils/index.js.map +1 -0
- package/lib/Utils/link-preview.d.ts +5 -5
- package/lib/Utils/link-preview.d.ts.map +1 -0
- package/lib/Utils/link-preview.js +14 -22
- package/lib/Utils/link-preview.js.map +1 -0
- package/lib/Utils/logger.d.ts +12 -1
- package/lib/Utils/logger.d.ts.map +1 -0
- package/lib/Utils/logger.js +3 -7
- package/lib/Utils/logger.js.map +1 -0
- package/lib/Utils/lt-hash.d.ts +8 -12
- package/lib/Utils/lt-hash.d.ts.map +1 -0
- package/lib/Utils/lt-hash.js +3 -46
- package/lib/Utils/lt-hash.js.map +1 -0
- package/lib/Utils/make-mutex.d.ts +2 -0
- package/lib/Utils/make-mutex.d.ts.map +1 -0
- package/lib/Utils/make-mutex.js +24 -34
- package/lib/Utils/make-mutex.js.map +1 -0
- package/lib/Utils/message-retry-manager.d.ts +110 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -0
- package/lib/Utils/message-retry-manager.js +225 -0
- package/lib/Utils/message-retry-manager.js.map +1 -0
- package/lib/Utils/messages-media.d.ts +59 -42
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +411 -356
- package/lib/Utils/messages-media.js.map +1 -0
- package/lib/Utils/messages.d.ts +32 -18
- package/lib/Utils/messages.d.ts.map +1 -0
- package/lib/Utils/messages.js +412 -723
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/noise-handler.d.ts +13 -13
- package/lib/Utils/noise-handler.d.ts.map +1 -0
- package/lib/Utils/noise-handler.js +149 -108
- package/lib/Utils/noise-handler.js.map +1 -0
- package/lib/Utils/offline-node-processor.d.ts +17 -0
- package/lib/Utils/offline-node-processor.d.ts.map +1 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/offline-node-processor.js.map +1 -0
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.d.ts.map +1 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/pre-key-manager.js.map +1 -0
- package/lib/Utils/process-message.d.ts +30 -11
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +321 -166
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/reporting-utils.d.ts +11 -0
- package/lib/Utils/reporting-utils.d.ts.map +1 -0
- package/lib/Utils/reporting-utils.js +258 -0
- package/lib/Utils/reporting-utils.js.map +1 -0
- package/lib/Utils/rich-messages.d.ts +129 -0
- package/lib/Utils/rich-messages.d.ts.map +1 -0
- package/lib/Utils/rich-messages.js +455 -0
- package/lib/Utils/rich-messages.js.map +1 -0
- package/lib/Utils/signal.d.ts +7 -6
- package/lib/Utils/signal.d.ts.map +1 -0
- package/lib/Utils/signal.js +65 -65
- package/lib/Utils/signal.js.map +1 -0
- package/lib/Utils/stanza-ack.d.ts +11 -0
- package/lib/Utils/stanza-ack.d.ts.map +1 -0
- package/lib/Utils/stanza-ack.js +38 -0
- package/lib/Utils/stanza-ack.js.map +1 -0
- package/lib/Utils/sync-action-utils.d.ts +19 -0
- package/lib/Utils/sync-action-utils.d.ts.map +1 -0
- package/lib/Utils/sync-action-utils.js +48 -0
- package/lib/Utils/sync-action-utils.js.map +1 -0
- package/lib/Utils/tc-token-utils.d.ts +12 -0
- package/lib/Utils/tc-token-utils.d.ts.map +1 -0
- package/lib/Utils/tc-token-utils.js +18 -0
- package/lib/Utils/tc-token-utils.js.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +2 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +79 -253
- package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
- package/lib/Utils/validate-connection.d.ts +6 -6
- package/lib/Utils/validate-connection.d.ts.map +1 -0
- package/lib/Utils/validate-connection.js +111 -116
- package/lib/Utils/validate-connection.js.map +1 -0
- package/lib/WABinary/constants.d.ts +5 -4
- package/lib/WABinary/constants.d.ts.map +1 -0
- package/lib/WABinary/constants.js +1281 -20
- package/lib/WABinary/constants.js.map +1 -0
- package/lib/WABinary/decode.d.ts +4 -3
- package/lib/WABinary/decode.d.ts.map +1 -0
- package/lib/WABinary/decode.js +51 -53
- package/lib/WABinary/decode.js.map +1 -0
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.d.ts.map +1 -0
- package/lib/WABinary/encode.js +12 -44
- package/lib/WABinary/encode.js.map +1 -0
- package/lib/WABinary/generic-utils.d.ts +9 -6
- package/lib/WABinary/generic-utils.d.ts.map +1 -0
- package/lib/WABinary/generic-utils.js +124 -43
- package/lib/WABinary/generic-utils.js.map +1 -0
- package/lib/WABinary/index.d.ts +6 -5
- package/lib/WABinary/index.d.ts.map +1 -0
- package/lib/WABinary/index.js +6 -21
- package/lib/WABinary/index.js.map +1 -0
- package/lib/WABinary/jid-utils.d.ts +24 -7
- package/lib/WABinary/jid-utils.d.ts.map +1 -0
- package/lib/WABinary/jid-utils.js +74 -40
- package/lib/WABinary/jid-utils.js.map +1 -0
- package/lib/WABinary/types.d.ts +2 -1
- package/lib/WABinary/types.d.ts.map +1 -0
- package/lib/WABinary/types.js +2 -2
- package/lib/WABinary/types.js.map +1 -0
- package/lib/WAM/BinaryInfo.d.ts +2 -1
- package/lib/WAM/BinaryInfo.d.ts.map +1 -0
- package/lib/WAM/BinaryInfo.js +2 -5
- package/lib/WAM/BinaryInfo.js.map +1 -0
- package/lib/WAM/constants.d.ts +5 -3
- package/lib/WAM/constants.d.ts.map +1 -0
- package/lib/WAM/constants.js +19071 -11568
- package/lib/WAM/constants.js.map +1 -0
- package/lib/WAM/encode.d.ts +3 -2
- package/lib/WAM/encode.d.ts.map +1 -0
- package/lib/WAM/encode.js +17 -22
- package/lib/WAM/encode.js.map +1 -0
- package/lib/WAM/index.d.ts +4 -3
- package/lib/WAM/index.d.ts.map +1 -0
- package/lib/WAM/index.js +4 -19
- package/lib/WAM/index.js.map +1 -0
- package/lib/WAProto/fix-imports.d.ts +1 -0
- package/lib/WAProto/fix-imports.js +71 -0
- package/lib/WAProto/index.js +89345 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +4 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +8 -11
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +3 -2
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +11 -14
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +3 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +9 -12
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +3 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +9 -13
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +4 -3
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +20 -22
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +5 -3
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +13 -8
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +5 -4
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +5 -20
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +5 -4
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
- package/lib/WAUSync/USyncQuery.js +40 -35
- package/lib/WAUSync/USyncQuery.js.map +1 -0
- package/lib/WAUSync/USyncUser.d.ts +7 -4
- package/lib/WAUSync/USyncUser.d.ts.map +1 -0
- package/lib/WAUSync/USyncUser.js +2 -5
- package/lib/WAUSync/USyncUser.js.map +1 -0
- package/lib/WAUSync/index.d.ts +4 -3
- package/lib/WAUSync/index.d.ts.map +1 -0
- package/lib/WAUSync/index.js +4 -19
- package/lib/WAUSync/index.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -31
- package/lib/index.js.map +1 -0
- package/package.json +35 -75
- package/Readme.md +0 -1
- package/WASignalGroup/GroupProtocol.js +0 -1697
- package/WASignalGroup/ciphertext_message.js +0 -16
- package/WASignalGroup/group_cipher.js +0 -120
- package/WASignalGroup/group_session_builder.js +0 -46
- package/WASignalGroup/index.js +0 -5
- package/WASignalGroup/keyhelper.js +0 -21
- package/WASignalGroup/protobufs.js +0 -3
- package/WASignalGroup/queue_job.js +0 -69
- package/WASignalGroup/sender_chain_key.js +0 -50
- package/WASignalGroup/sender_key_distribution_message.js +0 -78
- package/WASignalGroup/sender_key_message.js +0 -92
- package/WASignalGroup/sender_key_name.js +0 -70
- package/WASignalGroup/sender_key_record.js +0 -56
- package/WASignalGroup/sender_key_state.js +0 -129
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/web-socket-client.js +0 -62
- package/lib/Socket/registration.d.ts +0 -264
- package/lib/Socket/registration.js +0 -166
- package/lib/Socket/usync.d.ts +0 -37
- package/lib/Socket/usync.js +0 -70
- package/lib/Store/index.d.ts +0 -3
- package/lib/Store/index.js +0 -10
- package/lib/Store/make-cache-manager-store.d.ts +0 -14
- package/lib/Store/make-cache-manager-store.js +0 -83
- package/lib/Store/make-in-memory-store.d.ts +0 -118
- package/lib/Store/make-in-memory-store.js +0 -431
- package/lib/Store/make-ordered-dictionary.d.ts +0 -13
- package/lib/Store/make-ordered-dictionary.js +0 -81
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Store/object-repository.js +0 -27
- package/lib/Utils/baileys-event-stream.d.ts +0 -16
- package/lib/Utils/baileys-event-stream.js +0 -63
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -12
- package/lib/Utils/use-single-file-auth-state.js +0 -75
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
# 🐳 phantom-baileys
|
|
2
|
+
|
|
3
|
+
A Phantom-focused fork of [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys) v7 with additional modifications from the [Ourin-Baileys](https://github.com/LuckyArch/ourin-baileys) lineage. This repo includes deliberate changes for Phantom bot use, such as safer newsletter action handling, removed hidden auto-follow behavior, and custom socket utilities.
|
|
4
|
+
|
|
5
|
+
This package is published to npm for installation convenience and aliasing, but the source repository contains the active customization work.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/phantom-baileys)
|
|
8
|
+
[](https://www.npmjs.com/package/phantom-baileys)
|
|
9
|
+
[](https://github.com/kyleee-max/phantom-baileys)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://nodejs.org)
|
|
12
|
+
[](https://typescriptlang.org)
|
|
13
|
+
[](#)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## What is this fork?
|
|
18
|
+
|
|
19
|
+
| Item | Description |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `phantom-baileys` | Personal fork for Phantom bot features and newsletter utilities |
|
|
22
|
+
| `phantom` | npm alias for easier import in bot projects |
|
|
23
|
+
| `baileys` | Original WhatsApp multi-device library from WhiskeySockets |
|
|
24
|
+
|
|
25
|
+
This repository is intended for private Phantom development. It is not a plain mirror or redistribution — the code includes custom changes for newsletter safety, socket behavior, and interactive message handling.
|
|
26
|
+
|
|
27
|
+
**Copyright notice:** Baileys and its underlying protocol code remain the property of their original authors. This fork is licensed under MIT and includes modifications from the Ourin-Baileys lineage.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
🌾 Deploy fork star /link: [github](https://github.com/what-sapp/Phantom)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## ✨ Features
|
|
36
|
+
|
|
37
|
+
| Feature | Description | Status |
|
|
38
|
+
|---------|-------------|--------|
|
|
39
|
+
| 🎛️ **Interactive Messages** | Native flow buttons, lists, menus | ✅ |
|
|
40
|
+
| 🖼️ **Album Messages** | Multi-image/video album support | ✅ |
|
|
41
|
+
| 🤖 **AI Rich Response** | Table, code block, rich text (Meta AI style) [ **NEW** ] | ✅ |
|
|
42
|
+
| 💻 **Code Block** | Syntax-highlighted code with tokenizer | ✅ |
|
|
43
|
+
| 💳 **Payment Messages** | Request payment with sticker/note | ✅ |
|
|
44
|
+
| 🛍️ **Product Messages** | Product catalog with buttons | ✅ |
|
|
45
|
+
| 📅 **Event Messages** | Event creation with RSVP | ✅ |
|
|
46
|
+
| 📊 **Poll Results** | Poll result snapshot messages | ✅ |
|
|
47
|
+
| 📢 **Newsletter** | bulk follow, cekIDSaluran | ✅ |
|
|
48
|
+
| 🔒 **Biz Node Injection** | Automatic business node for non-BA | ✅ |
|
|
49
|
+
| ⚡ **ESM Native** | Pure ES Module output | ✅ |
|
|
50
|
+
| 📖 **TypeScript** | Full type definitions included | ✅ |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 📦 Installation
|
|
55
|
+
|
|
56
|
+
This package is published to npm for convenience and easier installation, not as a vanilla copy. The source repo contains the actual forked development and unique Phantom bot adaptations.
|
|
57
|
+
|
|
58
|
+
### Install from npm
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install phantom-baileys
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Install with alias
|
|
65
|
+
|
|
66
|
+
In `package.json`:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"phantom": "npm:phantom-baileys@latest"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Then run:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm install
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
> Tip: Use the alias `phantom` so you can import with `import phantom from 'phantom'` without changing existing bot code.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 🛠️ Initial Setup (From Scratch)
|
|
87
|
+
|
|
88
|
+
### 1️⃣ Project Preparation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
mkdir my-bot
|
|
92
|
+
cd my-bot
|
|
93
|
+
npm init -y
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Make sure `package.json` has `"type": "module"`:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"name": "my-bot",
|
|
101
|
+
"type": "module",
|
|
102
|
+
"dependencies": {
|
|
103
|
+
"phantom": "npm:phantom-baileys@latest"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> [!IMPORTANT]
|
|
109
|
+
> **You must** use `"type": "module"` because phantom-baileys is an ESM-only package. Without this, imports will error.
|
|
110
|
+
|
|
111
|
+
### 2️⃣ Install Dependencies
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm install phantom-baileys pino
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 3️⃣ Create File `index.js`
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
import makeWASocket, {
|
|
121
|
+
useMultiFileAuthState,
|
|
122
|
+
DisconnectReason,
|
|
123
|
+
Browsers
|
|
124
|
+
} from 'phantom-baileys'
|
|
125
|
+
import pino from 'pino'
|
|
126
|
+
|
|
127
|
+
const logger = pino({ level: 'silent' })
|
|
128
|
+
|
|
129
|
+
async function startBot() {
|
|
130
|
+
const { state, saveCreds } = await useMultiFileAuthState('./session')
|
|
131
|
+
|
|
132
|
+
const sock = makeWASocket({
|
|
133
|
+
auth: state,
|
|
134
|
+
logger,
|
|
135
|
+
printQRInTerminal: true,
|
|
136
|
+
browser: Browsers.ubuntu('Chrome')
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
sock.ev.on('creds.update', saveCreds)
|
|
140
|
+
|
|
141
|
+
sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
|
|
142
|
+
if (connection === 'close') {
|
|
143
|
+
const shouldReconnect =
|
|
144
|
+
lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut
|
|
145
|
+
if (shouldReconnect) startBot()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (connection === 'open') {
|
|
149
|
+
console.log('✅ Bot connected!')
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
154
|
+
const msg = messages[0]
|
|
155
|
+
if (!msg?.message || msg.key.fromMe) return
|
|
156
|
+
|
|
157
|
+
const text =
|
|
158
|
+
msg.message.conversation ||
|
|
159
|
+
msg.message.extendedTextMessage?.text ||
|
|
160
|
+
''
|
|
161
|
+
|
|
162
|
+
if (text === '.ping') {
|
|
163
|
+
await sock.sendMessage(msg.key.remoteJid, { text: '🏓 Pong!' })
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (text === '.menu') {
|
|
167
|
+
await sock.sendMessage(msg.key.remoteJid, {
|
|
168
|
+
interactiveMessage: {
|
|
169
|
+
title: '📋 Bot Menu',
|
|
170
|
+
footer: '⚡ Powered by phantom-baileys',
|
|
171
|
+
buttons: [
|
|
172
|
+
{
|
|
173
|
+
name: 'quick_reply',
|
|
174
|
+
buttonParamsJson: JSON.stringify({
|
|
175
|
+
display_text: '🏓 Ping',
|
|
176
|
+
id: '.ping'
|
|
177
|
+
})
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'quick_reply',
|
|
181
|
+
buttonParamsJson: JSON.stringify({
|
|
182
|
+
display_text: 'ℹ️ Info',
|
|
183
|
+
id: '.info'
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
header: 'Main Menu'
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
startBot()
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### 4️⃣ Run the Bot
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
node index.js
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
> Scan the QR code that appears in the terminal, then send `.ping` or `.menu` to test! 🎉
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 🎛️ Interactive Messages
|
|
208
|
+
|
|
209
|
+
### Native Flow Buttons
|
|
210
|
+
|
|
211
|
+
```js
|
|
212
|
+
await sock.sendMessage(jid, {
|
|
213
|
+
interactiveMessage: {
|
|
214
|
+
title: '🎉 Welcome!',
|
|
215
|
+
footer: 'Powered by Terri',
|
|
216
|
+
buttons: [
|
|
217
|
+
{
|
|
218
|
+
name: 'quick_reply',
|
|
219
|
+
buttonParamsJson: JSON.stringify({
|
|
220
|
+
display_text: '📋 Menu',
|
|
221
|
+
id: 'menu'
|
|
222
|
+
})
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'cta_url',
|
|
226
|
+
buttonParamsJson: JSON.stringify({
|
|
227
|
+
display_text: '🌐 Website',
|
|
228
|
+
url: 'https://example.com'
|
|
229
|
+
})
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: 'cta_copy',
|
|
233
|
+
buttonParamsJson: JSON.stringify({
|
|
234
|
+
display_text: '📋 Copy Code',
|
|
235
|
+
copy_code: 'PHANTOM2026'
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
header: 'Choose an option',
|
|
240
|
+
image: { url: 'https://example.com/banner.jpg' }
|
|
241
|
+
}
|
|
242
|
+
})
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Interactive Buttons (viewOnce wrapper)
|
|
246
|
+
|
|
247
|
+
```js
|
|
248
|
+
await sock.sendMessage(jid, {
|
|
249
|
+
text: 'Hello World!',
|
|
250
|
+
title: 'Welcome',
|
|
251
|
+
footer: 'Choose below',
|
|
252
|
+
interactiveButtons: [
|
|
253
|
+
{
|
|
254
|
+
name: 'quick_reply',
|
|
255
|
+
buttonParamsJson: JSON.stringify({
|
|
256
|
+
display_text: '✅ Confirm',
|
|
257
|
+
id: 'confirm'
|
|
258
|
+
})
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'quick_reply',
|
|
262
|
+
buttonParamsJson: JSON.stringify({
|
|
263
|
+
display_text: '❌ Cancel',
|
|
264
|
+
id: 'cancel'
|
|
265
|
+
})
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
})
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### List Menu
|
|
272
|
+
|
|
273
|
+
```js
|
|
274
|
+
await sock.sendMessage(jid, {
|
|
275
|
+
interactiveMessage: {
|
|
276
|
+
title: '📋 Choose Category',
|
|
277
|
+
footer: 'Powered by Terri',
|
|
278
|
+
buttons: [
|
|
279
|
+
{
|
|
280
|
+
name: 'single_select',
|
|
281
|
+
buttonParamsJson: JSON.stringify({
|
|
282
|
+
title: 'Menu List',
|
|
283
|
+
sections: [
|
|
284
|
+
{
|
|
285
|
+
title: '🎮 Games',
|
|
286
|
+
rows: [
|
|
287
|
+
{ title: 'Guess the Picture', id: '.tebakgambar' },
|
|
288
|
+
{ title: 'Quiz', id: '.quiz' }
|
|
289
|
+
]
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
title: '🔧 Tools',
|
|
293
|
+
rows: [
|
|
294
|
+
{ title: 'Sticker', id: '.sticker' },
|
|
295
|
+
{ title: 'TTS', id: '.tts' }
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
})
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
header: 'Bot Menu'
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## 🖼️ Album Messages
|
|
310
|
+
|
|
311
|
+
```js
|
|
312
|
+
await sock.sendMessage(jid, {
|
|
313
|
+
albumMessage: [
|
|
314
|
+
{ image: { url: './photo1.jpg' }, caption: 'First 📸' },
|
|
315
|
+
{ image: { url: './photo2.jpg' }, caption: 'Second 📸' },
|
|
316
|
+
{ video: { url: './clip.mp4' }, caption: 'Video 🎥' }
|
|
317
|
+
]
|
|
318
|
+
})
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
> [!NOTE]
|
|
322
|
+
> Albums automatically set `expectedImageCount` and `expectedVideoCount` based on the array contents.
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## 📢 Newsletter Methods
|
|
327
|
+
|
|
328
|
+
```js
|
|
329
|
+
// 🔍 Resolve a channel URL to metadata
|
|
330
|
+
const info = await sock.cekIDSaluran('https://whatsapp.com/channel/xxxxx')
|
|
331
|
+
console.log(info.name, info.subscribers)
|
|
332
|
+
|
|
333
|
+
// 📥 Bulk follow multiple channels
|
|
334
|
+
await sock.newsletterMultipleFollow('id1@newsletter id2@newsletter')
|
|
335
|
+
|
|
336
|
+
// 📋 Fetch all subscribed channels
|
|
337
|
+
const channels = await sock.newsletterFetchAllSubscribe()
|
|
338
|
+
|
|
339
|
+
// ⚡ Generic action (follow/unfollow/mute)
|
|
340
|
+
await sock.newsletterAction('id@newsletter', 'follow')
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## 📊 Other Message Types
|
|
346
|
+
|
|
347
|
+
### 💳 Payment Request
|
|
348
|
+
|
|
349
|
+
```js
|
|
350
|
+
await sock.sendMessage(jid, {
|
|
351
|
+
requestPaymentMessage: {
|
|
352
|
+
amount: 50000,
|
|
353
|
+
currency: 'IDR',
|
|
354
|
+
note: 'Payment for order #123',
|
|
355
|
+
from: '628xxx@s.whatsapp.net'
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### 📅 Event
|
|
361
|
+
|
|
362
|
+
```js
|
|
363
|
+
await sock.sendMessage(jid, {
|
|
364
|
+
eventMessage: {
|
|
365
|
+
name: '🎉 Community Meetup',
|
|
366
|
+
description: 'Join us for the monthly meetup!',
|
|
367
|
+
startTime: Date.now() + 86400000,
|
|
368
|
+
endTime: Date.now() + 90000000,
|
|
369
|
+
location: {
|
|
370
|
+
name: 'Jakarta',
|
|
371
|
+
degreesLatitude: -6.2,
|
|
372
|
+
degreesLongitude: 106.8
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
})
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### 📊 Poll Result
|
|
379
|
+
|
|
380
|
+
```js
|
|
381
|
+
await sock.sendMessage(jid, {
|
|
382
|
+
pollResultMessage: {
|
|
383
|
+
name: 'Favorite Color?',
|
|
384
|
+
pollVotes: [
|
|
385
|
+
{ optionName: '🔴 Red', optionVoteCount: 42 },
|
|
386
|
+
{ optionName: '🔵 Blue', optionVoteCount: 38 },
|
|
387
|
+
{ optionName: '🟢 Green', optionVoteCount: 25 }
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
})
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### 📢 Status with Mentions
|
|
394
|
+
|
|
395
|
+
```js
|
|
396
|
+
await sock.sendStatusMention(
|
|
397
|
+
{ text: '🔥 Big update coming!' },
|
|
398
|
+
['628xxx@s.whatsapp.net', 'groupid@g.us']
|
|
399
|
+
)
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### 🛍️ Product Message
|
|
403
|
+
|
|
404
|
+
```js
|
|
405
|
+
await sock.sendMessage(jid, {
|
|
406
|
+
productMessage: {
|
|
407
|
+
title: '🎧 Wireless Headphones',
|
|
408
|
+
description: 'High quality bluetooth headphones',
|
|
409
|
+
productId: 'WH-001',
|
|
410
|
+
retailerId: 'Phantom-shop',
|
|
411
|
+
url: 'https://example.com/product',
|
|
412
|
+
priceAmount1000: 299000,
|
|
413
|
+
currencyCode: 'IDR',
|
|
414
|
+
thumbnail: { url: 'https://example.com/product.jpg' },
|
|
415
|
+
body: 'Check out this product!',
|
|
416
|
+
footer: 'Phantom Shop',
|
|
417
|
+
buttons: [
|
|
418
|
+
{
|
|
419
|
+
name: 'quick_reply',
|
|
420
|
+
buttonParamsJson: JSON.stringify({
|
|
421
|
+
display_text: '🛒 Buy Now',
|
|
422
|
+
id: 'buy_wh001'
|
|
423
|
+
})
|
|
424
|
+
}
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
})
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
> [!IMPORTANT]
|
|
434
|
+
> This package outputs **ESM only**. Your project must have `"type": "module"` in `package.json` or use a `.mjs` file.
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## 🤖 AI Rich Response Messages
|
|
439
|
+
|
|
440
|
+
Send messages in the Meta AI style — tables, code blocks with syntax highlighting, and rich text. All are rendered via `botForwardedMessage` > `richResponseMessage`.
|
|
441
|
+
|
|
442
|
+
### 📊 Table (with heading)
|
|
443
|
+
|
|
444
|
+
```js
|
|
445
|
+
await sock.sendTable(jid, 'Java vs JavaScript',
|
|
446
|
+
['Feature', 'Java', 'JavaScript'],
|
|
447
|
+
[
|
|
448
|
+
['Type', 'Compiled', 'Interpreted'],
|
|
449
|
+
['Typing', 'Static', 'Dynamic'],
|
|
450
|
+
['Main Use', 'Enterprise, Android', 'Web, Full-stack']
|
|
451
|
+
],
|
|
452
|
+
quoted, // optional, pass message object for quoting
|
|
453
|
+
{
|
|
454
|
+
headerText: 'Here is a comparison:', // text before table
|
|
455
|
+
footer: 'Hope this helps!' // text after table
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### 📋 List (without heading)
|
|
461
|
+
|
|
462
|
+
```js
|
|
463
|
+
await sock.sendList(jid, 'Bot Info',
|
|
464
|
+
[
|
|
465
|
+
['Name', 'Phantom AI'],
|
|
466
|
+
['Version', '2.4.0'],
|
|
467
|
+
['Developer', 'Zann']
|
|
468
|
+
],
|
|
469
|
+
quoted,
|
|
470
|
+
{ footer: '© Phantom AI' }
|
|
471
|
+
)
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### 💻 Code Block (with syntax highlighting)
|
|
475
|
+
|
|
476
|
+
```js
|
|
477
|
+
await sock.sendCodeBlock(jid,
|
|
478
|
+
`const greeting = "Hello World"
|
|
479
|
+
function sayHello(name) {
|
|
480
|
+
return greeting + " " + name
|
|
481
|
+
}
|
|
482
|
+
sayHello("Phantom") // output: Hello World Phantom`,
|
|
483
|
+
quoted,
|
|
484
|
+
{
|
|
485
|
+
language: 'javascript', // default: 'javascript'
|
|
486
|
+
title: '📝 Example Code',
|
|
487
|
+
footer: 'Powered by Terri'
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
**Supported languages:** `javascript`, `typescript`, `python` (auto keyword detection)
|
|
493
|
+
|
|
494
|
+
### 🔀 Mixed Rich Message (custom submessages)
|
|
495
|
+
|
|
496
|
+
```js
|
|
497
|
+
await sock.sendRichMessage(jid, [
|
|
498
|
+
{ messageType: 2, messageText: 'Here is some info:' },
|
|
499
|
+
{
|
|
500
|
+
messageType: 4,
|
|
501
|
+
tableMetadata: {
|
|
502
|
+
title: 'Stats',
|
|
503
|
+
rows: [
|
|
504
|
+
{ items: ['Metric', 'Value'], isHeading: true },
|
|
505
|
+
{ items: ['Users', '1000'] },
|
|
506
|
+
{ items: ['Uptime', '99.9%'] }
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{ messageType: 2, messageText: 'And some code:' },
|
|
511
|
+
{
|
|
512
|
+
messageType: 5,
|
|
513
|
+
codeMetadata: {
|
|
514
|
+
codeLanguage: 'javascript',
|
|
515
|
+
codeBlocks: [{ highlightType: 0, codeContent: 'console.log("OK")' }]
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
], quoted)
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### SubMessage Types
|
|
522
|
+
|
|
523
|
+
| messageType | Name | Payload Field |
|
|
524
|
+
|---|---|---|
|
|
525
|
+
| 0 | UNKNOWN | — |
|
|
526
|
+
| 1 | GRID_IMAGE | `gridImageMetadata` |
|
|
527
|
+
| 2 | TEXT | `messageText` |
|
|
528
|
+
| 3 | INLINE_IMAGE | `imageMetadata` |
|
|
529
|
+
| 4 | TABLE | `tableMetadata` |
|
|
530
|
+
| 5 | CODE | `codeMetadata` |
|
|
531
|
+
| 6 | DYNAMIC | `dynamicMetadata` |
|
|
532
|
+
| 7 | MAP | `mapMetadata` |
|
|
533
|
+
| 8 | LATEX | `latexMetadata` |
|
|
534
|
+
| 9 | CONTENT_ITEMS | `contentItemsMetadata` |
|
|
535
|
+
|
|
536
|
+
### Code Highlight Types
|
|
537
|
+
|
|
538
|
+
| highlightType | Name | Color |
|
|
539
|
+
|---|---|---|
|
|
540
|
+
| 0 | DEFAULT | Normal text |
|
|
541
|
+
| 1 | KEYWORD | `import`, `const`, `function` |
|
|
542
|
+
| 2 | METHOD | Function/method calls |
|
|
543
|
+
| 3 | STRING | String literals |
|
|
544
|
+
| 4 | NUMBER | Numeric values |
|
|
545
|
+
| 5 | COMMENT | Comments (`//`, `#`) |
|
|
546
|
+
|
|
547
|
+
### Utility Functions (Advanced)
|
|
548
|
+
|
|
549
|
+
```js
|
|
550
|
+
import {
|
|
551
|
+
tokenizeCode,
|
|
552
|
+
generateTableContent,
|
|
553
|
+
generateListContent,
|
|
554
|
+
generateCodeBlockContent,
|
|
555
|
+
generateRichMessageContent,
|
|
556
|
+
buildRichContextInfo,
|
|
557
|
+
buildBotForwardedMessage,
|
|
558
|
+
CodeHighlightType,
|
|
559
|
+
RichSubMessageType,
|
|
560
|
+
} from 'phantom-baileys'
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
## 🔀 Differences with Official Baileys
|
|
566
|
+
|
|
567
|
+
| Area | Official Baileys v7 | phantom-baileys |
|
|
568
|
+
|------|---------------------|---------------|
|
|
569
|
+
| Interactive messages | ❌ Not available natively | ✅ Full support via Dugong |
|
|
570
|
+
| Album messages | ❌ Not supported | ✅ Multi-media albums |
|
|
571
|
+
| AI Rich Response | ❌ Not available | ✅ Table, code block, rich text |
|
|
572
|
+
| Code Block | ❌ Not available | ✅ Syntax highlighting (JS/TS/Python) |
|
|
573
|
+
| Business nodes | ❌ Inject manually | ✅ Auto-inject in relay |
|
|
574
|
+
| Newsletter extras | ❌ Basic only | ✅ Auto-follow, bulk, resolve |
|
|
575
|
+
| Button detection | ❌ Not available | ✅ `getButtonType()` auto-detect |
|
|
576
|
+
| Payment messages | ❌ Not supported | ✅ Full support |
|
|
577
|
+
| Event messages | ❌ Basic | ✅ Enhanced fields |
|
|
578
|
+
| Status mentions | ❌ Not available | ✅ `sendStatusMention()` |
|
|
579
|
+
| Product messages | ❌ Not supported | ✅ Catalog + buttons |
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
> [!WARNING]
|
|
584
|
+
> Requires **Node.js ≥ 20.0.0** and **TypeScript ≥ 5.8** to build from source.
|
|
585
|
+
|
|
586
|
+
## 📄 License
|
|
587
|
+
|
|
588
|
+
MIT
|
|
589
|
+
|
|
590
|
+
> [!CAUTION]
|
|
591
|
+
> This library is for **educational purposes**. Make sure you comply with WhatsApp's Terms of Service.
|
|
592
|
+
```
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify --no-comments -o ./index.js ./WAProto.proto;
|
|
2
|
+
yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify ./WAProto.proto | yarn pbts --no-comments -o ./index.d.ts -;
|
|
3
|
+
node ./fix-imports.js
|