alipclutch-baileys 5.0.0 → 6.5.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 +1 -1
- package/README.MD +352 -0
- package/WAProto/p.html +1 -1
- package/engine-requirements.js +4 -4
- package/lib/Defaults/index.js +1 -1
- package/lib/Socket/chats.js +0 -22
- package/lib/Socket/messages-send.js +0 -149
- package/lib/Socket/newsletter.js +120 -164
- package/lib/Socket/socket.js +1 -1
- package/lib/Types/Newsletter.js +0 -1
- package/lib/Utils/auth-utils.js +1 -1
- package/lib/Utils/chat-utils.js +0 -11
- package/lib/Utils/generics.js +2 -2
- package/lib/WABinary/jid-utils.js.bak +83 -0
- package/lib/index.js +12 -11
- package/package.json +67 -22
- /package/lib/Defaults/{baileys-version.json → wileys-version.json} +0 -0
package/LICENSE
CHANGED
package/README.MD
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# <div align='center'>alipclutch</div>
|
|
2
|
+
|
|
3
|
+
<div align='center'>
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/alipclutch)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/alipclutch)
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
**alipclutch** is a modern WebSocket-based TypeScript library for interacting with the WhatsApp Web API. This library has been enhanced to address issues with WhatsApp group `@lid` and `@jid` handling, ensuring robust performance.
|
|
12
|
+
|
|
13
|
+
## ✨ Key Features
|
|
14
|
+
|
|
15
|
+
- 🚀 **Modern & Fast** - Built with TypeScript and cutting-edge technologies
|
|
16
|
+
- 🔧 **Fixed @lid & @jid** - Resolved WhatsApp group `@lid` to @pn` issues
|
|
17
|
+
- 📱 **Multi-Device Support** - Supports WhatsApp multi-device connections
|
|
18
|
+
- 🔐 **End-to-End Encryption** - Fully encrypted communications
|
|
19
|
+
- 📨 **All Message Types** - Supports all message types (text, media, polls, etc.)
|
|
20
|
+
- 🎯 **Easy to Use** - Simple and intuitive API
|
|
21
|
+
|
|
22
|
+
## ⚠️ Disclaimer
|
|
23
|
+
|
|
24
|
+
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or affiliates. The official WhatsApp website can be found at [whatsapp.com](https://whatsapp.com).
|
|
25
|
+
|
|
26
|
+
The maintainers of `alipclutch` do not condone the use of this application in practices that violate WhatsApp's Terms of Service. We urge users to exercise personal responsibility and use this application fairly and responsibly.
|
|
27
|
+
|
|
28
|
+
**Use wisely. Avoid spamming. Refrain from excessive automated usage.**
|
|
29
|
+
|
|
30
|
+
## 📦 Installation
|
|
31
|
+
|
|
32
|
+
### Stable Version (Recommended)
|
|
33
|
+
```bash
|
|
34
|
+
npm i alipclutch
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Edge Version (Latest Features)
|
|
38
|
+
```bash
|
|
39
|
+
npm i alipclutch@latest
|
|
40
|
+
# or
|
|
41
|
+
yarn add alipclutch@latest
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Import in Code
|
|
45
|
+
```javascript
|
|
46
|
+
const { default: makeWASocket } = require("alipclutch")
|
|
47
|
+
// or ES6
|
|
48
|
+
import makeWASocket from "alipclutch"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 🚀 Quick Start
|
|
52
|
+
|
|
53
|
+
### Example
|
|
54
|
+
Here is an example you can use: [example.ts](Example/example.ts) or follow this tutorial to run the alipclutch WhatsApp API code:
|
|
55
|
+
1. ```bash
|
|
56
|
+
cd path/to/alipclutch
|
|
57
|
+
```
|
|
58
|
+
2. ```bash
|
|
59
|
+
npm install
|
|
60
|
+
```
|
|
61
|
+
3. ```bash
|
|
62
|
+
node example.js
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Basic Example
|
|
66
|
+
```javascript
|
|
67
|
+
const { default: makeWASocket, DisconnectReason, useMultiFileAuthState } = require('alipclutch')
|
|
68
|
+
const { Boom } = require('@hapi/boom')
|
|
69
|
+
|
|
70
|
+
async function connectToWhatsApp() {
|
|
71
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
|
|
72
|
+
|
|
73
|
+
const sock = makeWASocket({
|
|
74
|
+
auth: state,
|
|
75
|
+
printQRInTerminal: true,
|
|
76
|
+
browser: ['alipclutch', 'Desktop', '3.0']
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
sock.ev.on('connection.update', (update) => {
|
|
80
|
+
const { connection, lastDisconnect } = update
|
|
81
|
+
if(connection === 'close') {
|
|
82
|
+
const shouldReconnect = (lastDisconnect?.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
|
|
83
|
+
console.log('Connection closed due to ', lastDisconnect.error, ', reconnecting ', shouldReconnect)
|
|
84
|
+
if(shouldReconnect) {
|
|
85
|
+
connectToWhatsApp()
|
|
86
|
+
}
|
|
87
|
+
} else if(connection === 'open') {
|
|
88
|
+
console.log('✅ Successfully connected to WhatsApp!')
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
93
|
+
for (const m of messages) {
|
|
94
|
+
if (!m.message) continue
|
|
95
|
+
|
|
96
|
+
console.log('📱 New message:', JSON.stringify(m, undefined, 2))
|
|
97
|
+
|
|
98
|
+
// Auto reply
|
|
99
|
+
await sock.sendMessage(m.key.remoteJid!, {
|
|
100
|
+
text: 'Hello! I am a WhatsApp bot using alipclutch 🤖'
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
sock.ev.on('creds.update', saveCreds)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
connectToWhatsApp()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
# Index
|
|
112
|
+
|
|
113
|
+
- [Connecting Account](#connecting-account)
|
|
114
|
+
- [Connect with QR Code](#starting-socket-with-qr-code)
|
|
115
|
+
- [Connect with Pairing Code](#starting-socket-with-pairing-code)
|
|
116
|
+
- [Receive Full History](#receive-full-history)
|
|
117
|
+
- [Important Notes About Socket Config](#important-notes-about-socket-config)
|
|
118
|
+
- [Caching Group Metadata (Recommended)](#caching-group-metadata-recommended)
|
|
119
|
+
- [Improve Retry System & Decrypt Poll Votes](#improve-retry-system--decrypt-poll-votes)
|
|
120
|
+
- [Receive Notifications in WhatsApp App](#receive-notifications-in-whatsapp-app)
|
|
121
|
+
- [Save Auth Info](#saving--restoring-sessions)
|
|
122
|
+
- [Handling Events](#handling-events)
|
|
123
|
+
- [Example to Start](#example-to-start)
|
|
124
|
+
- [Decrypt Poll Votes](#decrypt-poll-votes)
|
|
125
|
+
- [Summary of Events on First Connection](#summary-of-events-on-first-connection)
|
|
126
|
+
- [Implementing a Data Store](#implementing-a-data-store)
|
|
127
|
+
- [WhatsApp IDs Explained](#whatsapp-ids-explain)
|
|
128
|
+
- [Utility Functions](#utility-functions)
|
|
129
|
+
- [Sending Messages](#sending-messages)
|
|
130
|
+
- [Non-Media Messages](#non-media-messages)
|
|
131
|
+
- [Sending with Link Preview](#sending-messages-with-link-previews)
|
|
132
|
+
- [Media Messages](#media-messages)
|
|
133
|
+
- [Modify Messages](#modify-messages)
|
|
134
|
+
- [Manipulating Media Messages](#manipulating-media-messages)
|
|
135
|
+
- [Reject Call](#reject-call)
|
|
136
|
+
- [Send States in Chat](#send-states-in-chat)
|
|
137
|
+
- [Modifying Chats](#modifying-chats)
|
|
138
|
+
- [User Queries](#user-querys)
|
|
139
|
+
- [Change Profile](#change-profile)
|
|
140
|
+
- [Groups](#groups)
|
|
141
|
+
- [Privacy](#privacy)
|
|
142
|
+
- [Broadcast Lists & Stories](#broadcast-lists--stories)
|
|
143
|
+
- [Writing Custom Functionality](#writing-custom-functionality)
|
|
144
|
+
- [Tips & Best Practices](#tips--best-practices)
|
|
145
|
+
- [Troubleshooting](#troubleshooting)
|
|
146
|
+
- [Contributing](#contributing)
|
|
147
|
+
- [License](#license)
|
|
148
|
+
- [Acknowledgments](#acknowledgments)
|
|
149
|
+
|
|
150
|
+
## Connecting Account
|
|
151
|
+
|
|
152
|
+
WhatsApp provides a multi-device API that allows `alipclutch` to authenticate as a secondary WhatsApp client via QR code or pairing code.
|
|
153
|
+
|
|
154
|
+
### Starting Socket with **QR Code**
|
|
155
|
+
|
|
156
|
+
> [!TIP]
|
|
157
|
+
> Customize the browser name using the `Browsers` constant. See available configurations [here](https://baileys.whiskeysockets.io/types/BrowsersMap.html).
|
|
158
|
+
|
|
159
|
+
```javascript
|
|
160
|
+
const { default: makeWASocket, Browsers } = require("alipclutch")
|
|
161
|
+
|
|
162
|
+
const sock = makeWASocket({
|
|
163
|
+
browser: Browsers.ubuntu('My App'),
|
|
164
|
+
printQRInTerminal: true
|
|
165
|
+
})
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Upon successful connection, a QR code will be printed in the terminal. Scan it with WhatsApp on your phone to log in.
|
|
169
|
+
|
|
170
|
+
### Starting Socket with **Pairing Code**
|
|
171
|
+
|
|
172
|
+
> [!IMPORTANT]
|
|
173
|
+
> Pairing codes are not part of the Mobile API. They allow connecting WhatsApp Web without a QR code, but only one device can be connected. See [WhatsApp FAQ](https://faq.whatsapp.com/1324084875126592/?cms_platform=web).
|
|
174
|
+
|
|
175
|
+
Phone numbers must exclude `+`, `()`, or `-`, and include the country code.
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
const { default: makeWASocket } = require("alipclutch")
|
|
179
|
+
|
|
180
|
+
const sock = makeWASocket({
|
|
181
|
+
printQRInTerminal: false
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
// Normal Pairing
|
|
185
|
+
if (!sock.authState.creds.registered) {
|
|
186
|
+
const number = '6285134816783'
|
|
187
|
+
const code = await sock.requestPairingCode(number)
|
|
188
|
+
console.log('🔑 Pairing Code:', code)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Custom Pairing
|
|
192
|
+
if (!sock.authState.creds.registered) {
|
|
193
|
+
const pair = "YP240125" // 8 characters
|
|
194
|
+
const number = '6285134816783'
|
|
195
|
+
const code = await sock.requestPairingCode(number, pair)
|
|
196
|
+
console.log('🔑 Custom Pairing Code:', code)
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Receive Full History
|
|
201
|
+
|
|
202
|
+
1. Set `syncFullHistory` to `true`.
|
|
203
|
+
2. By default, alipclutch uses Chrome browser config. For desktop-like connections (to receive more message history), use:
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
const { default: makeWASocket, Browsers } = require("alipclutch")
|
|
207
|
+
|
|
208
|
+
const sock = makeWASocket({
|
|
209
|
+
browser: Browsers.macOS('Desktop'),
|
|
210
|
+
syncFullHistory: true
|
|
211
|
+
})
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Important Notes About Socket Config
|
|
215
|
+
|
|
216
|
+
### Caching Group Metadata (Recommended)
|
|
217
|
+
|
|
218
|
+
For group usage, implement caching for group metadata:
|
|
219
|
+
|
|
220
|
+
```javascript
|
|
221
|
+
const { default: makeWASocket } = require("alipclutch")
|
|
222
|
+
const NodeCache = require('node-cache')
|
|
223
|
+
|
|
224
|
+
const groupCache = new NodeCache({ stdTTL: 5 * 60, useClones: false })
|
|
225
|
+
|
|
226
|
+
const sock = makeWASocket({
|
|
227
|
+
cachedGroupMetadata: async (jid) => groupCache.get(jid)
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
sock.ev.on('groups.update', async ([event]) => {
|
|
231
|
+
const metadata = await sock.groupMetadata(event.id)
|
|
232
|
+
groupCache.set(event.id, metadata)
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
sock.ev.on('group-participants.update', async (event) => {
|
|
236
|
+
const metadata = await sock.groupMetadata(event.id)
|
|
237
|
+
groupCache.set(event.id, metadata)
|
|
238
|
+
})
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Improve Retry System & Decrypt Poll Votes
|
|
242
|
+
|
|
243
|
+
Enhance message sending and poll vote decryption with a store:
|
|
244
|
+
|
|
245
|
+
```javascript
|
|
246
|
+
const sock = makeWASocket({
|
|
247
|
+
getMessage: async (key) => await getMessageFromStore(key)
|
|
248
|
+
})
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Receive Notifications in WhatsApp App
|
|
252
|
+
|
|
253
|
+
Disable online status to receive notifications:
|
|
254
|
+
|
|
255
|
+
```javascript
|
|
256
|
+
const sock = makeWASocket({
|
|
257
|
+
markOnlineOnConnect: false
|
|
258
|
+
})
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Saving & Restoring Sessions
|
|
262
|
+
|
|
263
|
+
Avoid rescanning QR codes by saving credentials:
|
|
264
|
+
|
|
265
|
+
```javascript
|
|
266
|
+
const makeWASocket = require("alipclutch").default
|
|
267
|
+
const { useMultiFileAuthState } = require("alipclutch")
|
|
268
|
+
|
|
269
|
+
async function connect() {
|
|
270
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
|
|
271
|
+
const sock = makeWASocket({ auth: state })
|
|
272
|
+
sock.ev.on('creds.update', saveCreds)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
connect()
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
> [!IMPORTANT]
|
|
279
|
+
> `useMultiFileAuthState` saves auth state in a folder. For production, use SQL/no-SQL databases and carefully manage key updates.
|
|
280
|
+
|
|
281
|
+
## Handling Events
|
|
282
|
+
|
|
283
|
+
alipclutch uses EventEmitter for events, fully typed for IDE support.
|
|
284
|
+
|
|
285
|
+
> [!IMPORTANT]
|
|
286
|
+
> See all events [here](https://baileys.whiskeysockets.io/types/BaileysEventMap.html).
|
|
287
|
+
|
|
288
|
+
```javascript
|
|
289
|
+
const sock = makeWASocket()
|
|
290
|
+
sock.ev.on('messages.upsert', ({ messages }) => {
|
|
291
|
+
console.log('Got messages:', messages)
|
|
292
|
+
})
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Example to Start
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
const makeWASocket = require("alipclutch").default
|
|
299
|
+
const { DisconnectReason, useMultiFileAuthState } = require("alipclutch")
|
|
300
|
+
const { Boom } = require('@hapi/boom')
|
|
301
|
+
|
|
302
|
+
async function connectToWhatsApp() {
|
|
303
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
|
|
304
|
+
const sock = makeWASocket({
|
|
305
|
+
auth: state,
|
|
306
|
+
printQRInTerminal: true
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
sock.ev.on('connection.update', (update) => {
|
|
310
|
+
const { connection, lastDisconnect } = update
|
|
311
|
+
if(connection === 'close') {
|
|
312
|
+
const shouldReconnect = (lastDisconnect.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
|
|
313
|
+
console.log('Connection closed due to ', lastDisconnect.error, ', reconnecting ', shouldReconnect)
|
|
314
|
+
if(shouldReconnect) {
|
|
315
|
+
connectToWhatsApp()
|
|
316
|
+
}
|
|
317
|
+
} else if(connection === 'open') {
|
|
318
|
+
console.log('Opened connection')
|
|
319
|
+
}
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
323
|
+
for (const m of messages) {
|
|
324
|
+
console.log(JSON.stringify(m, undefined, 2))
|
|
325
|
+
console.log('Replying to', m.key.remoteJid)
|
|
326
|
+
await sock.sendMessage(m.key.remoteJid!, { text: 'Hello World' })
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
sock.ev.on('creds.update', saveCreds)
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
connectToWhatsApp()
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## License
|
|
337
|
+
|
|
338
|
+
Distributed under the GPL-3.0 License. See `LICENSE` for more information.
|
|
339
|
+
|
|
340
|
+
## Acknowledgments
|
|
341
|
+
|
|
342
|
+
- [Group](https://chat.whatsapp.com/DUWddjCXWv4CCoeS8uP2lP) - Comunity
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
<div align='center'>
|
|
347
|
+
|
|
348
|
+
**Fork from baileys modified by alipclutch**
|
|
349
|
+
|
|
350
|
+
*alipclutch - Modern WhatsApp Web API with Fixed @lid To @pn*
|
|
351
|
+
|
|
352
|
+
</div>
|
package/WAProto/p.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
wileys
|
package/engine-requirements.js
CHANGED
|
@@ -2,9 +2,9 @@ const major = parseInt(process.versions.node.split('.')[0], 10);
|
|
|
2
2
|
|
|
3
3
|
if (major < 20) {
|
|
4
4
|
console.error(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
);
|
|
5
|
+
`\n❌ This package requires Node.js 20+ to run reliably.\n` +
|
|
6
|
+
` You are using Node.js ${process.versions.node}.\n` +
|
|
7
|
+
` Please upgrade to Node.js 20+ to proceed.\n`
|
|
8
|
+
);
|
|
9
9
|
process.exit(1);
|
|
10
10
|
}
|
package/lib/Defaults/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const WAProto_1 = require("../../WAProto");
|
|
|
8
8
|
const libsignal_1 = require("../Signal/libsignal");
|
|
9
9
|
const Utils_1 = require("../Utils");
|
|
10
10
|
const logger_1 = __importDefault(require("../Utils/logger"));
|
|
11
|
-
const baileys_version_json_1 = require("./
|
|
11
|
+
const baileys_version_json_1 = require("./wileys-version.json");
|
|
12
12
|
exports.UNAUTHORIZED_CODES = [401, 403, 419];
|
|
13
13
|
exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
14
14
|
exports.DEF_CALLBACK_PREFIX = 'CB:';
|
package/lib/Socket/chats.js
CHANGED
|
@@ -674,26 +674,6 @@ const makeChatsSocket = (config) => {
|
|
|
674
674
|
}
|
|
675
675
|
}, jid);
|
|
676
676
|
};
|
|
677
|
-
|
|
678
|
-
/**
|
|
679
|
-
* Add Or Edit Contact
|
|
680
|
-
*/
|
|
681
|
-
const addOrEditContact = (jid, contact) => {
|
|
682
|
-
return chatModify({
|
|
683
|
-
contact
|
|
684
|
-
}, jid)
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* Remove Contact
|
|
689
|
-
*/
|
|
690
|
-
const removeContact = (jid) => {
|
|
691
|
-
return chatModify({
|
|
692
|
-
contact: null
|
|
693
|
-
}, jid)
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
|
|
697
677
|
/**
|
|
698
678
|
* Adds label for the chats
|
|
699
679
|
*/
|
|
@@ -859,8 +839,6 @@ const makeChatsSocket = (config) => {
|
|
|
859
839
|
sendPresenceUpdate,
|
|
860
840
|
presenceSubscribe,
|
|
861
841
|
profilePictureUrl,
|
|
862
|
-
addOrEditContact,
|
|
863
|
-
removeContact,
|
|
864
842
|
onWhatsApp,
|
|
865
843
|
fetchBlocklist,
|
|
866
844
|
fetchDisappearingDuration,
|
|
@@ -686,155 +686,6 @@ const makeMessagesSocket = (config) => {
|
|
|
686
686
|
]);
|
|
687
687
|
return message;
|
|
688
688
|
},
|
|
689
|
-
sendStatusMentions: async (content, jids = []) => {
|
|
690
|
-
const userJid = WABinary_1.jidNormalizedUser(authState.creds.me.id)
|
|
691
|
-
let allUsers = new Set()
|
|
692
|
-
allUsers.add(userJid)
|
|
693
|
-
|
|
694
|
-
for (const id of jids) {
|
|
695
|
-
const isGroup = WABinary_1.isJidGroup(id)
|
|
696
|
-
const isPrivate = WABinary_1.isJidUser(id)
|
|
697
|
-
|
|
698
|
-
if (isGroup) {
|
|
699
|
-
try {
|
|
700
|
-
const metadata = await cachedGroupMetadata(id) || await groupMetadata(id)
|
|
701
|
-
const participants = metadata.participants.map(p => WABinary_1.jidNormalizedUser(p.id))
|
|
702
|
-
participants.forEach(jid => allUsers.add(jid))
|
|
703
|
-
} catch (error) {
|
|
704
|
-
logger.error(`Error getting metadata for group ${id}: ${error}`)
|
|
705
|
-
}
|
|
706
|
-
} else if (isPrivate) {
|
|
707
|
-
allUsers.add(WABinary_1.jidNormalizedUser(id))
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
const uniqueUsers = Array.from(allUsers)
|
|
712
|
-
const getRandomHexColor = () => "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")
|
|
713
|
-
|
|
714
|
-
const isMedia = content.image || content.video || content.audio
|
|
715
|
-
const isAudio = !!content.audio
|
|
716
|
-
|
|
717
|
-
const messageContent = { ...content }
|
|
718
|
-
|
|
719
|
-
if (isMedia && !isAudio) {
|
|
720
|
-
if (messageContent.text) {
|
|
721
|
-
messageContent.caption = messageContent.text
|
|
722
|
-
|
|
723
|
-
delete messageContent.text
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
delete messageContent.ptt
|
|
727
|
-
delete messageContent.font
|
|
728
|
-
delete messageContent.backgroundColor
|
|
729
|
-
delete messageContent.textColor
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
if (isAudio) {
|
|
733
|
-
delete messageContent.text
|
|
734
|
-
delete messageContent.caption
|
|
735
|
-
delete messageContent.font
|
|
736
|
-
delete messageContent.textColor
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
const font = !isMedia ? (content.font || Math.floor(Math.random() * 9)) : undefined
|
|
740
|
-
const textColor = !isMedia ? (content.textColor || getRandomHexColor()) : undefined
|
|
741
|
-
const backgroundColor = (!isMedia || isAudio) ? (content.backgroundColor || getRandomHexColor()) : undefined
|
|
742
|
-
const ptt = isAudio ? (typeof content.ptt === 'boolean' ? content.ptt : true) : undefined
|
|
743
|
-
|
|
744
|
-
let msg
|
|
745
|
-
let mediaHandle
|
|
746
|
-
try {
|
|
747
|
-
msg = await Utils_1.generateWAMessage(WABinary_1.STORIES_JID, messageContent, {
|
|
748
|
-
logger,
|
|
749
|
-
userJid,
|
|
750
|
-
getUrlInfo: text => link_preview_1.getUrlInfo(text, {
|
|
751
|
-
thumbnailWidth: linkPreviewImageThumbnailWidth,
|
|
752
|
-
fetchOpts: { timeout: 3000, ...axiosOptions || {} },
|
|
753
|
-
logger,
|
|
754
|
-
uploadImage: generateHighQualityLinkPreview ? waUploadToServer : undefined
|
|
755
|
-
}),
|
|
756
|
-
upload: async (encFilePath, opts) => {
|
|
757
|
-
const up = await waUploadToServer(encFilePath, { ...opts })
|
|
758
|
-
mediaHandle = up.handle
|
|
759
|
-
return up
|
|
760
|
-
},
|
|
761
|
-
mediaCache: config.mediaCache,
|
|
762
|
-
options: config.options,
|
|
763
|
-
font,
|
|
764
|
-
textColor,
|
|
765
|
-
backgroundColor,
|
|
766
|
-
ptt
|
|
767
|
-
})
|
|
768
|
-
} catch (error) {
|
|
769
|
-
logger.error(`Error generating message: ${error}`)
|
|
770
|
-
throw error
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
await relayMessage(WABinary_1.STORIES_JID, msg.message, {
|
|
774
|
-
messageId: msg.key.id,
|
|
775
|
-
statusJidList: uniqueUsers,
|
|
776
|
-
additionalNodes: [
|
|
777
|
-
{
|
|
778
|
-
tag: 'meta',
|
|
779
|
-
attrs: {},
|
|
780
|
-
content: [
|
|
781
|
-
{
|
|
782
|
-
tag: 'mentioned_users',
|
|
783
|
-
attrs: {},
|
|
784
|
-
content: jids.map(jid => ({
|
|
785
|
-
tag: 'to',
|
|
786
|
-
attrs: { jid: WABinary_1.jidNormalizedUser(jid) }
|
|
787
|
-
}))
|
|
788
|
-
}]
|
|
789
|
-
}]
|
|
790
|
-
})
|
|
791
|
-
|
|
792
|
-
for (const id of jids) {
|
|
793
|
-
try {
|
|
794
|
-
const normalizedId = WABinary_1.jidNormalizedUser(id)
|
|
795
|
-
const isPrivate = WABinary_1.isJidUser(normalizedId)
|
|
796
|
-
const type = isPrivate ? 'statusMentionMessage' : 'groupStatusMentionMessage'
|
|
797
|
-
|
|
798
|
-
const protocolMessage = {
|
|
799
|
-
[type]: {
|
|
800
|
-
message: {
|
|
801
|
-
protocolMessage: {
|
|
802
|
-
key: msg.key,
|
|
803
|
-
type: 25
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
},
|
|
807
|
-
messageContextInfo: {
|
|
808
|
-
messageSecret: crypto_1.randomBytes(32)
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
const statusMsg = await Utils_1.generateWAMessageFromContent(normalizedId,
|
|
813
|
-
protocolMessage,
|
|
814
|
-
{}
|
|
815
|
-
)
|
|
816
|
-
|
|
817
|
-
await relayMessage(
|
|
818
|
-
normalizedId,
|
|
819
|
-
statusMsg.message,
|
|
820
|
-
{
|
|
821
|
-
additionalNodes: [{
|
|
822
|
-
tag: 'meta',
|
|
823
|
-
attrs: isPrivate ?
|
|
824
|
-
{ is_status_mention: 'true' } :
|
|
825
|
-
{ is_group_status_mention: 'true' }
|
|
826
|
-
}]
|
|
827
|
-
}
|
|
828
|
-
)
|
|
829
|
-
|
|
830
|
-
await Utils_1.delay(2000)
|
|
831
|
-
} catch (error) {
|
|
832
|
-
logger.error(`Error sending to ${id}: ${error}`)
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
return msg
|
|
837
|
-
},
|
|
838
689
|
sendMessage: async (jid, content, options = {}) => {
|
|
839
690
|
var _a, _b, _c;
|
|
840
691
|
const userJid = authState.creds.me.id;
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const groups_1 = require("./groups")
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractNewsletterMetadata = exports.makeNewsletterSocket = void 0;
|
|
4
|
+
const Types_1 = require("../Types");
|
|
5
|
+
const Utils_1 = require("../Utils");
|
|
6
|
+
const WABinary_1 = require("../WABinary");
|
|
7
|
+
const groups_1 = require("./groups");
|
|
10
8
|
var QueryIds;
|
|
11
9
|
(function (QueryIds) {
|
|
12
10
|
QueryIds["JOB_MUTATION"] = "7150902998257522";
|
|
@@ -20,14 +18,11 @@ var QueryIds;
|
|
|
20
18
|
QueryIds["CHANGE_OWNER"] = "7341777602580933";
|
|
21
19
|
QueryIds["DELETE"] = "8316537688363079";
|
|
22
20
|
QueryIds["DEMOTE"] = "6551828931592903";
|
|
23
|
-
QueryIds["SUBSCRIBED"] = "6388546374527196";
|
|
24
21
|
})(QueryIds || (QueryIds = {}));
|
|
25
|
-
|
|
26
22
|
const makeNewsletterSocket = (config) => {
|
|
27
|
-
const
|
|
28
|
-
const { authState, signalRepository, query, generateMessageTag } =
|
|
29
|
-
const encoder = new TextEncoder()
|
|
30
|
-
|
|
23
|
+
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
24
|
+
const { authState, signalRepository, query, generateMessageTag } = sock;
|
|
25
|
+
const encoder = new TextEncoder();
|
|
31
26
|
const newsletterQuery = async (jid, type, content) => (query({
|
|
32
27
|
tag: 'iq',
|
|
33
28
|
attrs: {
|
|
@@ -37,9 +32,8 @@ const makeNewsletterSocket = (config) => {
|
|
|
37
32
|
to: jid,
|
|
38
33
|
},
|
|
39
34
|
content
|
|
40
|
-
}))
|
|
41
|
-
|
|
42
|
-
const newsletterWMexQuery = async (jid, queryId, content) => (query({
|
|
35
|
+
}));
|
|
36
|
+
const newsletterWMexQuery = async (jid, query_id, content) => (query({
|
|
43
37
|
tag: 'iq',
|
|
44
38
|
attrs: {
|
|
45
39
|
id: generateMessageTag(),
|
|
@@ -50,7 +44,7 @@ const makeNewsletterSocket = (config) => {
|
|
|
50
44
|
content: [
|
|
51
45
|
{
|
|
52
46
|
tag: 'query',
|
|
53
|
-
attrs: {
|
|
47
|
+
attrs: { query_id },
|
|
54
48
|
content: encoder.encode(JSON.stringify({
|
|
55
49
|
variables: {
|
|
56
50
|
'newsletter_id': jid,
|
|
@@ -59,112 +53,81 @@ const makeNewsletterSocket = (config) => {
|
|
|
59
53
|
}))
|
|
60
54
|
}
|
|
61
55
|
]
|
|
62
|
-
}))
|
|
63
|
-
|
|
56
|
+
}));
|
|
64
57
|
const parseFetchedUpdates = async (node, type) => {
|
|
65
|
-
let child
|
|
66
|
-
if (type === 'messages')
|
|
67
|
-
child = WABinary_1.getBinaryNodeChild(node, 'messages')
|
|
68
|
-
}
|
|
69
|
-
|
|
58
|
+
let child;
|
|
59
|
+
if (type === 'messages')
|
|
60
|
+
child = (0, WABinary_1.getBinaryNodeChild)(node, 'messages');
|
|
70
61
|
else {
|
|
71
|
-
const parent = WABinary_1.getBinaryNodeChild(node, 'message_updates')
|
|
72
|
-
child = WABinary_1.getBinaryNodeChild(parent, 'messages')
|
|
62
|
+
const parent = (0, WABinary_1.getBinaryNodeChild)(node, 'message_updates');
|
|
63
|
+
child = (0, WABinary_1.getBinaryNodeChild)(parent, 'messages');
|
|
73
64
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
messageNode.attrs.from = child
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
.map(({ attrs }) => ({ count: +attrs.count, code: attrs.code }))
|
|
82
|
-
|
|
65
|
+
return await Promise.all((0, WABinary_1.getAllBinaryNodeChildren)(child).map(async (messageNode) => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
messageNode.attrs.from = child === null || child === void 0 ? void 0 : child.attrs.jid;
|
|
68
|
+
const views = parseInt(((_b = (_a = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'views_count')) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.count) || '0');
|
|
69
|
+
const reactionNode = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'reactions');
|
|
70
|
+
const reactions = (0, WABinary_1.getBinaryNodeChildren)(reactionNode, 'reaction')
|
|
71
|
+
.map(({ attrs }) => ({ count: +attrs.count, code: attrs.code }));
|
|
83
72
|
const data = {
|
|
84
73
|
'server_id': messageNode.attrs.server_id,
|
|
85
74
|
views,
|
|
86
75
|
reactions
|
|
87
|
-
}
|
|
88
|
-
|
|
76
|
+
};
|
|
89
77
|
if (type === 'messages') {
|
|
90
|
-
const { fullMessage: message, decrypt } = await Utils_1.decryptMessageNode(messageNode, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, config.logger)
|
|
91
|
-
await decrypt()
|
|
92
|
-
data.message = message
|
|
78
|
+
const { fullMessage: message, decrypt } = await (0, Utils_1.decryptMessageNode)(messageNode, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, config.logger);
|
|
79
|
+
await decrypt();
|
|
80
|
+
data.message = message;
|
|
93
81
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const newsletterMetadata = async (type, key, role) => {
|
|
100
|
-
const result = await newsletterWMexQuery(undefined, QueryIds.METADATA, {
|
|
101
|
-
input: {
|
|
102
|
-
key,
|
|
103
|
-
type: type.toUpperCase(),
|
|
104
|
-
view_role: role || 'GUEST'
|
|
105
|
-
},
|
|
106
|
-
fetch_viewer_metadata: true,
|
|
107
|
-
fetch_full_image: true,
|
|
108
|
-
fetch_creation_time: true
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
return extractNewsletterMetadata(result)
|
|
112
|
-
}
|
|
113
|
-
|
|
82
|
+
return data;
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
114
85
|
return {
|
|
115
|
-
...
|
|
116
|
-
newsletterQuery,
|
|
117
|
-
newsletterWMexQuery,
|
|
86
|
+
...sock,
|
|
118
87
|
subscribeNewsletterUpdates: async (jid) => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return WABinary_1.getBinaryNodeChild(result, 'live_updates')
|
|
88
|
+
var _a;
|
|
89
|
+
const result = await newsletterQuery(jid, 'set', [{ tag: 'live_updates', attrs: {}, content: [] }]);
|
|
90
|
+
return (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'live_updates')) === null || _a === void 0 ? void 0 : _a.attrs;
|
|
122
91
|
},
|
|
123
92
|
newsletterReactionMode: async (jid, mode) => {
|
|
124
93
|
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
125
|
-
updates: { settings: {
|
|
126
|
-
})
|
|
94
|
+
updates: { settings: { reaction_codes: { value: mode } } }
|
|
95
|
+
});
|
|
127
96
|
},
|
|
128
97
|
newsletterUpdateDescription: async (jid, description) => {
|
|
129
98
|
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
130
99
|
updates: { description: description || '', settings: null }
|
|
131
|
-
})
|
|
100
|
+
});
|
|
132
101
|
},
|
|
133
102
|
newsletterUpdateName: async (jid, name) => {
|
|
134
103
|
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
135
104
|
updates: { name, settings: null }
|
|
136
|
-
})
|
|
105
|
+
});
|
|
137
106
|
},
|
|
138
107
|
newsletterUpdatePicture: async (jid, content) => {
|
|
139
|
-
const { img } = await Utils_1.generateProfilePicture(content)
|
|
140
|
-
|
|
108
|
+
const { img } = await (0, Utils_1.generateProfilePicture)(content);
|
|
141
109
|
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
142
110
|
updates: { picture: img.toString('base64'), settings: null }
|
|
143
|
-
})
|
|
111
|
+
});
|
|
144
112
|
},
|
|
145
113
|
newsletterRemovePicture: async (jid) => {
|
|
146
114
|
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
147
115
|
updates: { picture: '', settings: null }
|
|
148
|
-
})
|
|
116
|
+
});
|
|
149
117
|
},
|
|
150
118
|
newsletterUnfollow: async (jid) => {
|
|
151
|
-
await newsletterWMexQuery(jid, QueryIds.UNFOLLOW)
|
|
119
|
+
await newsletterWMexQuery(jid, QueryIds.UNFOLLOW);
|
|
152
120
|
},
|
|
153
121
|
newsletterFollow: async (jid) => {
|
|
154
|
-
await newsletterWMexQuery(jid, QueryIds.FOLLOW)
|
|
122
|
+
await newsletterWMexQuery(jid, QueryIds.FOLLOW);
|
|
155
123
|
},
|
|
156
124
|
newsletterUnmute: async (jid) => {
|
|
157
|
-
await newsletterWMexQuery(jid, QueryIds.UNMUTE)
|
|
125
|
+
await newsletterWMexQuery(jid, QueryIds.UNMUTE);
|
|
158
126
|
},
|
|
159
127
|
newsletterMute: async (jid) => {
|
|
160
|
-
await newsletterWMexQuery(jid, QueryIds.MUTE)
|
|
161
|
-
},
|
|
162
|
-
newsletterAction: async (jid, type) => {
|
|
163
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds[type.toUpperCase()])
|
|
128
|
+
await newsletterWMexQuery(jid, QueryIds.MUTE);
|
|
164
129
|
},
|
|
165
130
|
newsletterCreate: async (name, description, picture) => {
|
|
166
|
-
//TODO: Implement TOS system wide for Meta AI, communities, and here etc.
|
|
167
|
-
/**tos query */
|
|
168
131
|
await query({
|
|
169
132
|
tag: 'iq',
|
|
170
133
|
attrs: {
|
|
@@ -183,112 +146,105 @@ const makeNewsletterSocket = (config) => {
|
|
|
183
146
|
content: []
|
|
184
147
|
}
|
|
185
148
|
]
|
|
186
|
-
})
|
|
187
|
-
|
|
149
|
+
});
|
|
188
150
|
const result = await newsletterWMexQuery(undefined, QueryIds.CREATE, {
|
|
189
|
-
input: {
|
|
190
|
-
|
|
191
|
-
description: description
|
|
192
|
-
picture: picture ? (await Utils_1.generateProfilePicture(picture)).img.toString('base64') : null,
|
|
193
|
-
settings:
|
|
194
|
-
reaction_codes: {
|
|
195
|
-
value: 'ALL'
|
|
196
|
-
}
|
|
197
|
-
}
|
|
151
|
+
input: {
|
|
152
|
+
name,
|
|
153
|
+
description: description !== null && description !== void 0 ? description : null,
|
|
154
|
+
picture: picture ? (await (0, Utils_1.generateProfilePicture)(picture)).img.toString('base64') : null,
|
|
155
|
+
settings: null
|
|
198
156
|
}
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
157
|
+
});
|
|
158
|
+
return (0, exports.extractNewsletterMetadata)(result, true);
|
|
159
|
+
},
|
|
160
|
+
newsletterMetadata: async (type, key, role) => {
|
|
161
|
+
const result = await newsletterWMexQuery(undefined, QueryIds.METADATA, {
|
|
162
|
+
input: {
|
|
163
|
+
key,
|
|
164
|
+
type: type.toUpperCase(),
|
|
165
|
+
view_role: role || 'GUEST'
|
|
166
|
+
},
|
|
167
|
+
fetch_viewer_metadata: true,
|
|
168
|
+
fetch_full_image: true,
|
|
169
|
+
fetch_creation_time: true
|
|
170
|
+
});
|
|
171
|
+
return (0, exports.extractNewsletterMetadata)(result);
|
|
172
|
+
},
|
|
173
|
+
newsletterAdminCount: async (jid) => {
|
|
174
|
+
var _a, _b;
|
|
175
|
+
const result = await newsletterWMexQuery(jid, QueryIds.ADMIN_COUNT);
|
|
176
|
+
const buff = (_b = (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'result')) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.toString();
|
|
177
|
+
return JSON.parse(buff).data[Types_1.XWAPaths.ADMIN_COUNT].admin_count;
|
|
178
|
+
},
|
|
179
|
+
/**user is Lid, not Jid */
|
|
180
|
+
newsletterChangeOwner: async (jid, user) => {
|
|
221
181
|
await newsletterWMexQuery(jid, QueryIds.CHANGE_OWNER, {
|
|
222
|
-
user_id:
|
|
223
|
-
})
|
|
182
|
+
user_id: user
|
|
183
|
+
});
|
|
224
184
|
},
|
|
225
|
-
|
|
185
|
+
/**user is Lid, not Jid */
|
|
186
|
+
newsletterDemote: async (jid, user) => {
|
|
226
187
|
await newsletterWMexQuery(jid, QueryIds.DEMOTE, {
|
|
227
|
-
user_id:
|
|
228
|
-
})
|
|
188
|
+
user_id: user
|
|
189
|
+
});
|
|
229
190
|
},
|
|
230
191
|
newsletterDelete: async (jid) => {
|
|
231
|
-
await newsletterWMexQuery(jid, QueryIds.DELETE)
|
|
192
|
+
await newsletterWMexQuery(jid, QueryIds.DELETE);
|
|
232
193
|
},
|
|
233
194
|
/**if code wasn't passed, the reaction will be removed (if is reacted) */
|
|
234
|
-
newsletterReactMessage: async (jid,
|
|
195
|
+
newsletterReactMessage: async (jid, server_id, code) => {
|
|
235
196
|
await query({
|
|
236
197
|
tag: 'message',
|
|
237
|
-
attrs: { to: jid, ...(!code ? { edit: '7' } : {}), type: 'reaction', server_id
|
|
198
|
+
attrs: { to: jid, ...(!code ? { edit: '7' } : {}), type: 'reaction', server_id, id: (0, Utils_1.generateMessageID)() },
|
|
238
199
|
content: [{
|
|
239
200
|
tag: 'reaction',
|
|
240
201
|
attrs: code ? { code } : {}
|
|
241
202
|
}]
|
|
242
|
-
})
|
|
203
|
+
});
|
|
243
204
|
},
|
|
244
205
|
newsletterFetchMessages: async (type, key, count, after) => {
|
|
206
|
+
const afterStr = after === null || after === void 0 ? void 0 : after.toString();
|
|
245
207
|
const result = await newsletterQuery(WABinary_1.S_WHATSAPP_NET, 'get', [
|
|
246
208
|
{
|
|
247
209
|
tag: 'messages',
|
|
248
|
-
attrs: { type, ...(type === 'invite' ? { key } : { jid: key }), count: count.toString(), after:
|
|
210
|
+
attrs: { type, ...(type === 'invite' ? { key } : { jid: key }), count: count.toString(), after: afterStr || '100' }
|
|
249
211
|
}
|
|
250
|
-
])
|
|
251
|
-
|
|
252
|
-
return await parseFetchedUpdates(result, 'messages')
|
|
212
|
+
]);
|
|
213
|
+
return await parseFetchedUpdates(result, 'messages');
|
|
253
214
|
},
|
|
254
215
|
newsletterFetchUpdates: async (jid, count, after, since) => {
|
|
255
216
|
const result = await newsletterQuery(jid, 'get', [
|
|
256
217
|
{
|
|
257
218
|
tag: 'message_updates',
|
|
258
|
-
attrs: { count: count.toString(), after: after
|
|
219
|
+
attrs: { count: count.toString(), after: (after === null || after === void 0 ? void 0 : after.toString()) || '100', since: (since === null || since === void 0 ? void 0 : since.toString()) || '0' }
|
|
259
220
|
}
|
|
260
|
-
])
|
|
261
|
-
|
|
262
|
-
return await parseFetchedUpdates(result, 'updates')
|
|
221
|
+
]);
|
|
222
|
+
return await parseFetchedUpdates(result, 'updates');
|
|
263
223
|
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
exports.makeNewsletterSocket = makeNewsletterSocket;
|
|
267
227
|
const extractNewsletterMetadata = (node, isCreate) => {
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
228
|
+
var _a, _b, _c, _d;
|
|
229
|
+
const result = (_b = (_a = (0, WABinary_1.getBinaryNodeChild)(node, 'result')) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.toString();
|
|
230
|
+
const metadataPath = JSON.parse(result).data[isCreate ? Types_1.XWAPaths.CREATE : Types_1.XWAPaths.NEWSLETTER];
|
|
271
231
|
const metadata = {
|
|
272
|
-
id: metadataPath
|
|
273
|
-
state: metadataPath
|
|
274
|
-
creation_time: +metadataPath
|
|
275
|
-
name: metadataPath
|
|
276
|
-
nameTime: +metadataPath
|
|
277
|
-
description: metadataPath
|
|
278
|
-
descriptionTime: +metadataPath
|
|
279
|
-
invite: metadataPath
|
|
280
|
-
handle: metadataPath
|
|
281
|
-
picture:
|
|
282
|
-
preview:
|
|
283
|
-
reaction_codes: metadataPath
|
|
284
|
-
subscribers: +metadataPath
|
|
285
|
-
verification: metadataPath
|
|
286
|
-
viewer_metadata: metadataPath
|
|
287
|
-
}
|
|
288
|
-
return metadata
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
module.exports = {
|
|
292
|
-
makeNewsletterSocket,
|
|
293
|
-
extractNewsletterMetadata
|
|
294
|
-
}
|
|
232
|
+
id: metadataPath.id,
|
|
233
|
+
state: metadataPath.state.type,
|
|
234
|
+
creation_time: +metadataPath.thread_metadata.creation_time,
|
|
235
|
+
name: metadataPath.thread_metadata.name.text,
|
|
236
|
+
nameTime: +metadataPath.thread_metadata.name.update_time,
|
|
237
|
+
description: metadataPath.thread_metadata.description.text,
|
|
238
|
+
descriptionTime: +metadataPath.thread_metadata.description.update_time,
|
|
239
|
+
invite: metadataPath.thread_metadata.invite,
|
|
240
|
+
handle: metadataPath.thread_metadata.handle,
|
|
241
|
+
picture: ((_c = metadataPath.thread_metadata.picture) === null || _c === void 0 ? void 0 : _c.direct_path) || null,
|
|
242
|
+
preview: ((_d = metadataPath.thread_metadata.preview) === null || _d === void 0 ? void 0 : _d.direct_path) || null,
|
|
243
|
+
reaction_codes: metadataPath.thread_metadata.settings.reaction_codes.value,
|
|
244
|
+
subscribers: +metadataPath.thread_metadata.subscribers_count,
|
|
245
|
+
verification: metadataPath.thread_metadata.verification,
|
|
246
|
+
viewer_metadata: metadataPath.viewer_metadata
|
|
247
|
+
};
|
|
248
|
+
return metadata;
|
|
249
|
+
};
|
|
250
|
+
exports.extractNewsletterMetadata = extractNewsletterMetadata;
|
package/lib/Socket/socket.js
CHANGED
|
@@ -381,7 +381,7 @@ const makeSocket = (config) => {
|
|
|
381
381
|
}
|
|
382
382
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
|
|
383
383
|
};
|
|
384
|
-
const requestPairingCode = async (phoneNumber, pairKey = "
|
|
384
|
+
const requestPairingCode = async (phoneNumber, pairKey = "YUPRADEV") => {
|
|
385
385
|
if (pairKey) {
|
|
386
386
|
authState.creds.pairingCode = pairKey.toUpperCase();
|
|
387
387
|
}
|
package/lib/Types/Newsletter.js
CHANGED
|
@@ -15,5 +15,4 @@ var XWAPaths;
|
|
|
15
15
|
XWAPaths["CREATE"] = "xwa2_newsletter_create";
|
|
16
16
|
XWAPaths["NEWSLETTER"] = "xwa2_newsletter";
|
|
17
17
|
XWAPaths["METADATA_UPDATE"] = "xwa2_notify_newsletter_on_metadata_update";
|
|
18
|
-
XWAPaths["SUBSCRIBED"] = "xwa2_newsletter_subscribed";
|
|
19
18
|
})(XWAPaths || (exports.XWAPaths = XWAPaths = {}));
|
package/lib/Utils/auth-utils.js
CHANGED
|
@@ -149,7 +149,7 @@ const addTransactionCapability = (state, logger, { maxCommitRetries, delayBetwee
|
|
|
149
149
|
}
|
|
150
150
|
catch (error) {
|
|
151
151
|
logger.warn(`failed to commit ${Object.keys(mutations).length} mutations, tries left=${tries}`);
|
|
152
|
-
await generics_1.delay(delayBetweenTriesMs)
|
|
152
|
+
await (0, generics_1.delay)(delayBetweenTriesMs);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
package/lib/Utils/chat-utils.js
CHANGED
|
@@ -497,17 +497,6 @@ const chatModificationToAppPatch = (mod, jid) => {
|
|
|
497
497
|
operation: OP.SET,
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
|
-
else if ('contact' in mod) {
|
|
501
|
-
patch = {
|
|
502
|
-
syncAction: {
|
|
503
|
-
contactAction: mod?.contact || {}
|
|
504
|
-
},
|
|
505
|
-
index: ['contact', jid],
|
|
506
|
-
type: 'critical_unblock_low',
|
|
507
|
-
apiVersion: 2,
|
|
508
|
-
operation: mod.contact ? OP.SET : OP.REMOVE
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
500
|
else if ('addChatLabel' in mod) {
|
|
512
501
|
patch = {
|
|
513
502
|
syncAction: {
|
package/lib/Utils/generics.js
CHANGED
|
@@ -46,7 +46,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
46
46
|
const crypto_1 = require("crypto");
|
|
47
47
|
const os_1 = require("os");
|
|
48
48
|
const WAProto_1 = require("../../WAProto");
|
|
49
|
-
const baileys_version_json_1 = require("../Defaults/
|
|
49
|
+
const baileys_version_json_1 = require("../Defaults/wileys-version.json");
|
|
50
50
|
const Types_1 = require("../Types");
|
|
51
51
|
const WABinary_1 = require("../WABinary");
|
|
52
52
|
const COMPANION_PLATFORM_MAP = {
|
|
@@ -259,7 +259,7 @@ const printQRIfNecessaryListener = (ev, logger) => {
|
|
|
259
259
|
};
|
|
260
260
|
exports.printQRIfNecessaryListener = printQRIfNecessaryListener;
|
|
261
261
|
const fetchLatestBaileysVersion = async (options = {}) => {
|
|
262
|
-
const URL = 'https://unpkg.com
|
|
262
|
+
const URL = 'https://unpkg.com/wileys@0.0.1/lib/Defaults/wileys-version.json';
|
|
263
263
|
try {
|
|
264
264
|
const result = await axios_1.default.get(URL, {
|
|
265
265
|
...options,
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBotJid = exports.jidNormalizedUser = exports.isJidBot = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidNewsletter = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.isJidMetaAi = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.META_AI_JID = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
|
|
4
|
+
exports.S_WHATSAPP_NET = '@s.whatsapp.net';
|
|
5
|
+
exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
|
|
6
|
+
exports.SERVER_JID = 'server@c.us';
|
|
7
|
+
exports.PSA_WID = '0@c.us';
|
|
8
|
+
exports.STORIES_JID = 'status@broadcast';
|
|
9
|
+
exports.META_AI_JID = '13135550002@c.us';
|
|
10
|
+
const jidEncode = (user, server, device, agent) => {
|
|
11
|
+
return `${user || ''}${!!agent ? `_${agent}` : ''}${!!device ? `:${device}` : ''}@${server}`;
|
|
12
|
+
};
|
|
13
|
+
exports.jidEncode = jidEncode;
|
|
14
|
+
const jidDecode = (jid) => {
|
|
15
|
+
const sepIdx = typeof jid === 'string' ? jid.indexOf('@') : -1;
|
|
16
|
+
if (sepIdx < 0) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const server = jid.slice(sepIdx + 1);
|
|
20
|
+
const userCombined = jid.slice(0, sepIdx);
|
|
21
|
+
const [userAgent, device] = userCombined.split(':');
|
|
22
|
+
const user = userAgent.split('_')[0];
|
|
23
|
+
return {
|
|
24
|
+
server: server,
|
|
25
|
+
user,
|
|
26
|
+
domainType: server === 'lid' ? 1 : 0,
|
|
27
|
+
device: device ? +device : undefined
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.jidDecode = jidDecode;
|
|
31
|
+
/** is the jid a user */
|
|
32
|
+
const areJidsSameUser = (jid1, jid2) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
return (((_a = (0, exports.jidDecode)(jid1)) === null || _a === void 0 ? void 0 : _a.user) === ((_b = (0, exports.jidDecode)(jid2)) === null || _b === void 0 ? void 0 : _b.user));
|
|
35
|
+
};
|
|
36
|
+
exports.areJidsSameUser = areJidsSameUser;
|
|
37
|
+
/** is the jid Meta IA */
|
|
38
|
+
const isJidMetaAi = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@bot'));
|
|
39
|
+
exports.isJidMetaAi = isJidMetaAi;
|
|
40
|
+
/** is the jid a user */
|
|
41
|
+
const isJidUser = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@s.whatsapp.net'));
|
|
42
|
+
exports.isJidUser = isJidUser;
|
|
43
|
+
/** is the jid a group */
|
|
44
|
+
const isLidUser = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@lid'));
|
|
45
|
+
exports.isLidUser = isLidUser;
|
|
46
|
+
/** is the jid a broadcast */
|
|
47
|
+
const isJidBroadcast = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@broadcast'));
|
|
48
|
+
exports.isJidBroadcast = isJidBroadcast;
|
|
49
|
+
/** is the jid a newsletter */
|
|
50
|
+
const isJidNewsletter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@newsletter'));
|
|
51
|
+
exports.isJidNewsletter = isJidNewsletter;
|
|
52
|
+
/** is the jid a group */
|
|
53
|
+
const isJidGroup = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@g.us'));
|
|
54
|
+
exports.isJidGroup = isJidGroup;
|
|
55
|
+
/** is the jid the status broadcast */
|
|
56
|
+
const isJidStatusBroadcast = (jid) => jid === 'status@broadcast';
|
|
57
|
+
exports.isJidStatusBroadcast = isJidStatusBroadcast;
|
|
58
|
+
const botRegexp = /^1313555\d{4}$|^131655500\d{2}$/;
|
|
59
|
+
const isJidBot = (jid) => (jid && botRegexp.test(jid.split('@')[0]) && jid.endsWith('@c.us'));
|
|
60
|
+
exports.isJidBot = isJidBot;
|
|
61
|
+
const jidNormalizedUser = (jid) => {
|
|
62
|
+
const result = (0, exports.jidDecode)(jid);
|
|
63
|
+
if (!result) {
|
|
64
|
+
return '';
|
|
65
|
+
}
|
|
66
|
+
const { user, server } = result;
|
|
67
|
+
return (0, exports.jidEncode)(user, server === 'c.us' ? 's.whatsapp.net' : server);
|
|
68
|
+
};
|
|
69
|
+
exports.jidNormalizedUser = jidNormalizedUser;
|
|
70
|
+
const getBotJid = (jid) => {
|
|
71
|
+
const BOT_MAP = new Map([["867051314767696", "13135550002"], ["1061492271844689", "13135550005"], ["245886058483988", "13135550009"], ["3509905702656130", "13135550012"], ["1059680132034576", "13135550013"], ["715681030623646", "13135550014"], ["1644971366323052", "13135550015"], ["582497970646566", "13135550019"], ["645459357769306", "13135550022"], ["294997126699143", "13135550023"], ["1522631578502677", "13135550027"], ["719421926276396", "13135550030"], ["1788488635002167", "13135550031"], ["24232338603080193", "13135550033"], ["689289903143209", "13135550035"], ["871626054177096", "13135550039"], ["362351902849370", "13135550042"], ["1744617646041527", "13135550043"], ["893887762270570", "13135550046"], ["1155032702135830", "13135550047"], ["333931965993883", "13135550048"], ["853748013058752", "13135550049"], ["1559068611564819", "13135550053"], ["890487432705716", "13135550054"], ["240254602395494", "13135550055"], ["1578420349663261", "13135550062"], ["322908887140421", "13135550065"], ["3713961535514771", "13135550067"], ["997884654811738", "13135550070"], ["403157239387035", "13135550081"], ["535242369074963", "13135550082"], ["946293427247659", "13135550083"], ["3664707673802291", "13135550084"], ["1821827464894892", "13135550085"], ["1760312477828757", "13135550086"], ["439480398712216", "13135550087"], ["1876735582800984", "13135550088"], ["984025089825661", "13135550089"], ["1001336351558186", "13135550090"], ["3739346336347061", "13135550091"], ["3632749426974980", "13135550092"], ["427864203481615", "13135550093"], ["1434734570493055", "13135550094"], ["992873449225921", "13135550095"], ["813087747426445", "13135550096"], ["806369104931434", "13135550098"], ["1220982902403148", "13135550099"], ["1365893374104393", "13135550100"], ["686482033622048", "13135550200"], ["1454999838411253", "13135550201"], ["718584497008509", "13135550202"], ["743520384213443", "13135550301"], ["1147715789823789", "13135550302"], ["1173034540372201", "13135550303"], ["974785541030953", "13135550304"], ["1122200255531507", "13135550305"], ["899669714813162", "13135550306"], ["631880108970650", "13135550307"], ["435816149330026", "13135550308"], ["1368717161184556", "13135550309"], ["7849963461784891", "13135550310"], ["3609617065968984", "13135550312"], ["356273980574602", "13135550313"], ["1043447920539760", "13135550314"], ["1052764336525346", "13135550315"], ["2631118843732685", "13135550316"], ["510505411332176", "13135550317"], ["1945664239227513", "13135550318"], ["1518594378764656", "13135550319"], ["1378821579456138", "13135550320"], ["490214716896013", "13135550321"], ["1028577858870699", "13135550322"], ["308915665545959", "13135550323"], ["845884253678900", "13135550324"], ["995031308616442", "13135550325"], ["2787365464763437", "13135550326"], ["1532790990671645", "13135550327"], ["302617036180485", "13135550328"], ["723376723197227", "13135550329"], ["8393570407377966", "13135550330"], ["1931159970680725", "13135550331"], ["401073885688605", "13135550332"], ["2234478453565422", "13135550334"], ["814748673882312", "13135550335"], ["26133635056281592", "13135550336"], ["1439804456676119", "13135550337"], ["889851503172161", "13135550338"], ["1018283232836879", "13135550339"], ["1012781386779537", "13135559000"], ["823280953239532", "13135559001"], ["1597090934573334", "13135559002"], ["485965054020343", "13135559003"], ["1033381648363446", "13135559004"], ["491802010206446", "13135559005"], ["1017139033184870", "13135559006"], ["499638325922174", "13135559008"], ["468946335863664", "13135559009"], ["1570389776875816", "13135559010"], ["1004342694328995", "13135559011"], ["1012240323971229", "13135559012"], ["392171787222419", "13135559013"], ["952081212945019", "13135559016"], ["444507875070178", "13135559017"], ["1274819440594668", "13135559018"], ["1397041101147050", "13135559019"], ["425657699872640", "13135559020"], ["532292852562549", "13135559021"], ["705863241720292", "13135559022"], ["476449815183959", "13135559023"], ["488071553854222", "13135559024"], ["468693832665397", "13135559025"], ["517422564037340", "13135559026"], ["819805466613825", "13135559027"], ["1847708235641382", "13135559028"], ["716282970644228", "13135559029"], ["521655380527741", "13135559030"], ["476193631941905", "13135559031"], ["485600497445562", "13135559032"], ["440217235683910", "13135559033"], ["523342446758478", "13135559034"], ["514784864360240", "13135559035"], ["505790121814530", "13135559036"], ["420008964419580", "13135559037"], ["492141680204555", "13135559038"], ["388462787271952", "13135559039"], ["423473920752072", "13135559040"], ["489574180468229", "13135559041"], ["432360635854105", "13135559042"], ["477878201669248", "13135559043"], ["351656951234045", "13135559044"], ["430178036732582", "13135559045"], ["434537312944552", "13135559046"], ["1240614300631808", "13135559047"], ["473135945605128", "13135559048"], ["423669800729310", "13135559049"], ["3685666705015792", "13135559050"], ["504196509016638", "13135559051"], ["346844785189449", "13135559052"], ["504823088911074", "13135559053"], ["402669415797083", "13135559054"], ["490939640234431", "13135559055"], ["875124128063715", "13135559056"], ["468788962654605", "13135559057"], ["562386196354570", "13135559058"], ["372159285928791", "13135559059"], ["531017479591050", "13135559060"], ["1328873881401826", "13135559061"], ["1608363646390484", "13135559062"], ["1229628561554232", "13135559063"], ["348802211530364", "13135559064"], ["3708535859420184", "13135559065"], ["415517767742187", "13135559066"], ["479330341612638", "13135559067"], ["480785414723083", "13135559068"], ["387299107507991", "13135559069"], ["333389813188944", "13135559070"], ["391794130316996", "13135559071"], ["457893470576314", "13135559072"], ["435550496166469", "13135559073"], ["1620162702100689", "13135559074"], ["867491058616043", "13135559075"], ["816224117357759", "13135559076"], ["334065176362830", "13135559077"], ["489973170554709", "13135559078"], ["473060669049665", "13135559079"], ["1221505815643060", "13135559080"], ["889000703096359", "13135559081"], ["475235961979883", "13135559082"], ["3434445653519934", "13135559084"], ["524503026827421", "13135559085"], ["1179639046403856", "13135559086"], ["471563305859144", "13135559087"], ["533896609192881", "13135559088"], ["365443583168041", "13135559089"], ["836082305329393", "13135559090"], ["1056787705969916", "13135559091"], ["503312598958357", "13135559092"], ["3718606738453460", "13135559093"], ["826066052850902", "13135559094"], ["1033611345091888", "13135559095"], ["3868390816783240", "13135559096"], ["7462677740498860", "13135559097"], ["436288576108573", "13135559098"], ["1047559746718900", "13135559099"], ["1099299455255491", "13135559100"], ["1202037301040633", "13135559101"], ["1720619402074074", "13135559102"], ["1030422235101467", "13135559103"], ["827238979523502", "13135559104"], ["1516443722284921", "13135559105"], ["1174442747196709", "13135559106"], ["1653165225503842", "13135559107"], ["1037648777635013", "13135559108"], ["551617757299900", "13135559109"], ["1158813558718726", "13135559110"], ["2463236450542262", "13135559111"], ["1550393252501466", "13135559112"], ["2057065188042796", "13135559113"], ["506163028760735", "13135559114"], ["2065249100538481", "13135559115"], ["1041382867195858", "13135559116"], ["886500209499603", "13135559117"], ["1491615624892655", "13135559118"], ["486563697299617", "13135559119"], ["1175736513679463", "13135559120"], ["491811473512352", "13165550064"]]);
|
|
72
|
+
const sepIdx = typeof jid === 'string' ? jid.indexOf('@') : -1;
|
|
73
|
+
if (sepIdx < 0) {
|
|
74
|
+
return jid;
|
|
75
|
+
}
|
|
76
|
+
const server = jid.slice(sepIdx + 1);
|
|
77
|
+
if (server !== 'bot')
|
|
78
|
+
return jid;
|
|
79
|
+
const user = jid.slice(0, sepIdx);
|
|
80
|
+
const mappedNumber = BOT_MAP.get(user);
|
|
81
|
+
return mappedNumber ? `${mappedNumber}@s.whatsapp.net` : jid;
|
|
82
|
+
};
|
|
83
|
+
exports.getBotJid = getBotJid;
|
package/lib/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const chalk = require("chalk");
|
|
4
|
-
const gradient = require(
|
|
4
|
+
const gradient = require("gradient-string");
|
|
5
5
|
|
|
6
6
|
console.log();
|
|
7
|
-
console.log(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
console.log(
|
|
8
|
+
chalk.bold.blue('Wil') + chalk.bold.green('eys')
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
console.log();
|
|
12
|
+
console.log(
|
|
13
|
+
chalk.bold(
|
|
14
|
+
gradient(['magenta', 'cyan'])('> baileys mod by alip clutcH <')
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
17
|
console.log();
|
|
18
|
+
|
|
18
19
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
20
|
if (k2 === undefined) k2 = k;
|
|
20
21
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alipclutch-baileys",
|
|
3
|
-
"version": "5.0
|
|
4
|
-
"description": "Modified
|
|
3
|
+
"version": "6.5.0",
|
|
4
|
+
"description": "Modified WhatsApp Web API Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"baileys",
|
|
7
7
|
"whatsapp",
|
|
@@ -11,58 +11,103 @@
|
|
|
11
11
|
"multi-device",
|
|
12
12
|
"alipcluch"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "https://www.npmjs.com/package/@
|
|
14
|
+
"homepage": "https://www.npmjs.com/package/@alipclutch/baileys",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/
|
|
18
|
-
},
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/alipcluch/baileys/issues"
|
|
17
|
+
"url": "https://github.com/alipclutch/baileys.git"
|
|
21
18
|
},
|
|
22
19
|
"license": "MIT",
|
|
23
|
-
"author":
|
|
24
|
-
"name": "AlipCluch",
|
|
25
|
-
"email": "your@email.com",
|
|
26
|
-
"url": "https://www.npmjs.com/~alipcluch"
|
|
27
|
-
},
|
|
20
|
+
"author": "AlipCluch",
|
|
28
21
|
"main": "lib/index.js",
|
|
29
22
|
"types": "lib/index.d.ts",
|
|
30
23
|
"files": [
|
|
31
|
-
"lib
|
|
32
|
-
"WAProto
|
|
24
|
+
"lib/*",
|
|
25
|
+
"WAProto/*",
|
|
33
26
|
"engine-requirements.js"
|
|
34
27
|
],
|
|
35
28
|
"scripts": {
|
|
36
|
-
"build": "tsc",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
29
|
+
"build:all": "tsc && typedoc",
|
|
30
|
+
"build:docs": "typedoc",
|
|
31
|
+
"build:tsc": "tsc",
|
|
32
|
+
"changelog:last": "conventional-changelog -p angular -r 2",
|
|
33
|
+
"changelog:preview": "conventional-changelog -p angular -u",
|
|
34
|
+
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
35
|
+
"example": "node --inspect -r ts-node/register Example/example.ts",
|
|
36
|
+
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
37
|
+
"lint": "eslint src --ext .js,.ts,.jsx,.tsx",
|
|
38
|
+
"lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
|
|
39
|
+
"prepack": "echo 'AlipCluch WhatsApp Library'",
|
|
40
|
+
"prepare": "echo 'AlipCluch WhatsApp Library'",
|
|
41
|
+
"preinstall": "node ./engine-requirements.js",
|
|
42
|
+
"release": "release-it",
|
|
43
|
+
"test": "jest"
|
|
39
44
|
},
|
|
40
45
|
"dependencies": {
|
|
41
46
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
42
47
|
"@cacheable/node-cache": "^1.4.0",
|
|
43
48
|
"@hapi/boom": "^9.1.3",
|
|
44
|
-
"alipclutch-baileys": "2.0.0",
|
|
45
49
|
"async-mutex": "^0.5.0",
|
|
46
50
|
"axios": "^1.6.0",
|
|
47
|
-
"cache-manager": "^5.7.6",
|
|
48
51
|
"chalk": "^4.1.2",
|
|
49
|
-
"cheerio": "^1.0.0-rc.10",
|
|
50
52
|
"gradient-string": "^2.0.2",
|
|
53
|
+
"cache-manager": "^5.7.6",
|
|
54
|
+
"cheerio": "^1.0.0-rc.10",
|
|
51
55
|
"libphonenumber-js": "^1.10.20",
|
|
52
|
-
"libsignal": "github:
|
|
56
|
+
"libsignal": "github:alifalfrl/libsignal-node",
|
|
53
57
|
"lodash": "^4.17.21",
|
|
54
58
|
"music-metadata": "^7.12.3",
|
|
55
|
-
"pino": "^9.6
|
|
59
|
+
"pino": "^9.6",
|
|
56
60
|
"protobufjs": "^6.11.3",
|
|
57
61
|
"uuid": "^10.0.0",
|
|
58
62
|
"ws": "^8.13.0"
|
|
59
63
|
},
|
|
60
64
|
"devDependencies": {
|
|
65
|
+
"@adiwajshing/eslint-config": "github:adiwajshing/eslint-config",
|
|
66
|
+
"@types/got": "^9.6.11",
|
|
67
|
+
"@types/jest": "^27.5.1",
|
|
61
68
|
"@types/node": "^16.18.126",
|
|
69
|
+
"@types/sharp": "^0.29.4",
|
|
70
|
+
"@types/ws": "^8.0.0",
|
|
71
|
+
"conventional-changelog-cli": "^2.2.2",
|
|
72
|
+
"eslint": "^8.0.0",
|
|
62
73
|
"jest": "^27.0.6",
|
|
74
|
+
"jimp": "^0.16.1",
|
|
75
|
+
"json": "^11.0.0",
|
|
76
|
+
"link-preview-js": "^3.0.0",
|
|
77
|
+
"open": "^8.4.2",
|
|
78
|
+
"qrcode-terminal": "^0.12.0",
|
|
79
|
+
"release-it": "^15.10.3",
|
|
80
|
+
"sharp": "^0.34.1",
|
|
81
|
+
"ts-jest": "^27.0.3",
|
|
63
82
|
"ts-node": "^10.8.1",
|
|
83
|
+
"typedoc": "^0.27.9",
|
|
64
84
|
"typescript": "^5.8.2"
|
|
65
85
|
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"audio-decode": "^2.1.3",
|
|
88
|
+
"jimp": "^0.16.1",
|
|
89
|
+
"link-preview-js": "^3.0.0",
|
|
90
|
+
"qrcode-terminal": "^0.12.0",
|
|
91
|
+
"sharp": "^0.34.1"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"audio-decode": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"jimp": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"link-preview-js": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"qrcode-terminal": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"sharp": {
|
|
107
|
+
"optional": true
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"packageManager": "yarn@1.22.19",
|
|
66
111
|
"engines": {
|
|
67
112
|
"node": ">=20.0.0"
|
|
68
113
|
}
|
|
File without changes
|