supunmd-bail 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +428 -0
- package/package.json +6 -2
package/README.md
ADDED
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
# <div align='center'>Baileys Modification - Supun Fernando</div>
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
<img src="https://files.catbox.moe/ehoncd.jpg" alt="Baileys Banner" />
|
|
6
|
+
|
|
7
|
+
<br><br>
|
|
8
|
+
|
|
9
|
+
<a href="https://www.npmjs.com/package/supunmd-bail">
|
|
10
|
+
<img src="https://img.shields.io/npm/v/supunmd-bail?color=red&label=Version&logo=npm" alt="npm version" />
|
|
11
|
+
</a>
|
|
12
|
+
|
|
13
|
+
<a href="https://www.npmjs.com/package/supunmd-bail">
|
|
14
|
+
<img src="https://img.shields.io/npm/dt/supunmd-bail?color=red&label=Downloads&logo=npm" alt="npm downloads" />
|
|
15
|
+
</a>
|
|
16
|
+
|
|
17
|
+
<a href="https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07">
|
|
18
|
+
<img src="https://img.shields.io/badge/WhatsApp-Channel-25D366?logo=whatsapp&logoColor=white" alt="WhatsApp Channel" />
|
|
19
|
+
</a>
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## 📖 Table of Contents
|
|
25
|
+
|
|
26
|
+
- [Important Note](#important-note)
|
|
27
|
+
- [Install](#install)
|
|
28
|
+
- [Added Features and Improvements](#-added-features-and-improvements)
|
|
29
|
+
- [Feature Examples](#feature-examples)
|
|
30
|
+
- [Newsletter Management](#newsletter-management)
|
|
31
|
+
- [Button and Interactive Message Management](#button-and-interactive-message-management)
|
|
32
|
+
- [Send Album Message](#send-album-message)
|
|
33
|
+
- [AI Message Icon Customization](#ai-message-icon-customization)
|
|
34
|
+
- [Custom Pairing Code Generation](#custom-pairing-code-generation)
|
|
35
|
+
- [Reporting Issues](#reporting-issues)
|
|
36
|
+
- [Notes](#notes)
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Important Note
|
|
40
|
+
|
|
41
|
+
The original repository was initially removed by its creator and subsequently taken over by [WhiskeySockets](https://github.com/WhiskeySockets). Building upon this foundation, I have implemented several enhancements and introduced new features that were not present in the original repository. These improvements aim to elevate functionality and provide a more robust and versatile experience.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
Install in package.json:
|
|
46
|
+
```json
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@whiskeysockets/baileys": "npm:supunmd-bail"
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
or install in terminal:
|
|
52
|
+
```
|
|
53
|
+
npm install @whiskeysockets/baileys@npm:supunmd-bail
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then import the default function in your code:
|
|
57
|
+
```ts
|
|
58
|
+
// type esm
|
|
59
|
+
import makeWASocket from '@whiskeysockets/baileys'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
// type cjs
|
|
64
|
+
const { default: makeWASocket } = require("@whiskeysockets/baileys")
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Added Features and Improvements
|
|
68
|
+
|
|
69
|
+
| Feature | Description |
|
|
70
|
+
| :------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
71
|
+
| 💬 **Send Messages to Channels** | Supports sending text and media messages to channels. |
|
|
72
|
+
| 🔘 **Button & Interactive Messages** | Supports sending button messages and interactive messages on WhatsApp Messenger and WhatsApp Business. |
|
|
73
|
+
| 🖼️ **Send Album Messages** | Supports sending multiple images as an album (grouped media message), enabling richer and more organized media sharing. |
|
|
74
|
+
| 👥 **Group with LID Support** | Full support for group using `@lid`, ensuring compatibility with the latest WhatsApp group addressing format. |
|
|
75
|
+
| 🤖 **AI Message Icon** | Customize message appearances with an optional AI icon, adding a modern touch. |
|
|
76
|
+
| 🖼️ **Full-Size Profile Pictures** | Allows users to upload profile pictures in their original size without cropping, ensuring better quality and visual presentation. |
|
|
77
|
+
| 🔑 **Custom Pairing Codes** | Users can now create and customize pairing codes as they wish, enhancing convenience and security when connecting devices. |
|
|
78
|
+
| 🛠️ **Libsignal Fixes** | Enjoy a cleaner development experience with refined logs, providing more informative and less cluttered output from the libsignal library.|
|
|
79
|
+
|
|
80
|
+
More features and improvements will be added in the future.
|
|
81
|
+
|
|
82
|
+
## Feature Examples
|
|
83
|
+
|
|
84
|
+
Here are some examples of features that have been added:
|
|
85
|
+
|
|
86
|
+
### Newsletter Management
|
|
87
|
+
|
|
88
|
+
<details>
|
|
89
|
+
<summary style="font-weight: bold; cursor: pointer; padding: 8px; border-bottom: 1px solid #eee; margin-bottom: 5px;">Show Examples</summary>
|
|
90
|
+
<div style="padding: 10px 15px; background: #f9f9f9; border: 1px solid #eee; border-top: none; border-radius: 0 0 5px 5px;">
|
|
91
|
+
|
|
92
|
+
- **To get info newsletter**
|
|
93
|
+
```ts
|
|
94
|
+
const metadata = await sock.newsletterMetadata("invite", "xxxxx")
|
|
95
|
+
// or
|
|
96
|
+
const metadata = await sock.newsletterMetadata("jid", "abcd@newsletter")
|
|
97
|
+
console.log(metadata)
|
|
98
|
+
```
|
|
99
|
+
- **To update the description of a newsletter**
|
|
100
|
+
```ts
|
|
101
|
+
await sock.newsletterUpdateDescription("abcd@newsletter", "New Description")
|
|
102
|
+
```
|
|
103
|
+
- **To update the name of a newsletter**
|
|
104
|
+
```ts
|
|
105
|
+
await sock.newsletterUpdateName("abcd@newsletter", "New Name")
|
|
106
|
+
```
|
|
107
|
+
- **To update the profile picture of a newsletter**
|
|
108
|
+
```ts
|
|
109
|
+
await sock.newsletterUpdatePicture("abcd@newsletter", buffer)
|
|
110
|
+
```
|
|
111
|
+
- **To remove the profile picture of a newsletter**
|
|
112
|
+
```ts
|
|
113
|
+
await sock.newsletterRemovePicture("abcd@newsletter")
|
|
114
|
+
```
|
|
115
|
+
- **To mute notifications for a newsletter**
|
|
116
|
+
```ts
|
|
117
|
+
await sock.newsletterUnmute("abcd@newsletter")
|
|
118
|
+
```
|
|
119
|
+
- **To mute notifications for a newsletter**
|
|
120
|
+
```ts
|
|
121
|
+
await sock.newsletterMute("abcd@newsletter")
|
|
122
|
+
```
|
|
123
|
+
- **To create a newsletter**
|
|
124
|
+
```ts
|
|
125
|
+
const metadata = await sock.newsletterCreate("Newsletter Name")
|
|
126
|
+
console.log(metadata)
|
|
127
|
+
```
|
|
128
|
+
- **To delete a newsletter**
|
|
129
|
+
```ts
|
|
130
|
+
await sock.newsletterDelete("abcd@newsletter")
|
|
131
|
+
```
|
|
132
|
+
- **To follow a newsletter**
|
|
133
|
+
```ts
|
|
134
|
+
await sock.newsletterFollow("abcd@newsletter")
|
|
135
|
+
```
|
|
136
|
+
- **To unfollow a newsletter**
|
|
137
|
+
```ts
|
|
138
|
+
await sock.newsletterUnfollow("abcd@newsletter")
|
|
139
|
+
```
|
|
140
|
+
- **To send reaction**
|
|
141
|
+
```ts
|
|
142
|
+
// jid, id message & emoticon
|
|
143
|
+
// way to get the ID is to copy the message url from channel
|
|
144
|
+
// Example: [ https://whatsapp.com/channel/xxxxx/175 ]
|
|
145
|
+
// The last number of the URL is the ID
|
|
146
|
+
const id = "175"
|
|
147
|
+
await sock.newsletterReactMessage("abcd@newsletter", id, "🥳")
|
|
148
|
+
```
|
|
149
|
+
</div>
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
### Button and Interactive Message Management
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary style="font-weight: bold; cursor: pointer; padding: 8px; border-bottom: 1px solid #eee; margin-bottom: 5px;">Show Examples</summary>
|
|
156
|
+
<div style="padding: 10px 15px; background: #f9f9f9; border: 1px solid #eee; border-top: none; border-radius: 0 0 5px 5px;">
|
|
157
|
+
|
|
158
|
+
- **To send button with text**
|
|
159
|
+
```ts
|
|
160
|
+
const buttons = [
|
|
161
|
+
{ buttonId: 'id1', buttonText: { displayText: 'Button 1' }, type: 1 },
|
|
162
|
+
{ buttonId: 'id2', buttonText: { displayText: 'Button 2' }, type: 1 }
|
|
163
|
+
]
|
|
164
|
+
|
|
165
|
+
const buttonMessage = {
|
|
166
|
+
text: "Hi it's button message",
|
|
167
|
+
footer: 'Hello World',
|
|
168
|
+
buttons,
|
|
169
|
+
headerType: 1
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
await sock.sendMessage(id, buttonMessage, { quoted: null })
|
|
173
|
+
```
|
|
174
|
+
- **To send button with image**
|
|
175
|
+
```ts
|
|
176
|
+
const buttons = [
|
|
177
|
+
{ buttonId: 'id1', buttonText: { displayText: 'Button 1' }, type: 1 },
|
|
178
|
+
{ buttonId: 'id2', buttonText: { displayText: 'Button 2' }, type: 1 }
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
const buttonMessage = {
|
|
182
|
+
image: { url: "https://example.com/abcd.jpg" }, // image: buffer or path
|
|
183
|
+
caption: "Hi it's button message with image",
|
|
184
|
+
footer: 'Hello World',
|
|
185
|
+
buttons,
|
|
186
|
+
headerType: 1
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
await sock.sendMessage(id, buttonMessage, { quoted: null })
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
- **To send button with video**
|
|
193
|
+
```ts
|
|
194
|
+
const buttons = [
|
|
195
|
+
{ buttonId: 'id1', buttonText: { displayText: 'Button 1' }, type: 1 },
|
|
196
|
+
{ buttonId: 'id2', buttonText: { displayText: 'Button 2' }, type: 1 }
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
const buttonMessage = {
|
|
200
|
+
video: { url: "https://example.com/abcd.mp4" }, // video: buffer or path
|
|
201
|
+
caption: "Hi it's button message with video",
|
|
202
|
+
footer: 'Hello World',
|
|
203
|
+
buttons,
|
|
204
|
+
headerType: 1
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
await sock.sendMessage(id, buttonMessage, { quoted: null })
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
- **To send interactive message**
|
|
211
|
+
```ts
|
|
212
|
+
const interactiveButtons = [
|
|
213
|
+
{
|
|
214
|
+
name: "quick_reply",
|
|
215
|
+
buttonParamsJson: JSON.stringify({
|
|
216
|
+
display_text: "Quick Reply",
|
|
217
|
+
id: "ID"
|
|
218
|
+
})
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "cta_url",
|
|
222
|
+
buttonParamsJson: JSON.stringify({
|
|
223
|
+
display_text: "Tap Here!",
|
|
224
|
+
url: "https://www.example.com/"
|
|
225
|
+
})
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: "cta_copy",
|
|
229
|
+
buttonParamsJson: JSON.stringify({
|
|
230
|
+
display_text: "Copy Code",
|
|
231
|
+
id: "12345",
|
|
232
|
+
copy_code: "12345"
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
const interactiveMessage = {
|
|
238
|
+
text: "Hello World!",
|
|
239
|
+
title: "this is the title",
|
|
240
|
+
footer: "this is the footer",
|
|
241
|
+
interactiveButtons
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
await sock.sendMessage(id, interactiveMessage, { quoted: null })
|
|
245
|
+
```
|
|
246
|
+
- **To send interactive message with image**
|
|
247
|
+
```ts
|
|
248
|
+
const interactiveButtons = [
|
|
249
|
+
{
|
|
250
|
+
name: "quick_reply",
|
|
251
|
+
buttonParamsJson: JSON.stringify({
|
|
252
|
+
display_text: "Quick Reply",
|
|
253
|
+
id: "ID"
|
|
254
|
+
})
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: "cta_url",
|
|
258
|
+
buttonParamsJson: JSON.stringify({
|
|
259
|
+
display_text: "Tap Here!",
|
|
260
|
+
url: "https://www.example.com/"
|
|
261
|
+
})
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "cta_copy",
|
|
265
|
+
buttonParamsJson: JSON.stringify({
|
|
266
|
+
display_text: "Copy Code",
|
|
267
|
+
id: "12345",
|
|
268
|
+
copy_code: "12345"
|
|
269
|
+
})
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
|
|
273
|
+
const interactiveMessage = {
|
|
274
|
+
image: { url: "https://example.com/abcd.jpg" }, // image: buffer or path
|
|
275
|
+
caption: "this is the caption",
|
|
276
|
+
title: "this is the title",
|
|
277
|
+
footer: "this is the footer",
|
|
278
|
+
interactiveButtons
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
await sock.sendMessage(id, interactiveMessage, { quoted: null })
|
|
282
|
+
```
|
|
283
|
+
- **To send interactive message with video**
|
|
284
|
+
```ts
|
|
285
|
+
const interactiveButtons = [
|
|
286
|
+
{
|
|
287
|
+
name: "quick_reply",
|
|
288
|
+
buttonParamsJson: JSON.stringify({
|
|
289
|
+
display_text: "Quick Reply",
|
|
290
|
+
id: "ID"
|
|
291
|
+
})
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "cta_url",
|
|
295
|
+
buttonParamsJson: JSON.stringify({
|
|
296
|
+
display_text: "Tap Here!",
|
|
297
|
+
url: "https://www.example.com/"
|
|
298
|
+
})
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: "cta_copy",
|
|
302
|
+
buttonParamsJson: JSON.stringify({
|
|
303
|
+
display_text: "Copy Code",
|
|
304
|
+
id: "12345",
|
|
305
|
+
copy_code: "12345"
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
]
|
|
309
|
+
|
|
310
|
+
const interactiveMessage = {
|
|
311
|
+
video: { url: "https://example.com/abcd.mp4" }, // video: buffer or path
|
|
312
|
+
caption: "this is the caption",
|
|
313
|
+
title: "this is the title",
|
|
314
|
+
footer: "this is the footer",
|
|
315
|
+
interactiveButtons
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
await sock.sendMessage(id, interactiveMessage, { quoted: null })
|
|
319
|
+
```
|
|
320
|
+
- **To send list interactive**
|
|
321
|
+
```ts
|
|
322
|
+
const interactiveButtons = [
|
|
323
|
+
{
|
|
324
|
+
name: "single_select",
|
|
325
|
+
buttonParamsJson: JSON.stringify({
|
|
326
|
+
title: "message",
|
|
327
|
+
sections: [
|
|
328
|
+
{
|
|
329
|
+
title: "title",
|
|
330
|
+
highlight_label: "label",
|
|
331
|
+
rows: [
|
|
332
|
+
{
|
|
333
|
+
header: "HEADER",
|
|
334
|
+
title: "TITLE",
|
|
335
|
+
description: "DESCRIPTION",
|
|
336
|
+
id: "YOUR ID"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
header: "HEADER",
|
|
340
|
+
title: "TITLE",
|
|
341
|
+
description: "DESCRIPTION",
|
|
342
|
+
id: "YOUR ID"
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
})
|
|
348
|
+
}
|
|
349
|
+
];
|
|
350
|
+
|
|
351
|
+
const interactiveMessage = {
|
|
352
|
+
text: "Hello World!",
|
|
353
|
+
title: "this is the title",
|
|
354
|
+
footer: "this is the footer",
|
|
355
|
+
interactiveButtons
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
await sock.sendMessage(id, interactiveMessage, { quoted: null });
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
</div>
|
|
362
|
+
</details>
|
|
363
|
+
|
|
364
|
+
### Send Album Message
|
|
365
|
+
|
|
366
|
+
<details>
|
|
367
|
+
<summary style="font-weight: bold; cursor: pointer; padding: 8px; border-bottom: 1px solid #eee; margin-bottom: 5px;">Show Example</summary>
|
|
368
|
+
<div style="padding: 10px 15px; background: #f9f9f9; border: 1px solid #eee; border-top: none; border-radius: 0 0 5px 5px;">
|
|
369
|
+
|
|
370
|
+
```ts
|
|
371
|
+
// Media can be a URL, buffer, or path.
|
|
372
|
+
const media = [
|
|
373
|
+
{
|
|
374
|
+
image: { url: "https://example.com/image.jpg" }
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
image: await getBuffer("https://example.com/image.jpg")
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
video: { url: "https://example.com/video.mp4" }
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
|
|
384
|
+
await sock.sendMessage(id, { album: media, caption: "testing send album" }, { quoted: null })
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
</div>
|
|
388
|
+
</details>
|
|
389
|
+
|
|
390
|
+
### AI Message Icon Customization
|
|
391
|
+
|
|
392
|
+
<details>
|
|
393
|
+
<summary style="font-weight: bold; cursor: pointer; padding: 8px; border-bottom: 1px solid #eee; margin-bottom: 5px;">Show Example</summary>
|
|
394
|
+
<div style="padding: 10px 15px; background: #f9f9f9; border: 1px solid #eee; border-top: none; border-radius: 0 0 5px 5px;">
|
|
395
|
+
|
|
396
|
+
```ts
|
|
397
|
+
// To enable the AI icon for a message, simply add the "ai: true" parameter:
|
|
398
|
+
await sock.sendMessage(id, { text: "Hello World", ai: true });
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
</div>
|
|
402
|
+
</details>
|
|
403
|
+
|
|
404
|
+
### Custom Pairing Code Generation
|
|
405
|
+
|
|
406
|
+
<details>
|
|
407
|
+
<summary style="font-weight: bold; cursor: pointer; padding: 8px; border-bottom: 1px solid #eee; margin-bottom: 5px;">Show Example</summary>
|
|
408
|
+
<div style="padding: 10px 15px; background: #f9f9f9; border: 1px solid #eee; border-top: none; border-radius: 0 0 5px 5px;">
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
if(usePairingCode && !sock.authState.creds.registered) {
|
|
412
|
+
const phoneNumber = await question('Please enter your mobile phone number:\n');
|
|
413
|
+
// Define your custom 8-digit code (alphanumeric)
|
|
414
|
+
const customPairingCode = "ABCD1234";
|
|
415
|
+
const code = await sock.requestPairingCode(phoneNumber, customPairingCode);
|
|
416
|
+
console.log(`Your Pairing Code: ${code?match(/.{1,4}/g)?.join('-') || code}`);
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
*Note: The `question` function is a placeholder for your method of obtaining user input.*
|
|
420
|
+
</div>
|
|
421
|
+
</details>
|
|
422
|
+
|
|
423
|
+
## Reporting Issues
|
|
424
|
+
If you encounter any issues while using this repository or any part of it, please feel free to open a [new issue](https://github.com/Supunfernando16/supunmd-bail/issues) here.
|
|
425
|
+
|
|
426
|
+
## Notes
|
|
427
|
+
Everything other than the modifications mentioned above remains the same as the original repository. You can check out the original repository at [WhiskeySockets](https://github.com/WhiskeySockets/Baileys)
|
|
428
|
+
Package Sidebar
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supunmd-bail",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"description": "A WebSockets library for interacting with WhatsApp Web",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|
|
8
|
-
"automation"
|
|
8
|
+
"automation",
|
|
9
|
+
"baileys",
|
|
10
|
+
"supunmd",
|
|
11
|
+
"whatsapp-api"
|
|
9
12
|
],
|
|
10
13
|
"homepage": "",
|
|
11
14
|
"repository": {
|
|
@@ -66,6 +69,7 @@
|
|
|
66
69
|
"jimp": "^1.6.0",
|
|
67
70
|
"jiti": "^2.4.2",
|
|
68
71
|
"json": "^11.0.0",
|
|
72
|
+
"chalk": "^4.1.2",
|
|
69
73
|
"link-preview-js": "^3.0.0",
|
|
70
74
|
"lru-cache": "^11.1.0",
|
|
71
75
|
"open": "^8.4.2",
|