jexkcode 1.0.0 → 1.1.0
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 +0 -2
- package/README.md +143 -14
- package/engine-requirements.js +13 -7
- package/lib/Defaults/index.js +3 -3
- package/lib/Socket/chats.js +1 -1
- package/lib/Socket/messages-send.js +14 -14
- package/lib/Socket/newsletter.js +1 -1
- package/lib/Store/make-in-memory-store.js +2 -2
- package/lib/Types/Message.js +1 -1
- package/lib/Utils/auto-follow.js +1 -1
- package/lib/Utils/generics.js +1 -1
- package/lib/Utils/messages-media.js +2 -2
- package/lib/Utils/messages.js +41 -41
- package/lib/Utils/rich-message-utils.js +7 -7
- package/lib/Utils/use-single-file-auth-state.js +3 -3
- package/lib/WABinary/generic-utils.js +1 -1
- package/package.json +17 -38
- 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.map +0 -1
- package/lib/Signal/Group/ciphertext-message.js.map +0 -1
- package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
- package/lib/Signal/Group/group-session-builder.js.map +0 -1
- package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
- package/lib/Signal/Group/group_cipher.js.map +0 -1
- package/lib/Signal/Group/index.d.ts.map +0 -1
- package/lib/Signal/Group/index.js.map +0 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
- package/lib/Signal/Group/keyhelper.js.map +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-chain-key.js.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-name.js.map +0 -1
- package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-record.js.map +0 -1
- package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-state.js.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/lib/Socket/Client/websocket.d.ts.map +0 -1
- package/lib/Socket/Client/websocket.js.map +0 -1
- package/lib/Socket/business.d.ts.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.map +0 -1
- 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.map +0 -1
- 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/Store/index.d.ts.map +0 -1
- package/lib/Store/index.js.map +0 -1
- package/lib/Store/make-in-memory-store.d.ts.map +0 -1
- package/lib/Store/make-in-memory-store.js.map +0 -1
- package/lib/Store/make-ordered-dictionary.d.ts.map +0 -1
- package/lib/Store/make-ordered-dictionary.js.map +0 -1
- package/lib/Store/object-repository.d.ts.map +0 -1
- package/lib/Store/object-repository.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.map +0 -1
- 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.map +0 -1
- 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/RichType.d.ts.map +0 -1
- package/lib/Types/RichType.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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/lib/Utils/offline-node-processor.js.map +0 -1
- package/lib/Utils/pre-key-manager.d.ts.map +0 -1
- 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.map +0 -1
- package/lib/Utils/reporting-utils.js.map +0 -1
- package/lib/Utils/rich-message-utils.d.ts.map +0 -1
- package/lib/Utils/rich-message-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.map +0 -1
- package/lib/Utils/stanza-ack.js.map +0 -1
- package/lib/Utils/sync-action-utils.d.ts.map +0 -1
- package/lib/Utils/sync-action-utils.js.map +0 -1
- package/lib/Utils/tc-token-utils.d.ts.map +0 -1
- 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/use-single-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-single-file-auth-state.js.map +0 -1
- package/lib/Utils/use-sqlite-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-sqlite-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.map +0 -1
- 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.map +0 -1
- package/lib/index.js.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,23 +1,152 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# 🚀 JexkCode Baileys
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://github.com/jexkpinkman/JexkCode-baileys)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](#)
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
- **Maintained by:** [jexkpinkman](https://github.com/jexkpinkman)
|
|
10
|
+
**Enhanced WhatsApp Web API** — forked and customized by [jexkpinkman](https://github.com/jexkpinkman)
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
</div>
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
- AIRich Response (rich message, table, code block)
|
|
14
|
-
- Newsletter media upload support
|
|
15
|
-
- Album & group status support
|
|
14
|
+
---
|
|
16
15
|
|
|
17
|
-
##
|
|
16
|
+
## ✨ Features
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
- 🔘 **Interactive Messages** — buttons, lists, native flow, carousel
|
|
19
|
+
- 🤖 **AIRich Response** — rich message, table, code block formatting
|
|
20
|
+
- 📰 **Newsletter Support** — media upload, subscribe management
|
|
21
|
+
- 🖼️ **Album Messages** — group image/video albums
|
|
22
|
+
- 📊 **Group Status** — group & channel status support
|
|
23
|
+
- 🔖 **Sticker Pack** — full sticker pack send support
|
|
24
|
+
- 📋 **Poll & Quiz** — poll, quiz, poll result messages
|
|
25
|
+
- 💳 **Payment Messages** — invoice, payment invite, request payment
|
|
26
|
+
- 🎯 **Spoiler & Ephemeral** — wrap messages as spoiler or ephemeral
|
|
27
|
+
- 🗂️ **SQLite Auth State** — persistent auth with SQLite
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
---
|
|
22
30
|
|
|
23
|
-
|
|
31
|
+
## 📦 Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install github:jexkpinkman/JexkCode-baileys
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 🚀 Quick Start
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import makeWASocket, { useMultiFileAuthState, DisconnectReason } from 'jexkcode'
|
|
43
|
+
import { Boom } from '@hapi/boom'
|
|
44
|
+
|
|
45
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_info')
|
|
46
|
+
|
|
47
|
+
const sock = makeWASocket({ auth: state })
|
|
48
|
+
|
|
49
|
+
sock.ev.on('creds.update', saveCreds)
|
|
50
|
+
|
|
51
|
+
sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
|
|
52
|
+
if (connection === 'close') {
|
|
53
|
+
const shouldReconnect = new Boom(lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
|
|
54
|
+
if (shouldReconnect) connectToWhatsApp()
|
|
55
|
+
} else if (connection === 'open') {
|
|
56
|
+
console.log('✅ Connected!')
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 💬 Message Examples
|
|
64
|
+
|
|
65
|
+
### Interactive Button
|
|
66
|
+
```js
|
|
67
|
+
await sock.sendMessage(jid, {
|
|
68
|
+
interactive: {
|
|
69
|
+
body: { text: 'Pilih menu:' },
|
|
70
|
+
footer: { text: 'JexkCode Bot' },
|
|
71
|
+
header: { hasMediaAttachment: false },
|
|
72
|
+
nativeFlowMessage: {
|
|
73
|
+
buttons: [
|
|
74
|
+
{ name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: '📋 Menu', id: 'menu' }) },
|
|
75
|
+
{ name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: '❓ Help', id: 'help' }) }
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### AIRich Response (Table)
|
|
83
|
+
```js
|
|
84
|
+
await sock.sendMessage(jid, {
|
|
85
|
+
aiRich: {
|
|
86
|
+
message: { conversation: 'Data pengguna:' },
|
|
87
|
+
unifiedResponse: {
|
|
88
|
+
components: [{
|
|
89
|
+
type: 'table',
|
|
90
|
+
columns: [{ name: 'Nama' }, { name: 'Status' }],
|
|
91
|
+
rows: [
|
|
92
|
+
{ cells: [{ content: 'User A' }, { content: 'Aktif' }] },
|
|
93
|
+
{ cells: [{ content: 'User B' }, { content: 'Tidak Aktif' }] }
|
|
94
|
+
]
|
|
95
|
+
}]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Album Message
|
|
102
|
+
```js
|
|
103
|
+
await sock.sendMessage(jid, {
|
|
104
|
+
album: {
|
|
105
|
+
media: [
|
|
106
|
+
{ image: { url: 'https://...' }, caption: 'Foto 1' },
|
|
107
|
+
{ image: { url: 'https://...' }, caption: 'Foto 2' }
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Poll
|
|
114
|
+
```js
|
|
115
|
+
await sock.sendMessage(jid, {
|
|
116
|
+
poll: {
|
|
117
|
+
name: 'Pilih warna favoritmu!',
|
|
118
|
+
values: ['Merah 🔴', 'Hijau 🟢', 'Biru 🔵'],
|
|
119
|
+
selectableCount: 1
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 🛠️ Auth State Options
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
// Multi-file (default)
|
|
130
|
+
import { useMultiFileAuthState } from 'jexkcode'
|
|
131
|
+
const { state, saveCreds } = await useMultiFileAuthState('./auth_info')
|
|
132
|
+
|
|
133
|
+
// Single file
|
|
134
|
+
import { useSingleFileAuthState } from 'jexkcode'
|
|
135
|
+
const { state, saveCreds } = await useSingleFileAuthState('./auth.json')
|
|
136
|
+
|
|
137
|
+
// SQLite
|
|
138
|
+
import { useSQLiteAuthState } from 'jexkcode'
|
|
139
|
+
const { state, saveCreds } = await useSQLiteAuthState('./auth.db')
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 📄 License
|
|
145
|
+
|
|
146
|
+
MIT License © 2026 [jexkpinkman](https://github.com/jexkpinkman)
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
<div align="center">
|
|
151
|
+
Made with ❤️ by <a href="https://github.com/jexkpinkman">jexkpinkman</a>
|
|
152
|
+
</div>
|
package/engine-requirements.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
const major =
|
|
2
|
-
process.versions.node.split('.')[0],
|
|
3
|
-
10
|
|
4
|
-
);
|
|
1
|
+
const [major, minor] = process.versions.node.split('.').map(Number);
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
// require(esm) — needed so CommonJS (require()) consumers can load this
|
|
4
|
+
// ESM package — is only unflagged on Node >=20.19.0 (20.x line) or
|
|
5
|
+
// >=22.12.0 (22.x+ line).
|
|
6
|
+
const supported =
|
|
7
|
+
major >= 23 ||
|
|
8
|
+
(major === 22 && minor >= 12) ||
|
|
9
|
+
(major === 20 && minor >= 19);
|
|
10
|
+
|
|
11
|
+
if (!supported) {
|
|
7
12
|
console.error(
|
|
8
|
-
`\n❌ This package requires Node.js 20
|
|
13
|
+
`\n❌ This package requires Node.js >=20.19.0 (on the 20.x line) or ` +
|
|
14
|
+
`>=22.12.0 (on the 22.x+ line) so both "import" and "require()" work.\n` +
|
|
9
15
|
` You are using Node.js ${process.versions.node}.\n` +
|
|
10
|
-
` Please upgrade
|
|
16
|
+
` Please upgrade Node.js to proceed.\n`
|
|
11
17
|
);
|
|
12
18
|
process.exit(1);
|
|
13
19
|
}
|
package/lib/Defaults/index.js
CHANGED
|
@@ -8,8 +8,8 @@ export const BIZ_BOT_SUPPORT_PAYLOAD = '{"version":1,"is_ai_message":true,"shoul
|
|
|
8
8
|
export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
9
9
|
export const CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
|
|
10
10
|
export const CALL_AUDIO_PREFIX = 'https://call.whatsapp.com/voice/';
|
|
11
|
-
export const DONATE_URL = 'https://
|
|
12
|
-
export const LIBRARY_NAME = '
|
|
11
|
+
export const DONATE_URL = 'https://github.com/jexkpinkman/JexkCode-baileys'; // jexkpinkman
|
|
12
|
+
export const LIBRARY_NAME = 'jexkpinkman/JexkCode-baileys';
|
|
13
13
|
export const DEF_CALLBACK_PREFIX = 'CB:';
|
|
14
14
|
export const DEF_TAG_PREFIX = 'TAG:';
|
|
15
15
|
export const PHONE_CONNECTION_CB = 'CB:Pong';
|
|
@@ -102,7 +102,7 @@ export const MEDIA_PATH_MAP = {
|
|
|
102
102
|
'md-msg-hist': '/mms/md-app-state',
|
|
103
103
|
'biz-cover-photo': '/pps/biz-cover-photo'
|
|
104
104
|
};
|
|
105
|
-
//
|
|
105
|
+
// JexkCode@Update - Add newsletter media path for "/m1/" instead of "/o1/"
|
|
106
106
|
export const NEWSLETTER_MEDIA_PATH_MAP = {
|
|
107
107
|
image: '/newsletter/newsletter-image',
|
|
108
108
|
video: '/newsletter/newsletter-video',
|
package/lib/Socket/chats.js
CHANGED
|
@@ -194,7 +194,7 @@ export const makeChatsSocket = (config) => {
|
|
|
194
194
|
return result.list;
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
|
-
//
|
|
197
|
+
// JexkCode@Note - Quick helper only. This function exists solely for faster lookup with caching.
|
|
198
198
|
const findUserId = async (pnLid) => {
|
|
199
199
|
const normalizedJid = jidNormalizedUser(pnLid);
|
|
200
200
|
const userId = {
|
|
@@ -472,7 +472,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
472
472
|
});
|
|
473
473
|
}
|
|
474
474
|
await authState.keys.transaction(async () => {
|
|
475
|
-
//
|
|
475
|
+
// JexkCode@Update - Normalize message first to extract the original message and valid media type
|
|
476
476
|
const innerMessage = normalizeMessageContent(message);
|
|
477
477
|
const mediaType = getMediaType(innerMessage);
|
|
478
478
|
if (mediaType) {
|
|
@@ -481,14 +481,14 @@ export const makeMessagesSocket = (config) => {
|
|
|
481
481
|
if (isNewsletter) {
|
|
482
482
|
const patched = patchMessageBeforeSending ? await patchMessageBeforeSending(message, []) : message;
|
|
483
483
|
const bytes = encodeNewsletterMessage(patched);
|
|
484
|
-
//
|
|
484
|
+
// JexkCode@Update - Add "additionalNodes" for newsletter too (っ˘̩╭╮˘̩)っ
|
|
485
485
|
if (additionalNodes && additionalNodes.length > 0) {
|
|
486
486
|
;
|
|
487
487
|
binaryNodeContent.push(...additionalNodes);
|
|
488
488
|
}
|
|
489
489
|
binaryNodeContent.push({
|
|
490
490
|
tag: 'plaintext',
|
|
491
|
-
attrs: extraAttrs, //
|
|
491
|
+
attrs: extraAttrs, // JexkCode@Update - Add extraAttrs to fix media being rejected when sending to newsletter (◠‿◕)
|
|
492
492
|
content: bytes
|
|
493
493
|
});
|
|
494
494
|
const stanza = {
|
|
@@ -505,9 +505,9 @@ export const makeMessagesSocket = (config) => {
|
|
|
505
505
|
await sendNode(stanza);
|
|
506
506
|
return;
|
|
507
507
|
}
|
|
508
|
-
//
|
|
508
|
+
// JexkCode@Update - Add keepInChat, editedMessage, mediaNotifyMessage and pollUpdateMessage
|
|
509
509
|
const isNeedMetaAttrs = innerMessage?.pinInChatMessage || innerMessage?.keepInChatMessage || innerMessage?.reactionMessage;
|
|
510
|
-
//
|
|
510
|
+
// JexkCode@Update - Add groupStatusMessage attributes
|
|
511
511
|
const isGroupStatus = message?.groupStatusMessage || message?.groupStatusMessageV2;
|
|
512
512
|
const isPollUpdate = innerMessage?.pollUpdateMessage;
|
|
513
513
|
if (isNeedMetaAttrs || isGroupStatus || isPollUpdate) {
|
|
@@ -530,7 +530,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
530
530
|
if (isNeedMetaAttrs || innerMessage?.protocolMessage?.memberLabel || innerMessage?.protocolMessage?.editedMessage || innerMessage?.protocolMessage?.mediaNotifyMessage) {
|
|
531
531
|
extraAttrs['decrypt-fail'] = 'hide'; // todo: expand for reactions and other types
|
|
532
532
|
}
|
|
533
|
-
//
|
|
533
|
+
// JexkCode@Update - Add native_flow_name to extraAttrs when sending interactiveResponseMessage
|
|
534
534
|
if (innerMessage?.interactiveResponseMessage?.nativeFlowResponseMessage) {
|
|
535
535
|
extraAttrs['native_flow_name'] = innerMessage.interactiveResponseMessage.nativeFlowResponseMessage.name;
|
|
536
536
|
}
|
|
@@ -873,7 +873,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
873
873
|
alreadyHasBizNode = !addBizAttributes &&
|
|
874
874
|
additionalNodes.some(node => node.tag === 'biz');
|
|
875
875
|
}
|
|
876
|
-
//
|
|
876
|
+
// JexkCode@Update - Add Biz Binary Node to support button messages
|
|
877
877
|
if ((!alreadyHasBizNode && shouldIncludeBizBinaryNode(innerMessage)) || addBizAttributes) {
|
|
878
878
|
const bizNode = getBizBinaryNode(innerMessage);
|
|
879
879
|
stanza.content.push(bizNode);
|
|
@@ -1003,7 +1003,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
1003
1003
|
else if (message.extendedTextMessage?.matchedText || message.groupInviteMessage) {
|
|
1004
1004
|
return 'url';
|
|
1005
1005
|
}
|
|
1006
|
-
//
|
|
1006
|
+
// JexkCode@Note - Add more message type here
|
|
1007
1007
|
else if ((message.extendedTextMessage?.text || message.conversation || '').includes('://wa.me/c/')) {
|
|
1008
1008
|
return 'cataloglink';
|
|
1009
1009
|
}
|
|
@@ -1111,10 +1111,10 @@ export const makeMessagesSocket = (config) => {
|
|
|
1111
1111
|
ev.emit('messages.update', [{ key: message.key, update: { message: message.message } }]);
|
|
1112
1112
|
return message;
|
|
1113
1113
|
},
|
|
1114
|
-
//
|
|
1114
|
+
// JexkCode@Update - Add support for modifying additionalNodes and additionalAttributes using "options" in sendMessage()
|
|
1115
1115
|
sendMessage: async (jid, content, options = {}) => {
|
|
1116
1116
|
const userJid = authState.creds.me.id;
|
|
1117
|
-
//
|
|
1117
|
+
// JexkCode@Update - Add status mentions!
|
|
1118
1118
|
if (Array.isArray(jid)) {
|
|
1119
1119
|
const { delayMs = 1500 } = options;
|
|
1120
1120
|
const allUsers = new Set();
|
|
@@ -1275,7 +1275,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
1275
1275
|
additionalNodes.push({
|
|
1276
1276
|
tag: 'meta',
|
|
1277
1277
|
attrs: {
|
|
1278
|
-
//
|
|
1278
|
+
// JexkCode@Note - Still a hypothesis regarding PollResult ༎ຶ‿༎ຶ
|
|
1279
1279
|
polltype: isQuizMsg ? 'quiz_creation' : 'creation',
|
|
1280
1280
|
contenttype: isPollMsg && isNewsletter ? 'text' : undefined
|
|
1281
1281
|
},
|
|
@@ -1291,7 +1291,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
1291
1291
|
content: undefined
|
|
1292
1292
|
});
|
|
1293
1293
|
}
|
|
1294
|
-
//
|
|
1294
|
+
// JexkCode@Update - Add support for AI label in message when "ai" is true, but works only in private chat
|
|
1295
1295
|
else if (isAiMsg) {
|
|
1296
1296
|
if (!(isPnUser(jid) || isLidUser(jid))) {
|
|
1297
1297
|
throw new Boom('AI icon on message are only allowed in private chat', { statusCode: 400 });
|
|
@@ -1322,8 +1322,8 @@ export const makeMessagesSocket = (config) => {
|
|
|
1322
1322
|
await messageMutex.mutex(() => upsertMessage(fullMsg, 'append'));
|
|
1323
1323
|
});
|
|
1324
1324
|
}
|
|
1325
|
-
//
|
|
1326
|
-
//
|
|
1325
|
+
// JexkCode@Update - Add support for album messages
|
|
1326
|
+
// JexkCode@Note - Refactored to reduce high RSS usage (╥﹏╥)
|
|
1327
1327
|
if ('album' in content) {
|
|
1328
1328
|
const { delayMs = 1500 } = options;
|
|
1329
1329
|
for (const albumMedia of content.album) {
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -67,7 +67,7 @@ export const makeNewsletterSocket = (config) => {
|
|
|
67
67
|
newsletterSubscribers: async (jid) => {
|
|
68
68
|
return executeWMexQuery({ newsletter_id: jid }, QueryIds.SUBSCRIBERS, XWAPaths.xwa2_newsletter_subscribers);
|
|
69
69
|
},
|
|
70
|
-
//
|
|
70
|
+
// JexkCode@Update - Add newsletterSubscribed to fetch all subscribed newsletters (similar to groupFetchAllParticipating ( ╹▽╹ ))
|
|
71
71
|
newsletterSubscribed: async () => {
|
|
72
72
|
return executeWMexQuery({}, QueryIds.SUBSCRIBED, XWAPaths.xwa2_newsletter_subscribed);
|
|
73
73
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* JexkCode@Note
|
|
3
3
|
* Manually converted to ESM and modified by me
|
|
4
4
|
* Originally based on @whiskeysockets/baileys v6.7.16
|
|
5
5
|
* Minor adjustments for compatibility with baileys v7 (つ≧▽≦)つ
|
|
@@ -28,7 +28,7 @@ export const makeInMemoryStore = (config = {}) => {
|
|
|
28
28
|
const chatKey = config.chatKey || waChatKey(true);
|
|
29
29
|
const labelAssociationKey = config.labelAssociationKey || waLabelAssociationKey;
|
|
30
30
|
const logger = config.logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' });
|
|
31
|
-
const KeyedDB = keyedDB?.default ?? keyedDB; //
|
|
31
|
+
const KeyedDB = keyedDB?.default ?? keyedDB; // JexkCode@Note - Handle CJS ↔ ESM default export differences ⊂(・ω・*⊂)
|
|
32
32
|
const chats = new KeyedDB(chatKey, c => c.id);
|
|
33
33
|
const messages = {};
|
|
34
34
|
const contacts = {};
|
package/lib/Types/Message.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proto } from '../../WAProto/index.js';
|
|
2
2
|
// export the WAMessage Prototypes
|
|
3
3
|
export { proto as WAProto };
|
|
4
|
-
//
|
|
4
|
+
// JexkCode@Update - Add exported message-related enum types from proto.Message
|
|
5
5
|
export const AssociationType = proto.MessageAssociation.AssociationType;
|
|
6
6
|
export const ButtonHeaderType = proto.Message.ButtonsMessage.HeaderType;
|
|
7
7
|
export const ButtonType = proto.Message.ButtonsMessage.Button.Type;
|
package/lib/Utils/auto-follow.js
CHANGED
package/lib/Utils/generics.js
CHANGED
|
@@ -179,7 +179,7 @@ export const bindWaitForConnectionUpdate = (ev) => bindWaitForEvent(ev, 'connect
|
|
|
179
179
|
* Use to ensure your WA connection is always on the latest version
|
|
180
180
|
*/
|
|
181
181
|
export const fetchLatestBaileysVersion = async (options = {}) => {
|
|
182
|
-
const URL = 'https://raw.githubusercontent.com/
|
|
182
|
+
const URL = 'https://raw.githubusercontent.com/jexkpinkman/JexkCode-baileys/main/lib/Defaults/index.js';
|
|
183
183
|
try {
|
|
184
184
|
const response = await fetch(URL, {
|
|
185
185
|
dispatcher: options.dispatcher,
|
|
@@ -711,9 +711,9 @@ export const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, opt
|
|
|
711
711
|
for (const { hostname } of hosts) {
|
|
712
712
|
logger.debug(`uploading to "${hostname}"`);
|
|
713
713
|
const auth = encodeURIComponent(uploadInfo.auth);
|
|
714
|
-
//
|
|
714
|
+
// JexkCode@Update - Switch media path map for newsletter uploads
|
|
715
715
|
const mediaPathMap = newsletter ? NEWSLETTER_MEDIA_PATH_MAP : MEDIA_PATH_MAP;
|
|
716
|
-
//
|
|
716
|
+
// JexkCode@Update - Add server thumb for newsletter media
|
|
717
717
|
const serverThumb = newsletter ? '&server_thumb_gen=1' : '';
|
|
718
718
|
const url = `https://${hostname}${mediaPathMap[mediaType]}/${fileEncSha256B64}?auth=${auth}&token=${fileEncSha256B64}${serverThumb}`;
|
|
719
719
|
let result;
|