@lordmega/baileys 0.3.19 โ 0.3.20
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 +287 -930
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
# ๐ฟ @lordmega/baileys
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
# ๐ฟ MegaBot Baileys
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@lordmega/baileys)
|
|
4
6
|
|
|
5
7
|
<p align="center">
|
|
6
|
-
|
|
8
|
+
A production-ready Baileys v7 fork with newsletter media upload fixes, interactive messages, album support, and extended message type coverage.
|
|
7
9
|
<br><br>
|
|
8
10
|
<a href="https://www.npmjs.com/package/@lordmega/baileys">
|
|
9
11
|
<img src="https://img.shields.io/npm/v/@lordmega/baileys?style=for-the-badge&logo=npm"/>
|
|
@@ -25,8 +27,6 @@
|
|
|
25
27
|
</a>
|
|
26
28
|
</p>
|
|
27
29
|
|
|
28
|
-
โ For donation: [Saweria](https://saweria.co/lordmega)
|
|
29
|
-
|
|
30
30
|
### ๐ Table of Contents
|
|
31
31
|
- [๐ Table of Contents](#-table-of-contents)
|
|
32
32
|
- [โจ Highlights](#-highlights)
|
|
@@ -104,85 +104,43 @@
|
|
|
104
104
|
- [๐ก Events](#-events)
|
|
105
105
|
- [๐ Try the Bot](#-try-the-bot)
|
|
106
106
|
- [๐ฆ Fork Base](#-fork-base)
|
|
107
|
-
- [๐ฃ Credits](#-credits)
|
|
108
107
|
|
|
109
108
|
### โจ Highlights
|
|
110
109
|
|
|
111
|
-
|
|
110
|
+
Built for production with an emphasis on readability and reliability:
|
|
112
111
|
|
|
113
|
-
- ๐ซ No obfuscation
|
|
112
|
+
- ๐ซ No obfuscation โ clean, auditable code.
|
|
114
113
|
- ๐ซ No auto-follow channel (newsletter) behavior.
|
|
115
114
|
|
|
116
|
-
> [!IMPORTANT]
|
|
117
|
-
> Hi everyone,
|
|
118
|
-
>
|
|
119
|
-
> I want to clarify two separate attribution issues regarding packages derived from this fork.
|
|
120
|
-
>
|
|
121
|
-
> 1. Direct redistribution of my modifications without attribution
|
|
122
|
-
>
|
|
123
|
-
> The following packages are operated by the same individual under multiple npm accounts:
|
|
124
|
-
>
|
|
125
|
-
> - [@nuisockets](https://www.npmjs.com/package/@nuisockets/baileys)
|
|
126
|
-
> - [@nuiisatoru](https://www.npmjs.com/package/@nuiisatoru/baileys)
|
|
127
|
-
> - [@nuiisweetberry](https://www.npmjs.com/package/@nuiisweetberry/baileys)
|
|
128
|
-
> - [@nuiisweety](https://www.npmjs.com/package/@nuiisweety/baileys)
|
|
129
|
-
>
|
|
130
|
-
> These packages redistribute files and modifications originating from this fork while removing contributor credits and modification notes.
|
|
131
|
-
>
|
|
132
|
-
> 2. Rebranded republishes of this fork
|
|
133
|
-
>
|
|
134
|
-
> - [@lumina-md](https://www.npmjs.com/package/@lumina-md/baileys)
|
|
135
|
-
> - [@sairidev](https://www.npmjs.com/package/@sairidev/baileys-new)
|
|
136
|
-
> - [nexora-baileys](https://www.npmjs.com/package/nexora-baileys)
|
|
137
|
-
> - [baileys-yorkv2](https://www.npmjs.com/package/baileys-yorkv2)
|
|
138
|
-
> - [aetherzxyz](https://www.npmjs.com/package/aetherzxyz)
|
|
139
|
-
>
|
|
140
|
-
> These packages primarily repackage or republish this fork under different names while failing to preserve proper attribution, credits, or modification notes.
|
|
141
|
-
>
|
|
142
|
-
> To be clear, I am **NOT** the original maintainer of Baileys. Full credit and respect belong to:
|
|
143
|
-
>
|
|
144
|
-
> https://github.com/WhiskeySockets/Baileys
|
|
145
|
-
>
|
|
146
|
-
> **Forking is completely acceptable. Removing attribution, contributor credits, or modification history is not.**
|
|
147
|
-
>
|
|
148
|
-
> Please report if necessary.
|
|
149
|
-
>
|
|
150
|
-
> Thank you. ๐ค
|
|
151
|
-
|
|
152
|
-
> [!NOTE]
|
|
153
|
-
> ๐ This project is maintained with limited scope and is not intended to replace upstream Baileys.
|
|
154
|
-
>
|
|
155
|
-
> ๐ And, really sorry for my bad english.
|
|
156
|
-
|
|
157
115
|
### ๐ ๏ธ Internal Adjustments
|
|
158
|
-
- ๐ผ๏ธ Fixed
|
|
159
|
-
- ๐
|
|
160
|
-
- ๐ฆ
|
|
161
|
-
- ๐๏ธ Added [`@napi-rs/image`](https://www.npmjs.com/package/@napi-rs/image) as a supported
|
|
116
|
+
- ๐ผ๏ธ Fixed newsletter media upload failures caused by an upstream bug.
|
|
117
|
+
- ๐ Restored `makeInMemoryStore` with a lightweight ESM adaptation and minor compatibility tweaks for Baileys v7.
|
|
118
|
+
- ๐ฆ Replaced FFmpeg `exec` calls with `spawn` for more reliable process management.
|
|
119
|
+
- ๐๏ธ Added [`@napi-rs/image`](https://www.npmjs.com/package/@napi-rs/image) as a supported backend in [`getImageProcessingLibrary()`](#%EF%B8%8F-image-processing), providing a solid balance between speed and compatibility.
|
|
162
120
|
|
|
163
121
|
### ๐จ Messages Handling & Compatibility
|
|
164
|
-
- ๐ฉ
|
|
122
|
+
- ๐ฉ Extended message type support for:
|
|
165
123
|
- ๐ผ๏ธ [Album Message](#%EF%B8%8F-album-image--video)
|
|
166
124
|
- ๐ค [Group Status Message](#%E2%80%8D%E2%80%8D-group-status)
|
|
167
|
-
- ๐๐ป [Interactive Message](#-sending-interactive-messages) (buttons, lists, native flows, templates, carousels)
|
|
125
|
+
- ๐๐ป [Interactive Message](#-sending-interactive-messages) (buttons, lists, native flows, templates, carousels)
|
|
168
126
|
- ๐๏ธ [Status Mention Message](#%EF%B8%8F-status-mention)
|
|
169
127
|
- ๐ฆ [Sticker Pack Message](#-sticker-pack)
|
|
170
128
|
- โจ [Rich Response Message](#-rich-response) **[NEW]**
|
|
171
129
|
- ๐งพ [Message with Code Blocks](#-message-with-code-block) **[NEW]**
|
|
172
|
-
-
|
|
130
|
+
- ๐ [Message with Inline Entities](#-message-with-inline-entities) **[NEW]**
|
|
173
131
|
- ๐ [Message with Table](#-message-with-table) **[NEW]**
|
|
174
|
-
- ๐ณ [Payment-related
|
|
175
|
-
- ๐ฐ Simplified
|
|
176
|
-
- ๐ญ Added support for quoting messages inside
|
|
177
|
-
- ๐ Added support for [custom button
|
|
132
|
+
- ๐ณ [Payment-related Messages](#-sending-payment-messages) (requests, invites, orders, invoices)
|
|
133
|
+
- ๐ฐ Simplified ad thumbnail sending via [`externalAdReply`](#-external-ad-reply) โ no manual `contextInfo` required.
|
|
134
|
+
- ๐ญ Added support for quoting messages inside newsletters. **[NEW]**
|
|
135
|
+
- ๐ Added support for [custom button icons](#%EF%B8%8F-interactive). **[NEW]**
|
|
178
136
|
|
|
179
137
|
### ๐งฉ Additional Message Options
|
|
180
|
-
- ๐๏ธ
|
|
181
|
-
- ๐ค [`ai`](#-ai-icon)
|
|
182
|
-
- ๐ฃ [`mentionAll`](#-mention)
|
|
183
|
-
- ๐ง [`ephemeral`](#-ephemeral), [`groupStatus`](#%E2%80%8D%E2%80%8D-group-status), [`isLottie`](#-lottie-sticker), [`spoiler`](#-spoiler), [`viewOnce`](#%EF%B8%8F-view-once), [`viewOnceV2`](#%EF%B8%8F-view-once-v2), [`viewOnceV2Extension`](#%EF%B8%8F-view-once-v2-extension), [`interactiveAsTemplate`](#%EF%B8%8F-interactive)
|
|
184
|
-
- ๐ [`secureMetaServiceLabel`](#%EF%B8%8F-secure-meta-service-label)
|
|
185
|
-
- ๐ [`raw`](#-raw)
|
|
138
|
+
- ๐๏ธ Optional boolean flags for message behavior:
|
|
139
|
+
- ๐ค [`ai`](#-ai-icon) โ AI icon on message
|
|
140
|
+
- ๐ฃ [`mentionAll`](#-mention) โ Mention all group participants without specifying individual JIDs **[NEW]**
|
|
141
|
+
- ๐ง [`ephemeral`](#-ephemeral), [`groupStatus`](#%E2%80%8D%E2%80%8D-group-status), [`isLottie`](#-lottie-sticker), [`spoiler`](#-spoiler), [`viewOnce`](#%EF%B8%8F-view-once), [`viewOnceV2`](#%EF%B8%8F-view-once-v2), [`viewOnceV2Extension`](#%EF%B8%8F-view-once-v2-extension), [`interactiveAsTemplate`](#%EF%B8%8F-interactive) โ Message wrappers
|
|
142
|
+
- ๐ [`secureMetaServiceLabel`](#%EF%B8%8F-secure-meta-service-label) โ Secure meta service label **[NEW]**
|
|
143
|
+
- ๐ [`raw`](#-raw) โ Build message proto manually **(DO NOT USE FOR EXPLOITATION)**
|
|
186
144
|
|
|
187
145
|
### ๐ฅ Installation
|
|
188
146
|
|
|
@@ -227,7 +185,6 @@ import { makeWASocket, delay, DisconnectReason, useMultiFileAuthState } from '@l
|
|
|
227
185
|
import { Boom } from '@hapi/boom'
|
|
228
186
|
import pino from 'pino'
|
|
229
187
|
|
|
230
|
-
// --- Connect with pairing code
|
|
231
188
|
const myPhoneNumber = '6288888888888'
|
|
232
189
|
|
|
233
190
|
const logger = pino({ level: 'silent' })
|
|
@@ -279,12 +236,12 @@ connectToWhatsApp()
|
|
|
279
236
|
#### ๐ Auth State
|
|
280
237
|
|
|
281
238
|
> [!NOTE]
|
|
282
|
-
> You can use the experimental `useSingleFileAuthState` and `useSqliteAuthState` as
|
|
239
|
+
> You can use the experimental `useSingleFileAuthState` and `useSqliteAuthState` as alternatives to `useMultiFileAuthState`. Note that `useSingleFileAuthState` has built-in caching, so wrapping `state.keys` with `makeCacheableSignalKeyStore` is unnecessary.
|
|
283
240
|
|
|
284
241
|
### ๐๏ธ Implementing Data Store
|
|
285
242
|
|
|
286
243
|
> [!CAUTION]
|
|
287
|
-
>
|
|
244
|
+
> Building your own data store is strongly recommended โ keeping full chat history in memory can cause excessive RAM usage.
|
|
288
245
|
|
|
289
246
|
```javascript
|
|
290
247
|
import { makeWASocket, makeInMemoryStore, delay, DisconnectReason, useMultiFileAuthState } from '@lordmega/baileys'
|
|
@@ -292,10 +249,7 @@ import { Boom } from '@hapi/boom'
|
|
|
292
249
|
import pino from 'pino'
|
|
293
250
|
|
|
294
251
|
const myPhoneNumber = '6288888888888'
|
|
295
|
-
|
|
296
|
-
// --- Create your store path
|
|
297
252
|
const storePath = './store.json'
|
|
298
|
-
|
|
299
253
|
const logger = pino({ level: 'silent' })
|
|
300
254
|
|
|
301
255
|
const connectToWhatsApp = async () => {
|
|
@@ -342,10 +296,8 @@ const connectToWhatsApp = async () => {
|
|
|
342
296
|
console.log('๐ฅ Got contacts', Object.values(store.contacts))
|
|
343
297
|
})
|
|
344
298
|
|
|
345
|
-
// --- Read store from file
|
|
346
299
|
store.readFromFile(storePath)
|
|
347
300
|
|
|
348
|
-
// --- Save store every 3 minutes
|
|
349
301
|
setInterval(() => {
|
|
350
302
|
store.writeToFile(storePath)
|
|
351
303
|
}, 180000)
|
|
@@ -356,30 +308,27 @@ connectToWhatsApp()
|
|
|
356
308
|
|
|
357
309
|
### ๐ชช WhatsApp IDs Explain
|
|
358
310
|
|
|
359
|
-
`id` is the WhatsApp ID
|
|
360
|
-
-
|
|
361
|
-
-
|
|
362
|
-
-
|
|
363
|
-
-
|
|
364
|
-
-
|
|
365
|
-
-
|
|
311
|
+
`id` is the WhatsApp ID (also referred to as `jid` or `lid`) of the person or group you're messaging.
|
|
312
|
+
- Format: `[country code][phone number]@s.whatsapp.net`
|
|
313
|
+
- Individual: `19999999999@s.whatsapp.net` or `12699999999@lid`
|
|
314
|
+
- Group: `123456789-123345@g.us`
|
|
315
|
+
- Meta AI: `11111111111@bot`
|
|
316
|
+
- Broadcast lists: `[timestamp]@broadcast`
|
|
317
|
+
- Stories: `status@broadcast`
|
|
366
318
|
|
|
367
319
|
### โ๏ธ Sending Messages
|
|
368
320
|
|
|
369
|
-
> [!NOTE]
|
|
370
|
-
> You can get the `jid` from `message.key.remoteJid` in the first example.
|
|
371
|
-
|
|
372
321
|
#### ๐ Text
|
|
373
322
|
|
|
374
323
|
```javascript
|
|
375
|
-
// ---
|
|
324
|
+
// --- Regular text
|
|
376
325
|
sock.sendMessage(jid, {
|
|
377
326
|
text: '๐๐ป Hello'
|
|
378
327
|
}, {
|
|
379
328
|
quoted: message
|
|
380
329
|
})
|
|
381
330
|
|
|
382
|
-
// ---
|
|
331
|
+
// --- With link preview
|
|
383
332
|
const urlA = 'https://www.npmjs.com/package/@lordmega/baileys'
|
|
384
333
|
|
|
385
334
|
sock.sendMessage(jid, {
|
|
@@ -388,26 +337,23 @@ sock.sendMessage(jid, {
|
|
|
388
337
|
'matched-text': urlA,
|
|
389
338
|
title: '๐ฑ @lordmega/baileys',
|
|
390
339
|
description: 'Underrated Baileys Fork',
|
|
391
|
-
previewType: 0,
|
|
340
|
+
previewType: 0,
|
|
392
341
|
jpegThumbnail: fs.readFileSync('./path/to/image.jpg')
|
|
393
342
|
}
|
|
394
343
|
})
|
|
395
344
|
|
|
396
|
-
// ---
|
|
345
|
+
// --- Large link preview with favicon
|
|
397
346
|
import { prepareWAMessageMedia } from '@lordmega/baileys'
|
|
398
347
|
|
|
399
348
|
const urlB = 'https://www.npmjs.com/package/@lordmega/baileys#readme'
|
|
400
349
|
|
|
401
350
|
const { imageMessage: image } = await prepareWAMessageMedia({
|
|
402
|
-
image: {
|
|
403
|
-
url: './path/to/image.jpg'
|
|
404
|
-
}
|
|
351
|
+
image: { url: './path/to/image.jpg' }
|
|
405
352
|
}, {
|
|
406
353
|
upload: sock.waUploadToServer,
|
|
407
354
|
mediaTypeOverride: 'thumbnail-link'
|
|
408
355
|
})
|
|
409
356
|
|
|
410
|
-
// --- Set the thumbnail display size
|
|
411
357
|
image.height = 720
|
|
412
358
|
image.width = 480
|
|
413
359
|
|
|
@@ -421,20 +367,18 @@ sock.sendMessage(jid, {
|
|
|
421
367
|
jpegThumbnail: fs.readFileSync('./path/to/image.jpg'),
|
|
422
368
|
highQualityThumbnail: image,
|
|
423
369
|
linkPreviewMetadata: {
|
|
424
|
-
linkMediaDuration: 0,
|
|
425
|
-
socialMediaPostType: 1,
|
|
426
|
-
}
|
|
370
|
+
linkMediaDuration: 0,
|
|
371
|
+
socialMediaPostType: 1,
|
|
372
|
+
}
|
|
427
373
|
},
|
|
428
|
-
favicon: {
|
|
429
|
-
url: './path/to/tiny-image.ico'
|
|
430
|
-
}
|
|
374
|
+
favicon: { url: './path/to/tiny-image.ico' }
|
|
431
375
|
})
|
|
432
376
|
```
|
|
433
377
|
|
|
434
378
|
#### ๐ Mention
|
|
435
379
|
|
|
436
380
|
```javascript
|
|
437
|
-
// ---
|
|
381
|
+
// --- Specific mention
|
|
438
382
|
sock.sendMessage(jid, {
|
|
439
383
|
text: '๐๐ป Hello @628123456789',
|
|
440
384
|
mentions: ['628123456789@s.whatsapp.net']
|
|
@@ -467,20 +411,20 @@ sock.sendMessage(jid, {
|
|
|
467
411
|
```javascript
|
|
468
412
|
sock.sendMessage(jid, {
|
|
469
413
|
pin: message.key,
|
|
470
|
-
time: 86400, //
|
|
471
|
-
type: 1 //
|
|
414
|
+
time: 86400, // 86400 (1d), 604800 (7d), 2592000 (30d)
|
|
415
|
+
type: 1 // 2 to unpin
|
|
472
416
|
})
|
|
473
417
|
```
|
|
474
418
|
|
|
475
419
|
#### ๐ Keep Chat
|
|
476
420
|
|
|
477
421
|
> [!NOTE]
|
|
478
|
-
>
|
|
422
|
+
> Only works in chats or groups with disappearing messages enabled.
|
|
479
423
|
|
|
480
424
|
```javascript
|
|
481
425
|
sock.sendMessage(jid, {
|
|
482
426
|
keep: message.key,
|
|
483
|
-
type: 1 //
|
|
427
|
+
type: 1 // 2 to remove
|
|
484
428
|
})
|
|
485
429
|
```
|
|
486
430
|
|
|
@@ -489,7 +433,7 @@ sock.sendMessage(jid, {
|
|
|
489
433
|
```javascript
|
|
490
434
|
sock.sendMessage(jid, {
|
|
491
435
|
forward: message,
|
|
492
|
-
force: true //
|
|
436
|
+
force: true // Optional
|
|
493
437
|
})
|
|
494
438
|
```
|
|
495
439
|
|
|
@@ -498,17 +442,15 @@ sock.sendMessage(jid, {
|
|
|
498
442
|
```javascript
|
|
499
443
|
const vcard = 'BEGIN:VCARD\n'
|
|
500
444
|
+ 'VERSION:3.0\n'
|
|
501
|
-
+ 'FN:
|
|
502
|
-
+ 'ORG:
|
|
445
|
+
+ 'FN:John Doe\n'
|
|
446
|
+
+ 'ORG:Example;\n'
|
|
503
447
|
+ 'TEL;type=CELL;type=VOICE;waid=628123456789:+62 8123 4567 89\n'
|
|
504
448
|
+ 'END:VCARD'
|
|
505
449
|
|
|
506
450
|
sock.sendMessage(jid, {
|
|
507
451
|
contacts: {
|
|
508
|
-
displayName: '
|
|
509
|
-
contacts: [
|
|
510
|
-
{ vcard }
|
|
511
|
-
]
|
|
452
|
+
displayName: 'John Doe',
|
|
453
|
+
contacts: [{ vcard }]
|
|
512
454
|
}
|
|
513
455
|
}, {
|
|
514
456
|
quoted: message
|
|
@@ -535,13 +477,13 @@ sock.sendMessage(jid, {
|
|
|
535
477
|
sock.sendMessage(jid, {
|
|
536
478
|
event: {
|
|
537
479
|
name: '๐ถ Meet & Mingle Party',
|
|
538
|
-
description: '
|
|
539
|
-
call: 'audio', //
|
|
480
|
+
description: 'A casual gathering to connect and build new relationships.',
|
|
481
|
+
call: 'audio', // or "video", optional
|
|
540
482
|
startDate: new Date(Date.now() + 3600000),
|
|
541
483
|
endDate: new Date(Date.now() + 28800000),
|
|
542
|
-
isCancelled: false,
|
|
543
|
-
isScheduleCall: false,
|
|
544
|
-
extraGuestsAllowed: false,
|
|
484
|
+
isCancelled: false,
|
|
485
|
+
isScheduleCall: false,
|
|
486
|
+
extraGuestsAllowed: false,
|
|
545
487
|
location: {
|
|
546
488
|
name: 'Jakarta',
|
|
547
489
|
degreesLatitude: -6.2,
|
|
@@ -560,16 +502,13 @@ const inviteCode = groupUrl
|
|
|
560
502
|
.split('chat.whatsapp.com/')[1]
|
|
561
503
|
?.split('?')[0]
|
|
562
504
|
|
|
563
|
-
const groupJid = '1201111111111@g.us'
|
|
564
|
-
const groupName = '@lordmega/baileys'
|
|
565
|
-
|
|
566
505
|
sock.sendMessage(jid, {
|
|
567
506
|
groupInvite: {
|
|
568
507
|
inviteCode,
|
|
569
508
|
inviteExpiration: Date.now() + 86400000,
|
|
570
|
-
text: '๐๐ป
|
|
571
|
-
jid:
|
|
572
|
-
subject:
|
|
509
|
+
text: '๐๐ป You are invited to join our group.',
|
|
510
|
+
jid: '1201111111111@g.us',
|
|
511
|
+
subject: 'Group Name',
|
|
573
512
|
}
|
|
574
513
|
}, {
|
|
575
514
|
quoted: message
|
|
@@ -582,21 +521,19 @@ sock.sendMessage(jid, {
|
|
|
582
521
|
import { randomUUID } from 'crypto'
|
|
583
522
|
|
|
584
523
|
sock.sendMessage(jid, {
|
|
585
|
-
image: {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
body: '๐๐ป Check my product here!',
|
|
589
|
-
footer: '@lordmega/baileys',
|
|
524
|
+
image: { url: './path/to/image.jpg' },
|
|
525
|
+
body: '๐๐ป Check this out!',
|
|
526
|
+
footer: 'MegaBot',
|
|
590
527
|
product: {
|
|
591
528
|
currencyCode: 'IDR',
|
|
592
|
-
description: '๐๏ธ
|
|
529
|
+
description: '๐๏ธ Great product!',
|
|
593
530
|
priceAmount1000: 70_000_000,
|
|
594
531
|
productId: randomUUID(),
|
|
595
532
|
productImageCount: 1,
|
|
596
533
|
salePriceAmount1000: 65_000_000,
|
|
597
|
-
signedUrl: 'https://
|
|
598
|
-
title: '๐ฆ
|
|
599
|
-
url: 'https://
|
|
534
|
+
signedUrl: 'https://example.com',
|
|
535
|
+
title: '๐ฆ Product Name',
|
|
536
|
+
url: 'https://example.com'
|
|
600
537
|
},
|
|
601
538
|
businessOwnerJid: '0@s.whatsapp.net'
|
|
602
539
|
})
|
|
@@ -605,22 +542,22 @@ sock.sendMessage(jid, {
|
|
|
605
542
|
#### ๐ Poll
|
|
606
543
|
|
|
607
544
|
```javascript
|
|
608
|
-
// ---
|
|
545
|
+
// --- Standard poll
|
|
609
546
|
sock.sendMessage(jid, {
|
|
610
547
|
poll: {
|
|
611
|
-
name: '๐ฅ
|
|
548
|
+
name: '๐ฅ Quick vote',
|
|
612
549
|
values: ['Yes', 'No'],
|
|
613
550
|
selectableCount: 1,
|
|
614
551
|
toAnnouncementGroup: false,
|
|
615
|
-
endDate: new Date(Date.now() + 28800000),
|
|
616
|
-
hideVoter: false,
|
|
617
|
-
canAddOption: false
|
|
552
|
+
endDate: new Date(Date.now() + 28800000),
|
|
553
|
+
hideVoter: false,
|
|
554
|
+
canAddOption: false
|
|
618
555
|
}
|
|
619
556
|
}, {
|
|
620
557
|
quoted: message
|
|
621
558
|
})
|
|
622
559
|
|
|
623
|
-
// --- Quiz (only
|
|
560
|
+
// --- Quiz (newsletters only)
|
|
624
561
|
sock.sendMessage('1211111111111@newsletter', {
|
|
625
562
|
poll: {
|
|
626
563
|
name: '๐ฅ Quiz',
|
|
@@ -628,8 +565,6 @@ sock.sendMessage('1211111111111@newsletter', {
|
|
|
628
565
|
correctAnswer: 'Yes',
|
|
629
566
|
pollType: 1
|
|
630
567
|
}
|
|
631
|
-
}, {
|
|
632
|
-
quoted: message
|
|
633
568
|
})
|
|
634
569
|
|
|
635
570
|
// --- Poll result
|
|
@@ -643,10 +578,8 @@ sock.sendMessage(jid, {
|
|
|
643
578
|
name: 'Nah',
|
|
644
579
|
voteCount: 2
|
|
645
580
|
}],
|
|
646
|
-
pollType: 0
|
|
581
|
+
pollType: 0
|
|
647
582
|
}
|
|
648
|
-
}, {
|
|
649
|
-
quoted: message
|
|
650
583
|
})
|
|
651
584
|
|
|
652
585
|
// --- Poll update
|
|
@@ -659,26 +592,22 @@ sock.sendMessage(jid, {
|
|
|
659
592
|
encPayload: /* <Buffer> */
|
|
660
593
|
}
|
|
661
594
|
}
|
|
662
|
-
}, {
|
|
663
|
-
quoted: message
|
|
664
595
|
})
|
|
665
596
|
```
|
|
666
597
|
|
|
667
598
|
#### ๐ญ Button Response
|
|
668
599
|
|
|
669
600
|
```javascript
|
|
670
|
-
// ---
|
|
601
|
+
// --- buttonsResponseMessage
|
|
671
602
|
sock.sendMessage(jid, {
|
|
672
603
|
type: 'plain',
|
|
673
604
|
buttonReply: {
|
|
674
605
|
id: '#Menu',
|
|
675
|
-
displayText: 'โจ
|
|
606
|
+
displayText: 'โจ Menu'
|
|
676
607
|
}
|
|
677
|
-
}, {
|
|
678
|
-
quoted: message
|
|
679
|
-
})
|
|
608
|
+
}, { quoted: message })
|
|
680
609
|
|
|
681
|
-
// ---
|
|
610
|
+
// --- interactiveResponseMessage
|
|
682
611
|
sock.sendMessage(jid, {
|
|
683
612
|
flowReply: {
|
|
684
613
|
format: 0,
|
|
@@ -686,45 +615,35 @@ sock.sendMessage(jid, {
|
|
|
686
615
|
name: 'menu_options',
|
|
687
616
|
paramsJson: JSON.stringify({
|
|
688
617
|
id: '#Menu',
|
|
689
|
-
description: 'โจ
|
|
618
|
+
description: 'โจ Menu'
|
|
690
619
|
})
|
|
691
620
|
}
|
|
692
|
-
}, {
|
|
693
|
-
quoted: message
|
|
694
|
-
})
|
|
621
|
+
}, { quoted: message })
|
|
695
622
|
|
|
696
|
-
// ---
|
|
623
|
+
// --- listResponseMessage
|
|
697
624
|
sock.sendMessage(jid, {
|
|
698
625
|
listReply: {
|
|
699
626
|
title: '๐ See More',
|
|
700
|
-
description: 'โจ
|
|
627
|
+
description: 'โจ Menu',
|
|
701
628
|
id: '#Menu'
|
|
702
629
|
}
|
|
703
|
-
}, {
|
|
704
|
-
quoted: message
|
|
705
|
-
})
|
|
630
|
+
}, { quoted: message })
|
|
706
631
|
|
|
707
|
-
// ---
|
|
632
|
+
// --- templateButtonReplyMessage
|
|
708
633
|
sock.sendMessage(jid, {
|
|
709
634
|
type: 'template',
|
|
710
635
|
buttonReply: {
|
|
711
636
|
id: '#Menu',
|
|
712
|
-
displayText: 'โจ
|
|
637
|
+
displayText: 'โจ Menu',
|
|
713
638
|
index: 1
|
|
714
639
|
}
|
|
715
|
-
}, {
|
|
716
|
-
quoted: message
|
|
717
|
-
})
|
|
640
|
+
}, { quoted: message })
|
|
718
641
|
```
|
|
719
642
|
|
|
720
643
|
#### โจ Rich Response
|
|
721
644
|
|
|
722
645
|
> [!NOTE]
|
|
723
|
-
> `richResponse[]`
|
|
724
|
-
|
|
725
|
-
> [!TIP]
|
|
726
|
-
> You can still use the original [`submessages[]`](https://baileys.wiki/docs/api/namespaces/proto/interfaces/IAIRichResponseSubMessage) field directly.
|
|
727
|
-
> The code example below is just an implementation using a helper, not a required structure.
|
|
646
|
+
> `richResponse[]` maps to `submessages[]` inside `richResponseMessage`.
|
|
728
647
|
|
|
729
648
|
```javascript
|
|
730
649
|
sock.sendMessage(jid, {
|
|
@@ -740,7 +659,7 @@ sock.sendMessage(jid, {
|
|
|
740
659
|
}, {
|
|
741
660
|
text: 'Pretty simple, right?\n'
|
|
742
661
|
}, {
|
|
743
|
-
text: 'Comparison
|
|
662
|
+
text: 'Runtime Comparison',
|
|
744
663
|
}, {
|
|
745
664
|
title: 'Runtime Comparison',
|
|
746
665
|
table: [{
|
|
@@ -760,7 +679,7 @@ sock.sendMessage(jid, {
|
|
|
760
679
|
```
|
|
761
680
|
|
|
762
681
|
> [!TIP]
|
|
763
|
-
>
|
|
682
|
+
> Use `tokenizeCode` for syntax highlighting:
|
|
764
683
|
|
|
765
684
|
```javascript
|
|
766
685
|
import { tokenizeCode } from '@lordmega/baileys'
|
|
@@ -769,25 +688,22 @@ const language = 'javascript'
|
|
|
769
688
|
const code = 'console.log("Hello, World!")'
|
|
770
689
|
|
|
771
690
|
sock.sendMessage(jid, {
|
|
772
|
-
disclaimerText: '
|
|
691
|
+
disclaimerText: 'Tokenized Code Block',
|
|
773
692
|
richResponse: [{
|
|
774
|
-
text: 'Example
|
|
693
|
+
text: 'Example',
|
|
775
694
|
}, {
|
|
776
695
|
language,
|
|
777
696
|
code: tokenizeCode(code, language)
|
|
778
697
|
}, {
|
|
779
|
-
text: '
|
|
698
|
+
text: 'Clean and simple.'
|
|
780
699
|
}]
|
|
781
700
|
})
|
|
782
701
|
```
|
|
783
702
|
|
|
784
|
-
> ๐ก Supported
|
|
703
|
+
> ๐ก Supported languages: `css`, `html`, `javascript`, `typescript`, `python`, `golang`, `rust`, `c`, `c#`, `c++`, `bash`, `bat`, `powershell`
|
|
785
704
|
|
|
786
705
|
#### ๐งพ Message with Code Block
|
|
787
706
|
|
|
788
|
-
> [!NOTE]
|
|
789
|
-
> This feature already includes a built-in tokenizer with `tokenizeCode`.
|
|
790
|
-
|
|
791
707
|
```javascript
|
|
792
708
|
sock.sendMessage(jid, {
|
|
793
709
|
disclaimerText: 'Code Block',
|
|
@@ -814,10 +730,6 @@ sock.sendMessage(jid, {
|
|
|
814
730
|
text: '2. YouTube',
|
|
815
731
|
title: 'Popular Streaming Platform',
|
|
816
732
|
url: 'https://www.youtube.com/'
|
|
817
|
-
}, {
|
|
818
|
-
text: '3. Modded Baileys',
|
|
819
|
-
title: 'Underrated Baileys Fork',
|
|
820
|
-
url: 'https://www.npmjs.com/package/@lordmega/baileys'
|
|
821
733
|
}],
|
|
822
734
|
footerText: '---'
|
|
823
735
|
})
|
|
@@ -828,16 +740,16 @@ sock.sendMessage(jid, {
|
|
|
828
740
|
```javascript
|
|
829
741
|
sock.sendMessage(jid, {
|
|
830
742
|
disclaimerText: 'Table',
|
|
831
|
-
headerText: '## Comparison
|
|
743
|
+
headerText: '## Runtime Comparison',
|
|
832
744
|
contentText: '---',
|
|
833
|
-
title: '
|
|
745
|
+
title: 'Node.js vs Bun vs Deno',
|
|
834
746
|
table: [
|
|
835
747
|
['', 'Node.js', 'Bun', 'Deno'],
|
|
836
748
|
['Engine', 'V8 (C++)', 'JavaScriptCore (C++)', 'V8 (C++)'],
|
|
837
749
|
['Performance', '4/5', '5/5', '4/5']
|
|
838
750
|
],
|
|
839
|
-
noHeading: false,
|
|
840
|
-
footerText: 'Does this help clarify
|
|
751
|
+
noHeading: false,
|
|
752
|
+
footerText: 'Does this help clarify things?'
|
|
841
753
|
})
|
|
842
754
|
```
|
|
843
755
|
|
|
@@ -852,73 +764,53 @@ sock.sendMessage([jidA, jidB, jidC], {
|
|
|
852
764
|
### ๐ Sending Media Messages
|
|
853
765
|
|
|
854
766
|
> [!NOTE]
|
|
855
|
-
>
|
|
767
|
+
> Media can be passed as a `Buffer`, `{ stream: Readable }`, or `{ url: string }` (local path or HTTP/HTTPS URL).
|
|
856
768
|
|
|
857
769
|
#### ๐ผ๏ธ Image
|
|
858
770
|
|
|
859
771
|
```javascript
|
|
860
772
|
sock.sendMessage(jid, {
|
|
861
|
-
image: {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
caption: '๐ฅ Superb'
|
|
865
|
-
}, {
|
|
866
|
-
quoted: message
|
|
867
|
-
})
|
|
773
|
+
image: { url: './path/to/image.jpg' },
|
|
774
|
+
caption: '๐ฅ Check this out'
|
|
775
|
+
}, { quoted: message })
|
|
868
776
|
```
|
|
869
777
|
|
|
870
778
|
#### ๐ฅ Video
|
|
871
779
|
|
|
872
780
|
```javascript
|
|
873
781
|
sock.sendMessage(jid, {
|
|
874
|
-
video: {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
caption: '๐ฅ Superb'
|
|
880
|
-
}, {
|
|
881
|
-
quoted: message
|
|
882
|
-
})
|
|
782
|
+
video: { url: './path/to/video.mp4' },
|
|
783
|
+
gifPlayback: false,
|
|
784
|
+
ptv: false,
|
|
785
|
+
caption: '๐ฅ Check this out'
|
|
786
|
+
}, { quoted: message })
|
|
883
787
|
```
|
|
884
788
|
|
|
885
789
|
#### ๐ Sticker
|
|
886
790
|
|
|
887
791
|
```javascript
|
|
888
792
|
sock.sendMessage(jid, {
|
|
889
|
-
sticker: {
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
}, {
|
|
893
|
-
quoted: message
|
|
894
|
-
})
|
|
793
|
+
sticker: { url: './path/to/sticker.webp' }
|
|
794
|
+
}, { quoted: message })
|
|
895
795
|
```
|
|
896
796
|
|
|
897
797
|
#### ๐ฝ Audio
|
|
898
798
|
|
|
899
799
|
```javascript
|
|
900
800
|
sock.sendMessage(jid, {
|
|
901
|
-
audio: {
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
ptt: false // --- Set true if you want to send audio as Voice Note
|
|
905
|
-
}, {
|
|
906
|
-
quoted: message
|
|
907
|
-
})
|
|
801
|
+
audio: { url: './path/to/audio.mp3' },
|
|
802
|
+
ptt: false // true for voice note
|
|
803
|
+
}, { quoted: message })
|
|
908
804
|
```
|
|
909
805
|
|
|
910
806
|
#### ๐๏ธ Document
|
|
911
807
|
|
|
912
808
|
```javascript
|
|
913
809
|
sock.sendMessage(jid, {
|
|
914
|
-
document: {
|
|
915
|
-
url: './path/to/document.pdf'
|
|
916
|
-
},
|
|
810
|
+
document: { url: './path/to/document.pdf' },
|
|
917
811
|
mimetype: 'application/pdf',
|
|
918
|
-
caption: 'โจ
|
|
919
|
-
}, {
|
|
920
|
-
quoted: message
|
|
921
|
-
})
|
|
812
|
+
caption: 'โจ Document'
|
|
813
|
+
}, { quoted: message })
|
|
922
814
|
```
|
|
923
815
|
|
|
924
816
|
#### ๐ผ๏ธ Album (Image & Video)
|
|
@@ -926,60 +818,38 @@ sock.sendMessage(jid, {
|
|
|
926
818
|
```javascript
|
|
927
819
|
sock.sendMessage(jid, {
|
|
928
820
|
album: [{
|
|
929
|
-
image: {
|
|
930
|
-
url: './path/to/image.jpg'
|
|
931
|
-
},
|
|
821
|
+
image: { url: './path/to/image.jpg' },
|
|
932
822
|
caption: '1st image'
|
|
933
823
|
}, {
|
|
934
|
-
video: {
|
|
935
|
-
url: './path/to/video.mp4'
|
|
936
|
-
},
|
|
824
|
+
video: { url: './path/to/video.mp4' },
|
|
937
825
|
caption: '1st video'
|
|
938
826
|
}, {
|
|
939
|
-
image: {
|
|
940
|
-
url: './path/to/image.jpg'
|
|
941
|
-
},
|
|
827
|
+
image: { url: './path/to/image.jpg' },
|
|
942
828
|
caption: '2nd image'
|
|
943
829
|
}, {
|
|
944
|
-
video: {
|
|
945
|
-
url: './path/to/video.mp4'
|
|
946
|
-
},
|
|
830
|
+
video: { url: './path/to/video.mp4' },
|
|
947
831
|
caption: '2nd video'
|
|
948
832
|
}]
|
|
949
|
-
}, {
|
|
950
|
-
quoted: message
|
|
951
|
-
})
|
|
833
|
+
}, { quoted: message })
|
|
952
834
|
```
|
|
953
835
|
|
|
954
836
|
#### ๐ฆ Sticker Pack
|
|
955
837
|
|
|
956
838
|
> [!IMPORTANT]
|
|
957
|
-
>
|
|
839
|
+
> Without `sharp` or `@napi-rs/image` installed, all sticker files must already be in WebP format.
|
|
958
840
|
|
|
959
841
|
```javascript
|
|
960
842
|
sock.sendMessage(jid, {
|
|
961
|
-
cover: {
|
|
962
|
-
url: './path/to/image.webp'
|
|
963
|
-
},
|
|
843
|
+
cover: { url: './path/to/image.webp' },
|
|
964
844
|
stickers: [{
|
|
965
|
-
data: {
|
|
966
|
-
url: './path/to/image.webp'
|
|
967
|
-
}
|
|
845
|
+
data: { url: './path/to/image.webp' }
|
|
968
846
|
}, {
|
|
969
|
-
data: {
|
|
970
|
-
url: './path/to/image.webp'
|
|
971
|
-
}
|
|
972
|
-
}, {
|
|
973
|
-
data: {
|
|
974
|
-
url: './path/to/image.webp'
|
|
975
|
-
}
|
|
847
|
+
data: { url: './path/to/image.webp' }
|
|
976
848
|
}],
|
|
977
849
|
name: '๐ฆ My Sticker Pack',
|
|
978
|
-
publisher: '
|
|
979
|
-
description: '
|
|
980
|
-
}, {
|
|
981
|
-
quoted: message
|
|
982
|
-
})
|
|
850
|
+
publisher: 'MegaBot',
|
|
851
|
+
description: 'Custom sticker pack'
|
|
852
|
+
}, { quoted: message })
|
|
983
853
|
```
|
|
984
854
|
|
|
985
855
|
### ๐๐ป Sending Interactive Messages
|
|
@@ -987,25 +857,21 @@ sock.sendMessage(jid, {
|
|
|
987
857
|
#### ๐ Buttons
|
|
988
858
|
|
|
989
859
|
```javascript
|
|
990
|
-
// ---
|
|
860
|
+
// --- Basic buttons
|
|
991
861
|
sock.sendMessage(jid, {
|
|
992
862
|
text: '๐๐ป Buttons!',
|
|
993
|
-
footer: '
|
|
863
|
+
footer: 'MegaBot',
|
|
994
864
|
buttons: [{
|
|
995
|
-
text: '๐๐ป
|
|
865
|
+
text: '๐๐ป Sign Up',
|
|
996
866
|
id: '#SignUp'
|
|
997
867
|
}]
|
|
998
|
-
}, {
|
|
999
|
-
quoted: message
|
|
1000
|
-
})
|
|
868
|
+
}, { quoted: message })
|
|
1001
869
|
|
|
1002
|
-
// --- Buttons with
|
|
870
|
+
// --- Buttons with media and native flow
|
|
1003
871
|
sock.sendMessage(jid, {
|
|
1004
|
-
image: {
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
caption: '๐๐ป Buttons and Native Flow!',
|
|
1008
|
-
footer: '@lordmega/baileys',
|
|
872
|
+
image: { url: './path/to/image.jpg' },
|
|
873
|
+
caption: '๐๐ป Buttons with Native Flow!',
|
|
874
|
+
footer: 'MegaBot',
|
|
1009
875
|
buttons: [{
|
|
1010
876
|
text: '๐๐ป Rating',
|
|
1011
877
|
id: '#Rating'
|
|
@@ -1019,31 +885,20 @@ sock.sendMessage(jid, {
|
|
|
1019
885
|
description: '',
|
|
1020
886
|
id: '#SecretIngredient'
|
|
1021
887
|
}]
|
|
1022
|
-
}, {
|
|
1023
|
-
title: 'โจ Section 2',
|
|
1024
|
-
highlight_label: '๐ฅ Popular',
|
|
1025
|
-
rows: [{
|
|
1026
|
-
header: '',
|
|
1027
|
-
title: '๐ท๏ธ Coupon',
|
|
1028
|
-
description: '',
|
|
1029
|
-
id: '#CouponCode'
|
|
1030
|
-
}]
|
|
1031
888
|
}]
|
|
1032
889
|
}]
|
|
1033
|
-
}, {
|
|
1034
|
-
quoted: message
|
|
1035
|
-
})
|
|
890
|
+
}, { quoted: message })
|
|
1036
891
|
```
|
|
1037
892
|
|
|
1038
893
|
#### ๐ List
|
|
1039
894
|
|
|
1040
895
|
> [!NOTE]
|
|
1041
|
-
>
|
|
896
|
+
> Only works in private chats (`@s.whatsapp.net`).
|
|
1042
897
|
|
|
1043
898
|
```javascript
|
|
1044
899
|
sock.sendMessage(jid, {
|
|
1045
|
-
text: '๐
|
|
1046
|
-
footer: '
|
|
900
|
+
text: '๐ Pick an option',
|
|
901
|
+
footer: 'MegaBot',
|
|
1047
902
|
buttonText: '๐ Select',
|
|
1048
903
|
title: '๐๐ป Hello',
|
|
1049
904
|
sections: [{
|
|
@@ -1061,130 +916,82 @@ sock.sendMessage(jid, {
|
|
|
1061
916
|
rowId: '#Search'
|
|
1062
917
|
}]
|
|
1063
918
|
}]
|
|
1064
|
-
}, {
|
|
1065
|
-
quoted: message
|
|
1066
|
-
})
|
|
919
|
+
}, { quoted: message })
|
|
1067
920
|
```
|
|
1068
921
|
|
|
1069
922
|
#### ๐๏ธ Interactive
|
|
1070
923
|
|
|
1071
924
|
```javascript
|
|
1072
|
-
// --- Native
|
|
925
|
+
// --- Native flow
|
|
1073
926
|
sock.sendMessage(jid, {
|
|
1074
|
-
image: {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
offerUrl: 'https://www.npmjs.com/package/@lordmega/baileys', // --- Optional
|
|
1084
|
-
offerExpiration: Date.now() + 3_600_000, // --- Optional
|
|
927
|
+
image: { url: './path/to/image.jpg' },
|
|
928
|
+
caption: '๐๏ธ Interactive!',
|
|
929
|
+
footer: 'MegaBot',
|
|
930
|
+
optionText: '๐๐ป Select Options',
|
|
931
|
+
optionTitle: '๐ Options',
|
|
932
|
+
offerText: '๐ท๏ธ Latest Deal!',
|
|
933
|
+
offerCode: 'MEGA2024',
|
|
934
|
+
offerUrl: 'https://example.com',
|
|
935
|
+
offerExpiration: Date.now() + 3_600_000,
|
|
1085
936
|
nativeFlow: [{
|
|
1086
937
|
text: '๐๐ป Greeting',
|
|
1087
938
|
id: '#Greeting',
|
|
1088
|
-
icon: 'review'
|
|
939
|
+
icon: 'review'
|
|
1089
940
|
}, {
|
|
1090
941
|
text: '๐ Call',
|
|
1091
942
|
call: '628123456789'
|
|
1092
943
|
}, {
|
|
1093
944
|
text: '๐ Copy',
|
|
1094
|
-
copy: '
|
|
945
|
+
copy: 'some-text'
|
|
1095
946
|
}, {
|
|
1096
|
-
text: '๐
|
|
1097
|
-
url: 'https://
|
|
1098
|
-
useWebview: true
|
|
947
|
+
text: '๐ Visit',
|
|
948
|
+
url: 'https://example.com',
|
|
949
|
+
useWebview: true
|
|
1099
950
|
}, {
|
|
1100
951
|
text: '๐ Select',
|
|
1101
952
|
sections: [{
|
|
1102
953
|
title: 'โจ Section 1',
|
|
1103
954
|
rows: [{
|
|
1104
955
|
header: '',
|
|
1105
|
-
title: '๐ท๏ธ
|
|
956
|
+
title: '๐ท๏ธ Option A',
|
|
1106
957
|
description: '',
|
|
1107
|
-
id: '#
|
|
1108
|
-
}]
|
|
1109
|
-
}, {
|
|
1110
|
-
title: 'โจ Section 2',
|
|
1111
|
-
highlight_label: '๐ฅ Popular',
|
|
1112
|
-
rows: [{
|
|
1113
|
-
header: '',
|
|
1114
|
-
title: '๐ญ Secret Ingredient',
|
|
1115
|
-
description: '',
|
|
1116
|
-
id: '#SecretIngredient'
|
|
958
|
+
id: '#OptionA'
|
|
1117
959
|
}]
|
|
1118
960
|
}],
|
|
1119
|
-
icon: 'default'
|
|
1120
|
-
}]
|
|
1121
|
-
|
|
1122
|
-
}, {
|
|
1123
|
-
quoted: message
|
|
1124
|
-
})
|
|
961
|
+
icon: 'default'
|
|
962
|
+
}]
|
|
963
|
+
}, { quoted: message })
|
|
1125
964
|
|
|
1126
|
-
// --- Carousel
|
|
965
|
+
// --- Carousel with native flow
|
|
1127
966
|
sock.sendMessage(jid, {
|
|
1128
|
-
text: '๐๏ธ
|
|
1129
|
-
footer: '
|
|
967
|
+
text: '๐๏ธ Carousel!',
|
|
968
|
+
footer: 'MegaBot',
|
|
1130
969
|
cards: [{
|
|
1131
|
-
image: {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
caption: '๐ผ๏ธ Image 1',
|
|
1135
|
-
footer: '๐ท๏ธ๏ธ Pinterest',
|
|
970
|
+
image: { url: './path/to/image.jpg' },
|
|
971
|
+
caption: '๐ผ๏ธ Slide 1',
|
|
972
|
+
footer: '๐ท๏ธ Tag',
|
|
1136
973
|
nativeFlow: [{
|
|
1137
|
-
text: '๐
|
|
1138
|
-
url: 'https://
|
|
974
|
+
text: '๐ Visit',
|
|
975
|
+
url: 'https://example.com',
|
|
1139
976
|
useWebview: true
|
|
1140
977
|
}]
|
|
1141
978
|
}, {
|
|
1142
|
-
image: {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
caption: '๐ผ๏ธ Image 2',
|
|
1146
|
-
footer: '๐ท๏ธ Pinterest',
|
|
1147
|
-
offerText: '๐ท๏ธ New Coupon!',
|
|
1148
|
-
offerCode: '@lordmega/baileys',
|
|
1149
|
-
offerUrl: 'https://www.npmjs.com/package/@lordmega/baileys',
|
|
1150
|
-
offerExpiration: Date.now() + 3_600_000,
|
|
1151
|
-
nativeFlow: [{
|
|
1152
|
-
text: '๐ Source',
|
|
1153
|
-
url: 'https://www.npmjs.com/package/@lordmega/baileys'
|
|
1154
|
-
}]
|
|
1155
|
-
}, {
|
|
1156
|
-
image: {
|
|
1157
|
-
url: './path/to/image.jpg'
|
|
1158
|
-
},
|
|
1159
|
-
caption: '๐ผ๏ธ Image 3',
|
|
1160
|
-
footer: '๐ท๏ธ Pinterest',
|
|
1161
|
-
optionText: '๐๐ป Select Options',
|
|
1162
|
-
optionTitle: '๐๐ป Select Options',
|
|
1163
|
-
offerText: '๐ท๏ธ New Coupon!',
|
|
1164
|
-
offerCode: '@lordmega/baileys',
|
|
1165
|
-
offerUrl: 'https://www.npmjs.com/package/@lordmega/baileys',
|
|
1166
|
-
offerExpiration: Date.now() + 3_600_000,
|
|
979
|
+
image: { url: './path/to/image.jpg' },
|
|
980
|
+
caption: '๐ผ๏ธ Slide 2',
|
|
981
|
+
footer: '๐ท๏ธ Tag',
|
|
1167
982
|
nativeFlow: [{
|
|
1168
|
-
text: '
|
|
1169
|
-
|
|
1170
|
-
icon: 'default'
|
|
1171
|
-
}, {
|
|
1172
|
-
text: '๐ Source',
|
|
1173
|
-
url: 'https://www.npmjs.com/package/@lordmega/baileys'
|
|
983
|
+
text: '๐ Visit',
|
|
984
|
+
url: 'https://example.com'
|
|
1174
985
|
}]
|
|
1175
986
|
}]
|
|
1176
|
-
}, {
|
|
1177
|
-
quoted: message
|
|
1178
|
-
})
|
|
987
|
+
}, { quoted: message })
|
|
1179
988
|
|
|
1180
|
-
// --- Native
|
|
989
|
+
// --- Native flow with audio footer
|
|
1181
990
|
sock.sendMessage(jid, {
|
|
1182
|
-
text: '๐
|
|
1183
|
-
audioFooter: {
|
|
1184
|
-
url: './path/to/audio.mp3'
|
|
1185
|
-
}, // --- Like other media upload methods, buffers and streams are supported
|
|
991
|
+
text: '๐ Audio in footer!',
|
|
992
|
+
audioFooter: { url: './path/to/audio.mp3' },
|
|
1186
993
|
nativeFlow: [{
|
|
1187
|
-
text: '๐๐ป
|
|
994
|
+
text: '๐๐ป Next',
|
|
1188
995
|
id: '#Next',
|
|
1189
996
|
icon: 'review'
|
|
1190
997
|
}, {
|
|
@@ -1192,9 +999,7 @@ sock.sendMessage(jid, {
|
|
|
1192
999
|
id: '#Skip',
|
|
1193
1000
|
icon: 'default'
|
|
1194
1001
|
}]
|
|
1195
|
-
}, {
|
|
1196
|
-
quoted: message
|
|
1197
|
-
})
|
|
1002
|
+
}, { quoted: message })
|
|
1198
1003
|
```
|
|
1199
1004
|
|
|
1200
1005
|
#### ๐ซ Hydrated Template
|
|
@@ -1202,24 +1007,20 @@ sock.sendMessage(jid, {
|
|
|
1202
1007
|
```javascript
|
|
1203
1008
|
sock.sendMessage(jid, {
|
|
1204
1009
|
title: '๐๐ป Hello',
|
|
1205
|
-
image: {
|
|
1206
|
-
url: './path/to/image.jpg'
|
|
1207
|
-
},
|
|
1010
|
+
image: { url: './path/to/image.jpg' },
|
|
1208
1011
|
caption: '๐ซ Template!',
|
|
1209
|
-
footer: '
|
|
1012
|
+
footer: 'MegaBot',
|
|
1210
1013
|
templateButtons: [{
|
|
1211
|
-
text: '
|
|
1014
|
+
text: '๐๐ป Tap Here',
|
|
1212
1015
|
id: '#Order'
|
|
1213
1016
|
}, {
|
|
1214
|
-
text: '๐
|
|
1215
|
-
url: 'https://
|
|
1017
|
+
text: '๐ Visit',
|
|
1018
|
+
url: 'https://example.com'
|
|
1216
1019
|
}, {
|
|
1217
1020
|
text: '๐ Call',
|
|
1218
1021
|
call: '628123456789'
|
|
1219
1022
|
}]
|
|
1220
|
-
}, {
|
|
1221
|
-
quoted: message
|
|
1222
|
-
})
|
|
1023
|
+
}, { quoted: message })
|
|
1223
1024
|
```
|
|
1224
1025
|
|
|
1225
1026
|
### ๐ณ Sending Payment Messages
|
|
@@ -1235,13 +1036,11 @@ sock.sendMessage(jid, {
|
|
|
1235
1036
|
#### ๐งพ Invoice
|
|
1236
1037
|
|
|
1237
1038
|
> [!NOTE]
|
|
1238
|
-
> Invoice
|
|
1039
|
+
> Invoice messages are not fully supported yet.
|
|
1239
1040
|
|
|
1240
1041
|
```javascript
|
|
1241
1042
|
sock.sendMessage(jid, {
|
|
1242
|
-
image: {
|
|
1243
|
-
url: './path/to/image.jpg'
|
|
1244
|
-
},
|
|
1043
|
+
image: { url: './path/to/image.jpg' },
|
|
1245
1044
|
invoiceNote: '๐ท๏ธ Invoice'
|
|
1246
1045
|
})
|
|
1247
1046
|
```
|
|
@@ -1249,19 +1048,17 @@ sock.sendMessage(jid, {
|
|
|
1249
1048
|
#### ๐๏ธ Order
|
|
1250
1049
|
|
|
1251
1050
|
```javascript
|
|
1252
|
-
sock.sendMessage(
|
|
1253
|
-
orderText: '๐๏ธ Order',
|
|
1254
|
-
thumbnail: fs.readFileSync('./path/to/image.jpg') //
|
|
1255
|
-
}, {
|
|
1256
|
-
quoted: message
|
|
1257
|
-
})
|
|
1051
|
+
sock.sendMessage(jid, {
|
|
1052
|
+
orderText: '๐๏ธ Your Order',
|
|
1053
|
+
thumbnail: fs.readFileSync('./path/to/image.jpg') // Must be a Buffer
|
|
1054
|
+
}, { quoted: message })
|
|
1258
1055
|
```
|
|
1259
1056
|
|
|
1260
1057
|
#### ๐ณ Request Payment
|
|
1261
1058
|
|
|
1262
1059
|
```javascript
|
|
1263
1060
|
sock.sendMessage(jid, {
|
|
1264
|
-
text: '๐ณ Request
|
|
1061
|
+
text: '๐ณ Payment Request',
|
|
1265
1062
|
requestPaymentFrom: '0@s.whatsapp.net'
|
|
1266
1063
|
})
|
|
1267
1064
|
```
|
|
@@ -1271,30 +1068,21 @@ sock.sendMessage(jid, {
|
|
|
1271
1068
|
#### ๐ค AI Icon
|
|
1272
1069
|
|
|
1273
1070
|
> [!NOTE]
|
|
1274
|
-
>
|
|
1071
|
+
> Only works in private chats (`@s.whatsapp.net`).
|
|
1275
1072
|
|
|
1276
1073
|
```javascript
|
|
1277
1074
|
sock.sendMessage(jid, {
|
|
1278
|
-
image: {
|
|
1279
|
-
|
|
1280
|
-
},
|
|
1281
|
-
caption: '๐ค With AI icon!',
|
|
1075
|
+
image: { url: './path/to/image.jpg' },
|
|
1076
|
+
caption: '๐ค AI-tagged message',
|
|
1282
1077
|
ai: true
|
|
1283
|
-
}, {
|
|
1284
|
-
quoted: message
|
|
1285
|
-
})
|
|
1078
|
+
}, { quoted: message })
|
|
1286
1079
|
```
|
|
1287
1080
|
|
|
1288
1081
|
#### ๐ Ephemeral
|
|
1289
1082
|
|
|
1290
|
-
> [!NOTE]
|
|
1291
|
-
> Wrap message into `ephemeralMessage`
|
|
1292
|
-
|
|
1293
1083
|
```javascript
|
|
1294
1084
|
sock.sendMessage(jid, {
|
|
1295
|
-
image: {
|
|
1296
|
-
url: './path/to/image.jpg'
|
|
1297
|
-
},
|
|
1085
|
+
image: { url: './path/to/image.jpg' },
|
|
1298
1086
|
caption: '๐๏ธ Ephemeral',
|
|
1299
1087
|
ephemeral: true
|
|
1300
1088
|
})
|
|
@@ -1302,49 +1090,37 @@ sock.sendMessage(jid, {
|
|
|
1302
1090
|
|
|
1303
1091
|
#### ๐ฐ External Ad Reply
|
|
1304
1092
|
|
|
1305
|
-
> [!NOTE]
|
|
1306
|
-
> Add an ad thumbnail to messages (may not be displayed on some WhatsApp versions).
|
|
1307
|
-
|
|
1308
1093
|
```javascript
|
|
1309
1094
|
sock.sendMessage(jid, {
|
|
1310
|
-
text: '๐ฐ
|
|
1095
|
+
text: '๐ฐ Ad Reply',
|
|
1311
1096
|
externalAdReply: {
|
|
1312
1097
|
title: '๐ Did you know?',
|
|
1313
|
-
body: 'โ
|
|
1314
|
-
thumbnail: fs.readFileSync('./path/to/image.jpg'),
|
|
1315
|
-
largeThumbnail: false,
|
|
1316
|
-
url: 'https://
|
|
1098
|
+
body: 'โ Interesting fact',
|
|
1099
|
+
thumbnail: fs.readFileSync('./path/to/image.jpg'),
|
|
1100
|
+
largeThumbnail: false,
|
|
1101
|
+
url: 'https://example.com'
|
|
1317
1102
|
}
|
|
1318
|
-
}, {
|
|
1319
|
-
quoted: message
|
|
1320
|
-
})
|
|
1103
|
+
}, { quoted: message })
|
|
1321
1104
|
```
|
|
1322
1105
|
|
|
1323
1106
|
#### ๐งโ๐งโ๐ง Group Status
|
|
1324
1107
|
|
|
1325
1108
|
> [!NOTE]
|
|
1326
|
-
>
|
|
1109
|
+
> Only works in group chats (`@g.us`).
|
|
1327
1110
|
|
|
1328
1111
|
```javascript
|
|
1329
1112
|
sock.sendMessage(jid, {
|
|
1330
|
-
image: {
|
|
1331
|
-
|
|
1332
|
-
},
|
|
1333
|
-
caption: '๐ฅ Group Status!',
|
|
1113
|
+
image: { url: './path/to/image.jpg' },
|
|
1114
|
+
caption: '๐ฅ Group Status',
|
|
1334
1115
|
groupStatus: true
|
|
1335
1116
|
})
|
|
1336
1117
|
```
|
|
1337
1118
|
|
|
1338
1119
|
#### ๐ฑ Lottie Sticker
|
|
1339
1120
|
|
|
1340
|
-
> [!NOTE]
|
|
1341
|
-
> Wrap message into `lottieStickerMessage`
|
|
1342
|
-
|
|
1343
1121
|
```javascript
|
|
1344
1122
|
sock.sendMessage(jid, {
|
|
1345
|
-
sticker: {
|
|
1346
|
-
url: './path/to/sticker.webp'
|
|
1347
|
-
},
|
|
1123
|
+
sticker: { url: './path/to/sticker.webp' },
|
|
1348
1124
|
isLottie: true
|
|
1349
1125
|
})
|
|
1350
1126
|
```
|
|
@@ -1354,10 +1130,10 @@ sock.sendMessage(jid, {
|
|
|
1354
1130
|
```javascript
|
|
1355
1131
|
sock.sendMessage(jid, {
|
|
1356
1132
|
extendedTextMessage: {
|
|
1357
|
-
text: '๐
|
|
1133
|
+
text: '๐ Manually constructed proto message',
|
|
1358
1134
|
contextInfo: {
|
|
1359
1135
|
externalAdReply: {
|
|
1360
|
-
title: '
|
|
1136
|
+
title: 'MegaBot',
|
|
1361
1137
|
thumbnail: fs.readFileSync('./path/to/image.jpg'),
|
|
1362
1138
|
sourceApp: 'whatsapp',
|
|
1363
1139
|
showAdAttribution: true,
|
|
@@ -1366,30 +1142,23 @@ sock.sendMessage(jid, {
|
|
|
1366
1142
|
}
|
|
1367
1143
|
},
|
|
1368
1144
|
raw: true
|
|
1369
|
-
}, {
|
|
1370
|
-
quoted: message
|
|
1371
|
-
})
|
|
1145
|
+
}, { quoted: message })
|
|
1372
1146
|
```
|
|
1373
1147
|
|
|
1374
1148
|
#### ๐ท๏ธ Secure Meta Service Label
|
|
1375
1149
|
|
|
1376
1150
|
```javascript
|
|
1377
1151
|
sock.sendMessage(jid, {
|
|
1378
|
-
text: '๐ท๏ธ
|
|
1152
|
+
text: '๐ท๏ธ Labeled message',
|
|
1379
1153
|
secureMetaServiceLabel: true
|
|
1380
1154
|
})
|
|
1381
1155
|
```
|
|
1382
1156
|
|
|
1383
1157
|
#### ๐ Spoiler
|
|
1384
1158
|
|
|
1385
|
-
> [!NOTE]
|
|
1386
|
-
> Wrap message into `spoilerMessage`
|
|
1387
|
-
|
|
1388
1159
|
```javascript
|
|
1389
1160
|
sock.sendMessage(jid, {
|
|
1390
|
-
image: {
|
|
1391
|
-
url: './path/to/image.jpg'
|
|
1392
|
-
},
|
|
1161
|
+
image: { url: './path/to/image.jpg' },
|
|
1393
1162
|
caption: 'โ Spoiler',
|
|
1394
1163
|
spoiler: true
|
|
1395
1164
|
})
|
|
@@ -1397,14 +1166,9 @@ sock.sendMessage(jid, {
|
|
|
1397
1166
|
|
|
1398
1167
|
#### ๐๏ธ View Once
|
|
1399
1168
|
|
|
1400
|
-
> [!NOTE]
|
|
1401
|
-
> Wrap message into `viewOnceMessage`
|
|
1402
|
-
|
|
1403
1169
|
```javascript
|
|
1404
1170
|
sock.sendMessage(jid, {
|
|
1405
|
-
image: {
|
|
1406
|
-
url: './path/to/image.jpg'
|
|
1407
|
-
},
|
|
1171
|
+
image: { url: './path/to/image.jpg' },
|
|
1408
1172
|
caption: '๐๏ธ View Once',
|
|
1409
1173
|
viewOnce: true
|
|
1410
1174
|
})
|
|
@@ -1412,14 +1176,9 @@ sock.sendMessage(jid, {
|
|
|
1412
1176
|
|
|
1413
1177
|
#### ๐๏ธ View Once V2
|
|
1414
1178
|
|
|
1415
|
-
> [!NOTE]
|
|
1416
|
-
> Wrap message into `viewOnceMessageV2`
|
|
1417
|
-
|
|
1418
1179
|
```javascript
|
|
1419
1180
|
sock.sendMessage(jid, {
|
|
1420
|
-
image: {
|
|
1421
|
-
url: './path/to/image.jpg'
|
|
1422
|
-
},
|
|
1181
|
+
image: { url: './path/to/image.jpg' },
|
|
1423
1182
|
caption: '๐๏ธ View Once V2',
|
|
1424
1183
|
viewOnceV2: true
|
|
1425
1184
|
})
|
|
@@ -1427,14 +1186,9 @@ sock.sendMessage(jid, {
|
|
|
1427
1186
|
|
|
1428
1187
|
#### ๐๏ธ View Once V2 Extension
|
|
1429
1188
|
|
|
1430
|
-
> [!NOTE]
|
|
1431
|
-
> Wrap message into `viewOnceMessageV2Extension`
|
|
1432
|
-
|
|
1433
1189
|
```javascript
|
|
1434
1190
|
sock.sendMessage(jid, {
|
|
1435
|
-
image: {
|
|
1436
|
-
url: './path/to/image.jpg'
|
|
1437
|
-
},
|
|
1191
|
+
image: { url: './path/to/image.jpg' },
|
|
1438
1192
|
caption: '๐๏ธ View Once V2 Extension',
|
|
1439
1193
|
viewOnceV2Extension: true
|
|
1440
1194
|
})
|
|
@@ -1453,15 +1207,15 @@ sock.sendMessage(jid, {
|
|
|
1453
1207
|
#### โ๏ธ Edit Messages
|
|
1454
1208
|
|
|
1455
1209
|
```javascript
|
|
1456
|
-
// --- Edit
|
|
1210
|
+
// --- Edit text
|
|
1457
1211
|
sock.sendMessage(jid, {
|
|
1458
|
-
text: 'โจ
|
|
1212
|
+
text: 'โจ Corrected message',
|
|
1459
1213
|
edit: message.key
|
|
1460
1214
|
})
|
|
1461
1215
|
|
|
1462
|
-
// --- Edit media
|
|
1216
|
+
// --- Edit media caption
|
|
1463
1217
|
sock.sendMessage(jid, {
|
|
1464
|
-
caption: 'โจ
|
|
1218
|
+
caption: 'โจ Updated caption',
|
|
1465
1219
|
edit: message.key
|
|
1466
1220
|
})
|
|
1467
1221
|
```
|
|
@@ -1471,537 +1225,226 @@ sock.sendMessage(jid, {
|
|
|
1471
1225
|
#### ๐ท๏ธ Find User ID (JID|PN/LID)
|
|
1472
1226
|
|
|
1473
1227
|
> [!NOTE]
|
|
1474
|
-
>
|
|
1228
|
+
> Numbers only โ no `+`, `()`, or `-`. Must include country code.
|
|
1475
1229
|
|
|
1476
1230
|
```javascript
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
const ids = await sock.findUserId(phoneNumber)
|
|
1231
|
+
const ids = await sock.findUserId('6281111111111@s.whatsapp.net')
|
|
1232
|
+
console.log('๐ท๏ธ User ID:', ids)
|
|
1481
1233
|
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
//
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
const ids = await sock.findUserId(lid)
|
|
1488
|
-
|
|
1489
|
-
console.log('๐ท๏ธ Got user ID', ':', ids)
|
|
1490
|
-
|
|
1491
|
-
// --- Output
|
|
1492
|
-
// {
|
|
1493
|
-
// phoneNumber: '6281111111111@s.whatsapp.net',
|
|
1494
|
-
// lid: '43411111111111@lid'
|
|
1495
|
-
// }
|
|
1496
|
-
// --- Output when failed
|
|
1497
|
-
// {
|
|
1498
|
-
// phoneNumber: '6281111111111@s.whatsapp.net',
|
|
1499
|
-
// lid: undefined
|
|
1500
|
-
// }
|
|
1501
|
-
// --- Same output shape regardless of input type
|
|
1234
|
+
// Output:
|
|
1235
|
+
// { phoneNumber: '6281111111111@s.whatsapp.net', lid: '43411111111111@lid' }
|
|
1236
|
+
// On failure:
|
|
1237
|
+
// { phoneNumber: '6281111111111@s.whatsapp.net', lid: undefined }
|
|
1502
1238
|
```
|
|
1503
1239
|
|
|
1504
1240
|
#### ๐ Request Custom Pairing Code
|
|
1505
1241
|
|
|
1506
|
-
> [!NOTE]
|
|
1507
|
-
> The phone number must contain numbers only (no +, (), or -) and must include the country code.
|
|
1508
|
-
|
|
1509
1242
|
```javascript
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
await sock.requestPairingCode(phoneNumber, customPairingCode)
|
|
1514
|
-
|
|
1515
|
-
console.log('๐ Pairing code', ':', customPairingCode)
|
|
1243
|
+
await sock.requestPairingCode('6281111111111', 'MYCODE')
|
|
1244
|
+
console.log('๐ Pairing code: MYCODE')
|
|
1516
1245
|
```
|
|
1517
1246
|
|
|
1518
1247
|
#### ๐ผ๏ธ Image Processing
|
|
1519
1248
|
|
|
1520
|
-
> [!NOTE]
|
|
1521
|
-
> Automatically use available image processing library: `sharp`, `@napi-rs/image`, or `jimp`
|
|
1522
|
-
|
|
1523
1249
|
```javascript
|
|
1524
1250
|
import { getImageProcessingLibrary } from '@lordmega/baileys'
|
|
1525
1251
|
import { readFile } from 'fs/promises'
|
|
1526
1252
|
|
|
1527
1253
|
const lib = await getImageProcessingLibrary()
|
|
1528
|
-
|
|
1529
|
-
const bufferOrFilePath = './path/to/image.jpg'
|
|
1254
|
+
const input = './path/to/image.jpg'
|
|
1530
1255
|
const width = 512
|
|
1531
|
-
|
|
1532
1256
|
let output
|
|
1533
1257
|
|
|
1534
|
-
// --- If sharp installed
|
|
1535
1258
|
if (lib.sharp?.default) {
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
output = await img.resize(width)
|
|
1259
|
+
output = await lib.sharp.default(input)
|
|
1260
|
+
.resize(width)
|
|
1539
1261
|
.jpeg({ quality: 80 })
|
|
1540
1262
|
.toBuffer()
|
|
1541
1263
|
}
|
|
1542
|
-
|
|
1543
|
-
// --- If @napi-rs/image installed
|
|
1544
1264
|
else if (lib.image?.Transformer) {
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
: await readFile(bufferOrFilePath)
|
|
1549
|
-
|
|
1550
|
-
const img = new lib.image.Transformer(inputBuffer)
|
|
1551
|
-
|
|
1552
|
-
output = await img.resize(width, undefined, 0)
|
|
1265
|
+
const buf = Buffer.isBuffer(input) ? input : await readFile(input)
|
|
1266
|
+
output = await new lib.image.Transformer(buf)
|
|
1267
|
+
.resize(width, undefined, 0)
|
|
1553
1268
|
.jpeg(50)
|
|
1554
1269
|
}
|
|
1555
|
-
|
|
1556
|
-
// --- If jimp installed
|
|
1557
1270
|
else if (lib.jimp?.Jimp) {
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
output = await img
|
|
1271
|
+
output = await (await lib.jimp.Jimp.read(input))
|
|
1561
1272
|
.resize({ w: width, mode: lib.jimp.ResizeStrategy.BILINEAR })
|
|
1562
1273
|
.getBuffer('image/jpeg', { quality: 50 })
|
|
1563
1274
|
}
|
|
1564
|
-
|
|
1565
|
-
// --- Fallback
|
|
1566
1275
|
else {
|
|
1567
|
-
throw new Error('No image processing available')
|
|
1276
|
+
throw new Error('No image processing library available')
|
|
1568
1277
|
}
|
|
1569
|
-
|
|
1570
|
-
console.log('โ
Process completed!')
|
|
1571
|
-
console.dir(output, { depth: null })
|
|
1572
1278
|
```
|
|
1573
1279
|
|
|
1574
1280
|
#### ๐ฃ Newsletter Management
|
|
1575
1281
|
|
|
1576
1282
|
```javascript
|
|
1577
|
-
|
|
1578
|
-
sock.newsletterCreate('@lordmega/baileys', '๐ฃ Fresh updates weekly')
|
|
1579
|
-
|
|
1580
|
-
// --- Get info
|
|
1283
|
+
sock.newsletterCreate('Name', 'Description')
|
|
1581
1284
|
const metadata = sock.newsletterMetadata('1231111111111@newsletter')
|
|
1582
|
-
console.dir(metadata, { depth: null })
|
|
1583
|
-
|
|
1584
|
-
// --- Get subscribers count
|
|
1585
1285
|
const subscribers = await sock.newsletterSubscribers('1231111111111@newsletter')
|
|
1586
|
-
console.dir(subscribers, { depth: null })
|
|
1587
|
-
|
|
1588
|
-
// --- Follow and Unfollow
|
|
1589
1286
|
sock.newsletterFollow('1231111111111@newsletter')
|
|
1590
1287
|
sock.newsletterUnfollow('1231111111111@newsletter')
|
|
1591
|
-
|
|
1592
|
-
// --- Mute and Unmute
|
|
1593
1288
|
sock.newsletterMute('1231111111111@newsletter')
|
|
1594
1289
|
sock.newsletterUnmute('1231111111111@newsletter')
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
sock.
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
sock.
|
|
1601
|
-
|
|
1602
|
-
// --- Update newsletter
|
|
1603
|
-
sock.newsletterUpdate('1231111111111@newsletter', { name: '@lordmega/baileys' })
|
|
1604
|
-
|
|
1605
|
-
// --- Change name
|
|
1606
|
-
sock.newsletterUpdateName('1231111111111@newsletter', '๐ฆ @lordmega/baileys')
|
|
1607
|
-
|
|
1608
|
-
// --- Change description
|
|
1609
|
-
sock.newsletterUpdateDescription('1231111111111@newsletter', '๐ฃ Fresh updates weekly')
|
|
1610
|
-
|
|
1611
|
-
// --- Change photo
|
|
1612
|
-
sock.newsletterUpdatePicture('1231111111111@newsletter', {
|
|
1613
|
-
url: 'path/to/image.jpg'
|
|
1614
|
-
})
|
|
1615
|
-
|
|
1616
|
-
// --- Remove photo
|
|
1290
|
+
sock.newsletterDemote('1231111111111@newsletter', '628...@s.whatsapp.net')
|
|
1291
|
+
sock.newsletterChangeOwner('1231111111111@newsletter', '628...@s.whatsapp.net')
|
|
1292
|
+
sock.newsletterUpdate('1231111111111@newsletter', { name: 'New Name' })
|
|
1293
|
+
sock.newsletterUpdateName('1231111111111@newsletter', 'New Name')
|
|
1294
|
+
sock.newsletterUpdateDescription('1231111111111@newsletter', 'New description')
|
|
1295
|
+
sock.newsletterUpdatePicture('1231111111111@newsletter', { url: 'path/to/image.jpg' })
|
|
1617
1296
|
sock.newsletterRemovePicture('1231111111111@newsletter')
|
|
1618
|
-
|
|
1619
|
-
// --- React to a message
|
|
1620
1297
|
sock.newsletterReactMessage('1231111111111@newsletter', '100', '๐')
|
|
1621
|
-
|
|
1622
|
-
// --- Get admin count
|
|
1623
1298
|
const count = await sock.newsletterAdminCount('1231111111111@newsletter')
|
|
1624
|
-
|
|
1625
|
-
// --- Get all subscribed newsletters
|
|
1626
1299
|
const newsletters = await sock.newsletterSubscribed()
|
|
1627
|
-
console.dir(newsletters, { depth: null })
|
|
1628
|
-
|
|
1629
|
-
// --- Fetch newsletter messages
|
|
1630
1300
|
const messages = sock.newsletterFetchMessages('jid', '1231111111111@newsletter', 50, 0, 0)
|
|
1631
|
-
console.dir(messages, { depth: null })
|
|
1632
|
-
|
|
1633
|
-
// --- Delete newsletter
|
|
1634
1301
|
sock.newsletterDelete('1231111111111@newsletter')
|
|
1635
1302
|
```
|
|
1636
1303
|
|
|
1637
1304
|
#### ๐ฅ Group Management
|
|
1638
1305
|
|
|
1639
1306
|
```javascript
|
|
1640
|
-
|
|
1641
|
-
const group = sock.groupCreate('@lordmega/baileys', ['628123456789@s.whatsapp.net'])
|
|
1642
|
-
console.dir(group, { depth: null })
|
|
1643
|
-
|
|
1644
|
-
// --- Get info
|
|
1307
|
+
const group = sock.groupCreate('Group Name', ['628...@s.whatsapp.net'])
|
|
1645
1308
|
const metadata = await sock.groupMetadata(jid)
|
|
1646
|
-
console.dir(metadata, { depth: null })
|
|
1647
|
-
|
|
1648
|
-
// --- Get group invite code
|
|
1649
1309
|
const inviteCode = await sock.groupInviteCode(jid)
|
|
1650
|
-
console.dir(inviteCode, { depth: null })
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
// --- Revoke invite link
|
|
1654
1310
|
sock.groupRevokeInvite(jid)
|
|
1655
|
-
|
|
1656
|
-
// --- Accept group invite
|
|
1657
1311
|
sock.groupAcceptInvite(inviteCode)
|
|
1658
|
-
|
|
1659
|
-
// --- Leave group
|
|
1660
1312
|
sock.groupLeave(jid)
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
sock.groupParticipantsUpdate(jid, ['
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
sock.
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'promote')
|
|
1670
|
-
|
|
1671
|
-
// --- Demote from admin
|
|
1672
|
-
sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'demote')
|
|
1673
|
-
|
|
1674
|
-
// --- Accept join requests
|
|
1675
|
-
sock.groupRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
|
|
1676
|
-
|
|
1677
|
-
// --- Change name
|
|
1678
|
-
sock.groupUpdateSubject(jid, '๐ฆ @lordmega/baileys')
|
|
1679
|
-
|
|
1680
|
-
// --- Change description
|
|
1681
|
-
sock.groupUpdateDescription(jid, 'Updated description')
|
|
1682
|
-
|
|
1683
|
-
// --- Change photo
|
|
1684
|
-
sock.updateProfilePicture(jid, {
|
|
1685
|
-
url: 'path/to/image.jpg'
|
|
1686
|
-
})
|
|
1687
|
-
|
|
1688
|
-
// --- Remove photo
|
|
1313
|
+
sock.groupParticipantsUpdate(jid, ['628...@s.whatsapp.net'], 'add')
|
|
1314
|
+
sock.groupParticipantsUpdate(jid, ['628...@s.whatsapp.net'], 'remove')
|
|
1315
|
+
sock.groupParticipantsUpdate(jid, ['628...@s.whatsapp.net'], 'promote')
|
|
1316
|
+
sock.groupParticipantsUpdate(jid, ['628...@s.whatsapp.net'], 'demote')
|
|
1317
|
+
sock.groupRequestParticipantsUpdate(jid, ['628...@s.whatsapp.net'], 'approve')
|
|
1318
|
+
sock.groupUpdateSubject(jid, 'New Name')
|
|
1319
|
+
sock.groupUpdateDescription(jid, 'New description')
|
|
1320
|
+
sock.updateProfilePicture(jid, { url: 'path/to/image.jpg' })
|
|
1689
1321
|
sock.removeProfilePicture(jid)
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
sock.groupSettingUpdate(jid, '
|
|
1693
|
-
|
|
1694
|
-
// --- Set group as open to all for chatting
|
|
1695
|
-
sock.groupSettingUpdate(jid, 'not_announcement')
|
|
1696
|
-
|
|
1697
|
-
// --- Set admin only can edit group info
|
|
1698
|
-
sock.groupSettingUpdate(jid, 'locked')
|
|
1699
|
-
|
|
1700
|
-
// --- Set all participants can edit group info
|
|
1701
|
-
sock.groupSettingUpdate(jid, 'unlocked')
|
|
1702
|
-
|
|
1703
|
-
// --- Set admin only can add participants
|
|
1322
|
+
sock.groupSettingUpdate(jid, 'announcement') // admin-only chat
|
|
1323
|
+
sock.groupSettingUpdate(jid, 'not_announcement') // open chat
|
|
1324
|
+
sock.groupSettingUpdate(jid, 'locked') // admin-only edits
|
|
1325
|
+
sock.groupSettingUpdate(jid, 'unlocked') // open edits
|
|
1704
1326
|
sock.groupMemberAddMode(jid, 'admin_add')
|
|
1705
|
-
|
|
1706
|
-
// --- Set all participants can add participants
|
|
1707
1327
|
sock.groupMemberAddMode(jid, 'all_member_add')
|
|
1708
|
-
|
|
1709
|
-
// --- Enable or disable temporary messages with seconds format
|
|
1710
1328
|
sock.groupToggleEphemeral(jid, 86400)
|
|
1711
|
-
|
|
1712
|
-
// --- Disable temporary messages
|
|
1713
|
-
sock.groupToggleEphemeral(jid, 0)
|
|
1714
|
-
|
|
1715
|
-
// --- Enable or disable membership approval mode
|
|
1329
|
+
sock.groupToggleEphemeral(jid, 0) // disable
|
|
1716
1330
|
sock.groupJoinApprovalMode(jid, 'on')
|
|
1717
1331
|
sock.groupJoinApprovalMode(jid, 'off')
|
|
1718
|
-
|
|
1719
|
-
// --- Get all groups metadata
|
|
1720
1332
|
const groups = await sock.groupFetchAllParticipating()
|
|
1721
|
-
console.dir(groups, { depth: null })
|
|
1722
|
-
|
|
1723
|
-
// --- Get pending join requests
|
|
1724
1333
|
const requests = await sock.groupRequestParticipantsList(jid)
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
// --- Get group info from link
|
|
1728
|
-
const group = await sock.groupGetInviteInfo('ABC123456789')
|
|
1729
|
-
console.log('๐ฅ Got group info from invite code', ':', group)
|
|
1730
|
-
|
|
1731
|
-
// --- Update bot member label
|
|
1732
|
-
sock.updateMemberLabel(jid, '@lordmega/baileys')
|
|
1334
|
+
const groupInfo = await sock.groupGetInviteInfo('ABC123456789')
|
|
1335
|
+
sock.updateMemberLabel(jid, 'label')
|
|
1733
1336
|
```
|
|
1734
1337
|
|
|
1735
1338
|
#### ๐ฅ Community Management
|
|
1736
1339
|
|
|
1737
1340
|
```javascript
|
|
1738
|
-
|
|
1739
|
-
const
|
|
1740
|
-
console.dir(community, { depth: null })
|
|
1741
|
-
|
|
1742
|
-
// --- Create a subgroup for community and add participants using their JIDs
|
|
1743
|
-
const group = await sock.communityCreateGroup('๐ข Announcements', ['628123456789@s.whatsapp.net'], communityJid)
|
|
1744
|
-
|
|
1745
|
-
// --- Link an existing group
|
|
1341
|
+
const community = await sock.communityCreate('Name', 'Description')
|
|
1342
|
+
const group = await sock.communityCreateGroup('Announcements', ['628...@s.whatsapp.net'], communityJid)
|
|
1746
1343
|
sock.communityLinkGroup(groupJid, communityJid)
|
|
1747
|
-
|
|
1748
|
-
// --- Unlink an existing group
|
|
1749
1344
|
sock.communityUnlinkGroup(groupJid, communityJid)
|
|
1750
|
-
|
|
1751
|
-
// --- Get info
|
|
1752
1345
|
const metadata = await sock.communityMetadata(jid)
|
|
1753
|
-
console.dir(metadata, { depth: null })
|
|
1754
|
-
|
|
1755
|
-
// --- Get community invite code
|
|
1756
1346
|
const inviteCode = await sock.communityInviteCode(jid)
|
|
1757
|
-
console.dir(inviteCode, { depth: null })
|
|
1758
|
-
|
|
1759
|
-
// --- Revoke invite link
|
|
1760
1347
|
sock.communityRevokeInvite(jid)
|
|
1761
|
-
|
|
1762
|
-
// --- Accept community invite
|
|
1763
1348
|
sock.communityAcceptInvite(inviteCode)
|
|
1764
|
-
|
|
1765
|
-
// --- Leave community
|
|
1766
1349
|
sock.communityLeave(jid)
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
sock.
|
|
1770
|
-
|
|
1771
|
-
// --- Change name
|
|
1772
|
-
sock.communityUpdateSubject(jid, '๐ฆ @lordmega/baileys')
|
|
1773
|
-
|
|
1774
|
-
// --- Change description
|
|
1775
|
-
sock.communityUpdateDescription(jid, 'Updated description')
|
|
1776
|
-
|
|
1777
|
-
// --- Set community as admin only for chatting
|
|
1350
|
+
sock.communityRequestParticipantsUpdate(jid, ['628...@s.whatsapp.net'], 'approve')
|
|
1351
|
+
sock.communityUpdateSubject(jid, 'New Name')
|
|
1352
|
+
sock.communityUpdateDescription(jid, 'New description')
|
|
1778
1353
|
sock.communitySettingUpdate(jid, 'announcement')
|
|
1779
|
-
|
|
1780
|
-
// --- Set community as open to all for chatting
|
|
1781
|
-
sock.communitySettingUpdate(jid, 'not_announcement')
|
|
1782
|
-
|
|
1783
|
-
// --- Set admin only can edit community info
|
|
1784
1354
|
sock.communitySettingUpdate(jid, 'locked')
|
|
1785
|
-
|
|
1786
|
-
// --- Set all participants can edit community info
|
|
1787
|
-
sock.communitySettingUpdate(jid, 'unlocked')
|
|
1788
|
-
|
|
1789
|
-
// --- Set admin only can add participants
|
|
1790
1355
|
sock.communityMemberAddMode(jid, 'admin_add')
|
|
1791
|
-
|
|
1792
|
-
// --- Set all participants can add participants
|
|
1793
|
-
sock.communityMemberAddMode(jid, 'all_member_add')
|
|
1794
|
-
|
|
1795
|
-
// --- Enable or disable temporary messages with seconds format
|
|
1796
1356
|
sock.communityToggleEphemeral(jid, 86400)
|
|
1797
|
-
|
|
1798
|
-
// --- Disable temporary messages
|
|
1799
|
-
sock.communityToggleEphemeral(jid, 0)
|
|
1800
|
-
|
|
1801
|
-
// --- Enable or disable membership approval mode
|
|
1802
1357
|
sock.communityJoinApprovalMode(jid, 'on')
|
|
1803
|
-
sock.communityJoinApprovalMode(jid, 'off')
|
|
1804
|
-
|
|
1805
|
-
// --- Get all communities metadata
|
|
1806
1358
|
const communities = await sock.communityFetchAllParticipating()
|
|
1807
|
-
console.dir(communities, { depth: null })
|
|
1808
|
-
|
|
1809
|
-
// --- Get all community linked groups
|
|
1810
1359
|
const linked = await sock.communityFetchLinkedGroups(jid)
|
|
1811
|
-
console.dir(linked, { depth: null })
|
|
1812
|
-
|
|
1813
|
-
// --- Get pending join requests
|
|
1814
1360
|
const requests = await sock.communityRequestParticipantsList(jid)
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
// --- Get community info from link
|
|
1818
|
-
const community = await sock.communityGetInviteInfo('ABC123456789')
|
|
1819
|
-
console.log('๐ฅ Got community info from invite code', ':', community)
|
|
1361
|
+
const info = await sock.communityGetInviteInfo('ABC123456789')
|
|
1820
1362
|
```
|
|
1821
1363
|
|
|
1822
1364
|
#### ๐ค Profile Management
|
|
1823
1365
|
|
|
1824
1366
|
```javascript
|
|
1825
|
-
// --- Get user profile picture
|
|
1826
1367
|
const url = await sock.profilePictureUrl(jid, 'image')
|
|
1827
|
-
console.log('๐ผ๏ธ Got user profile url', url)
|
|
1828
|
-
|
|
1829
|
-
// --- Update profile picture
|
|
1830
1368
|
sock.updateProfilePicture(jid, buffer)
|
|
1831
|
-
sock.updateProfilePicture(jid, { url })
|
|
1832
|
-
|
|
1833
|
-
// --- Remove profile picture
|
|
1834
1369
|
sock.removeProfilePicture(jid)
|
|
1835
|
-
|
|
1836
|
-
// --- Update profile name
|
|
1837
1370
|
sock.updateProfileName('My Name')
|
|
1838
|
-
|
|
1839
|
-
// --- Update profile status
|
|
1840
1371
|
sock.updateProfileStatus('Available')
|
|
1841
|
-
|
|
1842
|
-
// --- Presence
|
|
1843
1372
|
sock.sendPresenceUpdate('available', jid)
|
|
1844
1373
|
sock.presenceSubscribe(jid)
|
|
1845
|
-
|
|
1846
|
-
// --- Read receipts
|
|
1847
1374
|
sock.readMessages([message.key])
|
|
1848
1375
|
sock.sendReceipt(jid, participant, [messageId], 'read')
|
|
1849
|
-
|
|
1850
|
-
// --- Block user
|
|
1851
1376
|
sock.updateBlockStatus(jid, 'block')
|
|
1852
|
-
|
|
1853
|
-
// --- Unblock user
|
|
1854
1377
|
sock.updateBlockStatus(jid, 'unblock')
|
|
1855
|
-
|
|
1856
|
-
// --- Fetch blocklist
|
|
1857
1378
|
const blocked = await sock.fetchBlocklist()
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
// --- Modify chats
|
|
1861
|
-
sock.chatModify({
|
|
1862
|
-
archive: true,
|
|
1863
|
-
lastMessageOrig: message,
|
|
1864
|
-
lastMessage: message
|
|
1865
|
-
}, jid)
|
|
1866
|
-
|
|
1867
|
-
// --- Star messages
|
|
1379
|
+
sock.chatModify({ archive: true, lastMessageOrig: message, lastMessage: message }, jid)
|
|
1868
1380
|
sock.star(jid, [{ id: messageId, fromMe: true }], true)
|
|
1869
|
-
|
|
1870
|
-
// --- Contact
|
|
1871
|
-
sock.addOrEditContact(jid, { displayName: 'Starseed' })
|
|
1381
|
+
sock.addOrEditContact(jid, { displayName: 'Name' })
|
|
1872
1382
|
sock.removeContact(jid)
|
|
1873
|
-
|
|
1874
|
-
// --- Label
|
|
1875
1383
|
sock.addChatLabel(jid, labelId)
|
|
1876
1384
|
sock.removeChatLabel(jid, labelId)
|
|
1877
1385
|
sock.addMessageLabel(jid, messageId, labelId)
|
|
1878
|
-
|
|
1879
|
-
// --- App state sync
|
|
1880
1386
|
sock.resyncAppState(['regular', 'critical_block'], true)
|
|
1881
|
-
|
|
1882
|
-
// --- Get business profile
|
|
1883
1387
|
const profile = await sock.getBusinessProfile(jid)
|
|
1884
|
-
console.dir(profile, { depth: null })
|
|
1885
1388
|
```
|
|
1886
1389
|
|
|
1887
1390
|
#### ๐ Business Management
|
|
1888
1391
|
|
|
1889
1392
|
```javascript
|
|
1890
|
-
// --- Create a new product
|
|
1891
1393
|
const product = await sock.productCreate({
|
|
1892
|
-
name: '
|
|
1893
|
-
description: '
|
|
1394
|
+
name: 'Product Name',
|
|
1395
|
+
description: 'Description',
|
|
1894
1396
|
price: 100000,
|
|
1895
1397
|
currency: 'IDR',
|
|
1896
1398
|
originCountryCode: 'ID',
|
|
1897
|
-
images: [
|
|
1898
|
-
bufferImage,
|
|
1899
|
-
{
|
|
1900
|
-
url: './path/to/image.jpg'
|
|
1901
|
-
}
|
|
1902
|
-
]
|
|
1399
|
+
images: [bufferImage, { url: './path/to/image.jpg' }]
|
|
1903
1400
|
})
|
|
1904
|
-
console.dir(product, { depth: null })
|
|
1905
1401
|
|
|
1906
|
-
// --- Update product
|
|
1907
1402
|
await sock.productUpdate(productId, {
|
|
1908
|
-
name: '
|
|
1909
|
-
description: 'Get a full version of Starseed with more features!',
|
|
1403
|
+
name: 'Updated Name',
|
|
1910
1404
|
price: 75000,
|
|
1911
1405
|
currency: 'IDR',
|
|
1912
|
-
images: [
|
|
1913
|
-
{
|
|
1914
|
-
url: './path/to/image.jpg'
|
|
1915
|
-
}
|
|
1916
|
-
]
|
|
1406
|
+
images: [{ url: './path/to/image.jpg' }]
|
|
1917
1407
|
})
|
|
1918
1408
|
|
|
1919
|
-
// --- Delete product
|
|
1920
1409
|
sock.productDelete([productId])
|
|
1921
1410
|
|
|
1922
|
-
// --- Get catalog info
|
|
1923
1411
|
const { products, nextPageCursor } = await sock.getCatalog({
|
|
1924
|
-
|
|
1925
|
-
|
|
1412
|
+
jid: '628...@s.whatsapp.net',
|
|
1413
|
+
limit: 10
|
|
1926
1414
|
})
|
|
1927
1415
|
|
|
1928
|
-
|
|
1929
|
-
const collections = await sock.getCollections('628123456789@s.whatsapp.net', 10)
|
|
1930
|
-
console.dir(collections, { depth: null })
|
|
1931
|
-
|
|
1932
|
-
// --- Get order info
|
|
1416
|
+
const collections = await sock.getCollections('628...@s.whatsapp.net', 10)
|
|
1933
1417
|
const order = await sock.getOrderDetails(orderId, tokenBase64)
|
|
1934
|
-
console.dir(order, { depth: null })
|
|
1935
1418
|
|
|
1936
|
-
// --- Update business profile
|
|
1937
1419
|
await sock.updateBusinessProfile({
|
|
1938
1420
|
address: 'Jakarta, Indonesia',
|
|
1939
|
-
description: '
|
|
1940
|
-
websites: ['https://
|
|
1941
|
-
email: '
|
|
1421
|
+
description: 'Official Store',
|
|
1422
|
+
websites: ['https://example.com'],
|
|
1423
|
+
email: 'contact@example.com',
|
|
1942
1424
|
hours: {
|
|
1943
1425
|
timezone: 'Asia/Jakarta',
|
|
1944
1426
|
days: [{ day: 'mon', mode: 'open_24h' }]
|
|
1945
1427
|
}
|
|
1946
1428
|
})
|
|
1947
1429
|
|
|
1948
|
-
|
|
1949
|
-
sock.updateCoverPhoto({
|
|
1950
|
-
url: './path/to/image.jpg'
|
|
1951
|
-
})
|
|
1952
|
-
|
|
1953
|
-
// --- Remove cover
|
|
1430
|
+
sock.updateCoverPhoto({ url: './path/to/image.jpg' })
|
|
1954
1431
|
sock.removeCoverPhoto(coverId)
|
|
1955
|
-
|
|
1956
|
-
// --- Update quick replies
|
|
1957
|
-
sock.addOrEditQuickReply({
|
|
1958
|
-
shortcut: 'hello',
|
|
1959
|
-
message: 'Hello from business account',
|
|
1960
|
-
})
|
|
1961
|
-
|
|
1962
|
-
// --- Remove quick reply
|
|
1432
|
+
sock.addOrEditQuickReply({ shortcut: 'hello', message: 'Hello!' })
|
|
1963
1433
|
sock.removeQuickReply(timestamp)
|
|
1964
1434
|
```
|
|
1965
1435
|
|
|
1966
1436
|
#### ๐ Privacy Management
|
|
1967
1437
|
|
|
1968
1438
|
```javascript
|
|
1969
|
-
|
|
1970
|
-
sock.
|
|
1971
|
-
sock.updateLastSeenPrivacy('contacts')
|
|
1972
|
-
sock.updateLastSeenPrivacy('contact_blacklist')
|
|
1973
|
-
sock.updateLastSeenPrivacy('nobody')
|
|
1974
|
-
|
|
1975
|
-
// --- Update online privacy
|
|
1976
|
-
sock.updateOnlinePrivacy('all')
|
|
1977
|
-
sock.updateOnlinePrivacy('match_last_seen')
|
|
1978
|
-
|
|
1979
|
-
// --- Update profile picture privacy
|
|
1439
|
+
sock.updateLastSeenPrivacy('all' | 'contacts' | 'contact_blacklist' | 'nobody')
|
|
1440
|
+
sock.updateOnlinePrivacy('all' | 'match_last_seen')
|
|
1980
1441
|
sock.updateProfilePicturePrivacy('contacts')
|
|
1981
|
-
|
|
1982
|
-
// --- Update status privacy
|
|
1983
1442
|
sock.updateStatusPrivacy('contacts')
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
sock.
|
|
1987
|
-
sock.updateReadReceiptsPrivacy('none')
|
|
1988
|
-
|
|
1989
|
-
// --- Update groups add privacy
|
|
1990
|
-
sock.updateGroupsAddPrivacy('all')
|
|
1991
|
-
sock.updateGroupsAddPrivacy('contacts')
|
|
1992
|
-
|
|
1993
|
-
// --- Update messages privacy
|
|
1994
|
-
sock.updateMessagesPrivacy('all')
|
|
1995
|
-
sock.updateMessagesPrivacy('contacts')
|
|
1996
|
-
sock.updateMessagesPrivacy('nobody')
|
|
1997
|
-
|
|
1998
|
-
// --- Update call privacy
|
|
1443
|
+
sock.updateReadReceiptsPrivacy('all' | 'none')
|
|
1444
|
+
sock.updateGroupsAddPrivacy('all' | 'contacts')
|
|
1445
|
+
sock.updateMessagesPrivacy('all' | 'contacts' | 'nobody')
|
|
1999
1446
|
sock.updateCallPrivacy('everyone')
|
|
2000
|
-
|
|
2001
|
-
// --- Update default disappearing mode
|
|
2002
1447
|
sock.updateDefaultDisappearingMode(86400)
|
|
2003
|
-
|
|
2004
|
-
// --- Update link previews privacy
|
|
2005
1448
|
sock.updateDisableLinkPreviewsPrivacy(true)
|
|
2006
1449
|
```
|
|
2007
1450
|
|
|
@@ -2045,96 +1488,10 @@ sock.ev.on('settings.update', (update) => {})
|
|
|
2045
1488
|
|
|
2046
1489
|
### ๐ Try the Bot
|
|
2047
1490
|
|
|
2048
|
-
A
|
|
2049
|
-
Perfect for managing groups, moderating chats, and adding fun with quiz games and handy tools.
|
|
2050
|
-
|
|
2051
|
-
๐๐ป [@lordmega/starseed](https://github.com/lordmega/starseed#readme)
|
|
2052
|
-
|
|
2053
|
-
### ๐ฆ Fork Base
|
|
2054
|
-
|
|
2055
|
-
This fork is based on [Baileys (GitHub)](https://github.com/WhiskeySockets/Baileys)
|
|
2056
|
-
|
|
2057
|
-
### ๐ฃ Credits
|
|
2058
|
-
|
|
2059
|
-
This fork uses Protocol Buffer definitions maintained by [WPP Connect](https://github.com/wppconnect-team) via [`wa-proto`](https://github.com/wppconnect-team/wa-proto)
|
|
2060
|
-
|
|
2061
|
-
Full credit is attributed to the original maintainers and contributors of Baileys:
|
|
2062
|
-
- [purpshell](https://github.com/purpshell)
|
|
2063
|
-
- [jlucaso1](https://github.com/jlucaso1)
|
|
2064
|
-
- [adiwajshing](https://github.com/adiwajshing)
|
|
2065
|
-
|
|
2066
|
-
<!-- Please do not replace my name with yours. It's disrespectful. -->
|
|
2067
|
-
|
|
2068
|
-
This fork includes additional enhancements and modifications by [Lia Wynn](https://github.com/lordmega)
|
|
2069
|
-
|
|
2070
|
-
Special thanks to [itsreimau](https://github.com/itsreimau) for the fix to the `updateBlockStatus` implementation.
|
|
2071
|
-
|
|
2072
|
-
> [!CAUTION]
|
|
2073
|
-
> โ ๏ธ **Modification, removal, or misrepresentation of these credits is strictly prohibited. Any redistribution or fork must preserve this section in its original form without exception.**```
|
|
2074
|
-
|
|
2075
|
-
#### ๐ก Events
|
|
2076
|
-
|
|
2077
|
-
```javascript
|
|
2078
|
-
sock.ev.on('connection.update', (update) => {})
|
|
2079
|
-
sock.ev.on('creds.update', (update) => {})
|
|
2080
|
-
sock.ev.on('messaging-history.set', (update) => {})
|
|
2081
|
-
sock.ev.on('messaging-history.status', (update) => {})
|
|
2082
|
-
sock.ev.on('chats.upsert', (update) => {})
|
|
2083
|
-
sock.ev.on('chats.update', (update) => {})
|
|
2084
|
-
sock.ev.on('chats.delete', (update) => {})
|
|
2085
|
-
sock.ev.on('chats.lock', (update) => {})
|
|
2086
|
-
sock.ev.on('lid-mapping.update', (update) => {})
|
|
2087
|
-
sock.ev.on('presence.update', (update) => {})
|
|
2088
|
-
sock.ev.on('contacts.upsert', (update) => {})
|
|
2089
|
-
sock.ev.on('contacts.update', (update) => {})
|
|
2090
|
-
sock.ev.on('messages.delete', (update) => {})
|
|
2091
|
-
sock.ev.on('messages.update', (update) => {})
|
|
2092
|
-
sock.ev.on('messages.media-update', (update) => {})
|
|
2093
|
-
sock.ev.on('messages.upsert', (update) => {})
|
|
2094
|
-
sock.ev.on('messages.reaction', (update) => {})
|
|
2095
|
-
sock.ev.on('message-receipt.update', (update) => {})
|
|
2096
|
-
sock.ev.on('groups.upsert', (update) => {})
|
|
2097
|
-
sock.ev.on('groups.update', (update) => {})
|
|
2098
|
-
sock.ev.on('group-participants.update', (update) => {})
|
|
2099
|
-
sock.ev.on('group.join-request', (update) => {})
|
|
2100
|
-
sock.ev.on('group.member-tag.update', (update) => {})
|
|
2101
|
-
sock.ev.on('blocklist.set', (update) => {})
|
|
2102
|
-
sock.ev.on('blocklist.update', (update) => {})
|
|
2103
|
-
sock.ev.on('call', (update) => {})
|
|
2104
|
-
sock.ev.on('labels.edit', (update) => {})
|
|
2105
|
-
sock.ev.on('labels.association', (update) => {})
|
|
2106
|
-
sock.ev.on('newsletter.reaction', (update) => {})
|
|
2107
|
-
sock.ev.on('newsletter.view', (update) => {})
|
|
2108
|
-
sock.ev.on('newsletter-participants.update', (update) => {})
|
|
2109
|
-
sock.ev.on('newsletter-settings.update', (update) => {})
|
|
2110
|
-
sock.ev.on('settings.update', (update) => {})
|
|
2111
|
-
```
|
|
2112
|
-
|
|
2113
|
-
### ๐ Try the Bot
|
|
2114
|
-
|
|
2115
|
-
A fast, lightweight, and modular WhatsApp bot built with [@itsliaaa/baileys](https://www.npmjs.com/package/@itsliaaa/baileys).
|
|
2116
|
-
Perfect for managing groups, moderating chats, and adding fun with quiz games and handy tools.
|
|
1491
|
+
A lightweight, modular WhatsApp bot built on this library โ includes group management, moderation, quiz games, and utility tools.
|
|
2117
1492
|
|
|
2118
|
-
๐๐ป [
|
|
1493
|
+
๐๐ป [MegaBot MD](https://github.com/lordmega/starseed#readme)
|
|
2119
1494
|
|
|
2120
1495
|
### ๐ฆ Fork Base
|
|
2121
1496
|
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
### ๐ฃ Credits
|
|
2125
|
-
|
|
2126
|
-
This fork uses Protocol Buffer definitions maintained by [WPP Connect](https://github.com/wppconnect-team) via [`wa-proto`](https://github.com/wppconnect-team/wa-proto)
|
|
2127
|
-
|
|
2128
|
-
Full credit is attributed to the original maintainers and contributors of Baileys:
|
|
2129
|
-
- [purpshell](https://github.com/purpshell)
|
|
2130
|
-
- [jlucaso1](https://github.com/jlucaso1)
|
|
2131
|
-
- [adiwajshing](https://github.com/adiwajshing)
|
|
2132
|
-
|
|
2133
|
-
<!-- Please do not replace my name with yours. It's disrespectful. -->
|
|
2134
|
-
|
|
2135
|
-
This fork includes additional enhancements and modifications by [Lia Wynn](https://github.com/itsliaaa)
|
|
2136
|
-
|
|
2137
|
-
Special thanks to [itsreimau](https://github.com/itsreimau) for the fix to the `updateBlockStatus` implementation.
|
|
2138
|
-
|
|
2139
|
-
> [!CAUTION]
|
|
2140
|
-
> โ ๏ธ **Modification, removal, or misrepresentation of these credits is strictly prohibited. Any redistribution or fork must preserve this section in its original form without exception.**
|
|
1497
|
+
Based on [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)
|