@lordmega/baileys 0.3.19 โ†’ 0.3.21

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.
Files changed (2) hide show
  1. package/README.md +288 -931
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
- # ๐Ÿ—ฟ @lordmega/baileys
2
1
 
3
- [![Logo](https://files.catbox.moe/c5s9g0.jpg)](https://www.npmjs.com/package/@lordmega/baileys)
2
+
3
+ # ๐Ÿ—ฟ lordmega baileys
4
+
5
+ [![Logo](https://files.catbox.moe/7vx45a.png)](https://www.npmjs.com/package/@lordmega/baileys)
4
6
 
5
7
  <p align="center">
6
- Enhanced Baileys v7 with fixes for newsletter media uploads, plus support for interactive messages, albums, and additional message types.
8
+ Mega enjanced Baileys v7 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
- This fork designed for production use with a focus on clarity and safety:
110
+ Built for production with an emphasis on readability and reliability:
112
111
 
113
- - ๐Ÿšซ No obfuscation. Easy to read and audit.
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 an issue where media could not be sent to newsletters due to an upstream issue.
159
- - ๐Ÿ“ Reintroduced [`makeInMemoryStore`](#%EF%B8%8F-implementing-data-store) with a minimal ESM adaptation and small adjustments for Baileys v7.
160
- - ๐Ÿ“ฆ Switched FFmpeg execution from `exec` to `spawn` for safer process handling.
161
- - ๐Ÿ—ƒ๏ธ Added [`@napi-rs/image`](https://www.npmjs.com/package/@napi-rs/image) as a supported image processing backend in [`getImageProcessingLibrary()`](#%EF%B8%8F-image-processing), offering a balance between performance and compatibility.
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
- - ๐Ÿ“ฉ Expanded messages support for:
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
- - [๐ŸŒ Message with Inline Entities](#-message-with-inline-entities) **[NEW]**
130
+ - ๐ŸŒ [Message with Inline Entities](#-message-with-inline-entities) **[NEW]**
173
131
  - ๐Ÿ“‹ [Message with Table](#-message-with-table) **[NEW]**
174
- - ๐Ÿ’ณ [Payment-related Message](#-sending-payment-messages) (payment requests, invites, orders, invoices).
175
- - ๐Ÿ“ฐ Simplified sending messages with ad thumbnail using [`externalAdReply`](#-external-ad-reply), without requiring manual `contextInfo`.
176
- - ๐Ÿ’ญ Added support for quoting messages inside channel (newsletter). **[NEW]**
177
- - ๐ŸŽ€ Added support for [custom button icon](#%EF%B8%8F-interactive). **[NEW]**
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
- - ๐Ÿ‘๏ธ Added optional boolean flags for message handling:
181
- - ๐Ÿค– [`ai`](#-ai-icon) - AI icon on message
182
- - ๐Ÿ“ฃ [`mentionAll`](#-mention) - Mention all group participants without requiring their JIDs in `mentions` or `mentionedJid` **[NEW]**
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) - Message wrappers
184
- - ๐Ÿ”’ [`secureMetaServiceLabel`](#%EF%B8%8F-secure-meta-service-label) - Secure meta service label on message **[NEW]**
185
- - ๐Ÿ“„ [`raw`](#-raw) - Build your message manually **(DO NOT USE FOR EXPLOITATION)**
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,8 +185,7 @@ 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
- const myPhoneNumber = '6288888888888'
188
+ const myPhoneNumber = '2560000000'
232
189
 
233
190
  const logger = pino({ level: 'silent' })
234
191
 
@@ -279,12 +236,12 @@ connectToWhatsApp()
279
236
  #### ๐Ÿ” Auth State
280
237
 
281
238
  > [!NOTE]
282
- > You can use the experimental `useSingleFileAuthState` and `useSqliteAuthState` as an alternative to `useMultiFileAuthState`. However, `useSingleFileAuthState` already includes an internal caching mechanism, so there is no need to wrap `state.keys` with `makeCacheableSignalKeyStore`.
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
- > I highly recommend building your own data store, as keeping an entire chat history in memory can lead to excessive RAM usage.
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, called `jid` and `lid` too, of the person or group you're sending the message to.
360
- - It must be in the format `[country code][phone number]@s.whatsapp.net`
361
- - Example for people: `19999999999@s.whatsapp.net` and `12699999999@lid`.
362
- - For groups, it must be in the format `123456789-123345@g.us`.
363
- - For Meta AI, it's `11111111111@bot`.
364
- - For broadcast lists, it's `[timestamp of creation]@broadcast`.
365
- - For stories, the ID is `status@broadcast`.
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
- // --- Send a regular text message
324
+ // --- Regular text
376
325
  sock.sendMessage(jid, {
377
326
  text: '๐Ÿ‘‹๐Ÿป Hello'
378
327
  }, {
379
328
  quoted: message
380
329
  })
381
330
 
382
- // --- Send a text message with a link preview
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, // --- Use 1 for video playback in the link preview
340
+ previewType: 0,
392
341
  jpegThumbnail: fs.readFileSync('./path/to/image.jpg')
393
342
  }
394
343
  })
395
344
 
396
- // --- Send a text message with a large link preview and favicon
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, // --- Duration in seconds (for video/audio content)
425
- socialMediaPostType: 1, // --- Enum: 0 = NONE, 1 = REEL, 2 = LIVE_VIDEO, 3 = LONG_VIDEO, 4 = SINGLE_IMAGE, 5 = CAROUSEL
426
- } // --- Additional metadata for large link preview
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
- // --- Regular mention
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, // --- Set the value in seconds: 86400 (1d), 604800 (7d), or 2592000 (30d)
471
- type: 1 // --- Or 2 to remove
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
- > Keep Chat can only be used in chats or groups with disappearing messages enabled.
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 // --- Or 2 to remove
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 // --- Optional
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:Lia Wynn\n'
502
- + 'ORG:Waitress;\n'
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: 'Lia Wynn',
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: 'Meet & Mingle Party is a fun, casual gathering to connect, chat, and build new relationships within the community.',
539
- call: 'audio', // --- Or "video", this field is optional
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, // --- Optional
543
- isScheduleCall: false, // --- Optional
544
- extraGuestsAllowed: false, // --- Optional
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: '๐Ÿ‘‹๐Ÿป Hello, we invite you to join our group.',
571
- jid: groupJid,
572
- subject: groupName,
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
- url: './path/to/image.jpg'
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: '๐Ÿ›๏ธ Interesting product!',
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://www.npmjs.com/package/@lordmega/baileys',
598
- title: '๐Ÿ“ฆ Starseed (Premium)',
599
- url: 'https://www.npmjs.com/package/@lordmega/baileys'
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
- // --- Regular poll message
545
+ // --- Standard poll
609
546
  sock.sendMessage(jid, {
610
547
  poll: {
611
- name: '๐Ÿ”ฅ Voting time',
548
+ name: '๐Ÿ”ฅ Quick vote',
612
549
  values: ['Yes', 'No'],
613
550
  selectableCount: 1,
614
551
  toAnnouncementGroup: false,
615
- endDate: new Date(Date.now() + 28800000), // --- Optional
616
- hideVoter: false, // --- Optional
617
- canAddOption: false // --- Optional
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 for newsletter)
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 // Or 1 for quiz
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
- // --- Using buttonsResponseMessage
601
+ // --- buttonsResponseMessage
671
602
  sock.sendMessage(jid, {
672
603
  type: 'plain',
673
604
  buttonReply: {
674
605
  id: '#Menu',
675
- displayText: 'โœจ Interesting Menu'
606
+ displayText: 'โœจ Menu'
676
607
  }
677
- }, {
678
- quoted: message
679
- })
608
+ }, { quoted: message })
680
609
 
681
- // --- Using interactiveResponseMessage
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: 'โœจ Interesting Menu'
618
+ description: 'โœจ Menu'
690
619
  })
691
620
  }
692
- }, {
693
- quoted: message
694
- })
621
+ }, { quoted: message })
695
622
 
696
- // --- Using listResponseMessage
623
+ // --- listResponseMessage
697
624
  sock.sendMessage(jid, {
698
625
  listReply: {
699
626
  title: '๐Ÿ“„ See More',
700
- description: 'โœจ Interesting Menu',
627
+ description: 'โœจ Menu',
701
628
  id: '#Menu'
702
629
  }
703
- }, {
704
- quoted: message
705
- })
630
+ }, { quoted: message })
706
631
 
707
- // --- Using templateButtonReplyMessage
632
+ // --- templateButtonReplyMessage
708
633
  sock.sendMessage(jid, {
709
634
  type: 'template',
710
635
  buttonReply: {
711
636
  id: '#Menu',
712
- displayText: 'โœจ Interesting Menu',
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[]` is a representation of [`submessages[]`](https://baileys.wiki/docs/api/namespaces/proto/interfaces/IAIRichResponseSubMessage) inside `richResponseMessage`.
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 between Node.js, Bun, and Deno',
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
- > You can easily add syntax highlighting by importing `tokenizeCode` directly from Baileys.
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: 'Example of tokenizing Code Block',
691
+ disclaimerText: 'Tokenized Code Block',
773
692
  richResponse: [{
774
- text: 'Example Usage',
693
+ text: 'Example',
775
694
  }, {
776
695
  language,
777
696
  code: tokenizeCode(code, language)
778
697
  }, {
779
- text: 'Pretty simple, right?'
698
+ text: 'Clean and simple.'
780
699
  }]
781
700
  })
782
701
  ```
783
702
 
784
- > ๐Ÿ’ก Supported Languages: `css`, `html`, `javascript`, `typescript`, `python`, `golang`, `rust`, `c`, `c#`, `c++`, `bash`, `bat`, `powershell`.
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 between Node.js, Bun, and Deno',
743
+ headerText: '## Runtime Comparison',
832
744
  contentText: '---',
833
- title: 'Runtime Comparison',
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, // --- Optional
840
- footerText: 'Does this help clarify the differences?'
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
- > For media messages, you can pass a `Buffer` directly, or an object with either `{ stream: Readable }` or `{ url: string }` (local file path or HTTP/HTTPS URL).
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
- url: './path/to/image.jpg'
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
- url: './path/to/video.mp4'
876
- },
877
- gifPlayback: false, // --- Set true if you want to send video as GIF
878
- ptv: false, // --- Set true if you want to send video as PTV
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
- url: './path/to/sticker.webp'
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
- url: './path/to/audio.mp3'
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: 'โœจ My work!'
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
- > If `sharp` or `@napi-rs/image` is not installed, the `cover` and `stickers` must already be in WebP format.
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
- }
968
- }, {
969
- data: {
970
- url: './path/to/image.webp'
971
- }
845
+ data: { url: './path/to/image.webp' }
972
846
  }, {
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: '๐ŸŒŸ Lia Wynn',
979
- description: '@lordmega/baileys'
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
- // --- Regular buttons message
860
+ // --- Basic buttons
991
861
  sock.sendMessage(jid, {
992
862
  text: '๐Ÿ‘†๐Ÿป Buttons!',
993
- footer: '@lordmega/baileys',
863
+ footer: 'MegaBot',
994
864
  buttons: [{
995
- text: '๐Ÿ‘‹๐Ÿป SignUp',
865
+ text: '๐Ÿ‘‹๐Ÿป Sign Up',
996
866
  id: '#SignUp'
997
867
  }]
998
- }, {
999
- quoted: message
1000
- })
868
+ }, { quoted: message })
1001
869
 
1002
- // --- Buttons with Media & Native Flow
870
+ // --- Buttons with media and native flow
1003
871
  sock.sendMessage(jid, {
1004
- image: {
1005
- url: './path/to/image.jpg'
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
- > It only works in private chat (`@s.whatsapp.net`).
896
+ > Only works in private chats (`@s.whatsapp.net`).
1042
897
 
1043
898
  ```javascript
1044
899
  sock.sendMessage(jid, {
1045
- text: '๐Ÿ“‹ List!',
1046
- footer: '@lordmega/baileys',
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 Flow
925
+ // --- Native flow
1073
926
  sock.sendMessage(jid, {
1074
- image: {
1075
- url: './path/to/image.jpg'
1076
- },
1077
- caption: '๐Ÿ—„๏ธ๏ธ Interactive!',
1078
- footer: '@lordmega/baileys',
1079
- optionText: '๐Ÿ‘‰๐Ÿป Select Options', // --- Optional, wrap all native flow into a single list
1080
- optionTitle: '๐Ÿ“„ Select Options', // --- Optional
1081
- offerText: '๐Ÿท๏ธ Newest Coupon!', // --- Optional, add an offer into message
1082
- offerCode: '@lordmega/baileys', // --- Optional
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' // --- Optional
939
+ icon: 'review'
1089
940
  }, {
1090
941
  text: '๐Ÿ“ž Call',
1091
942
  call: '628123456789'
1092
943
  }, {
1093
944
  text: '๐Ÿ“‹ Copy',
1094
- copy: '@lordmega/baileys'
945
+ copy: 'some-text'
1095
946
  }, {
1096
- text: '๐ŸŒ Source',
1097
- url: 'https://www.npmjs.com/package/@lordmega/baileys',
1098
- useWebview: true // --- Optional
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: '๐Ÿท๏ธ Coupon',
956
+ title: '๐Ÿท๏ธ Option A',
1106
957
  description: '',
1107
- id: '#CouponCode'
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' // --- Optional
1120
- }],
1121
- interactiveAsTemplate: false, // --- Optional, wrap the interactive message into a template
1122
- }, {
1123
- quoted: message
1124
- })
961
+ icon: 'default'
962
+ }]
963
+ }, { quoted: message })
1125
964
 
1126
- // --- Carousel & Native Flow
965
+ // --- Carousel with native flow
1127
966
  sock.sendMessage(jid, {
1128
- text: '๐Ÿ—‚๏ธ Interactive with Carousel!',
1129
- footer: '@lordmega/baileys',
967
+ text: '๐Ÿ—‚๏ธ Carousel!',
968
+ footer: 'MegaBot',
1130
969
  cards: [{
1131
- image: {
1132
- url: './path/to/image.jpg'
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: '๐ŸŒ Source',
1138
- url: 'https://www.npmjs.com/package/@lordmega/baileys',
974
+ text: '๐ŸŒ Visit',
975
+ url: 'https://example.com',
1139
976
  useWebview: true
1140
977
  }]
1141
978
  }, {
1142
- image: {
1143
- url: './path/to/image.jpg'
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: '๐Ÿ›’ Product',
1169
- id: '#Product',
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 Flow with Audio in the Footer
989
+ // --- Native flow with audio footer
1181
990
  sock.sendMessage(jid, {
1182
- text: '๐Ÿ”ˆ Music in the footer!',
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: '๐Ÿ‘๐Ÿป Good, next',
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: '@lordmega/baileys',
1012
+ footer: 'MegaBot',
1210
1013
  templateButtons: [{
1211
- text: '๐Ÿ‘‰?? Tap Here',
1014
+ text: '๐Ÿ‘‰๐Ÿป Tap Here',
1212
1015
  id: '#Order'
1213
1016
  }, {
1214
- text: '๐ŸŒ Source',
1215
- url: 'https://www.npmjs.com/package/@lordmega/baileys'
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 message are not supported yet.
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(chat, {
1253
- orderText: '๐Ÿ›๏ธ Order',
1254
- thumbnail: fs.readFileSync('./path/to/image.jpg') // --- Must in buffer format
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 Payment',
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
- > It only works in private chat (`@s.whatsapp.net`).
1071
+ > Only works in private chats (`@s.whatsapp.net`).
1275
1072
 
1276
1073
  ```javascript
1277
1074
  sock.sendMessage(jid, {
1278
- image: {
1279
- url: './path/to/image.jpg'
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: '๐Ÿ“ฐ External Ad Reply',
1095
+ text: '๐Ÿ“ฐ Ad Reply',
1311
1096
  externalAdReply: {
1312
1097
  title: '๐Ÿ“ Did you know?',
1313
- body: 'โ“ I dont know',
1314
- thumbnail: fs.readFileSync('./path/to/image.jpg'), // --- Must in buffer format
1315
- largeThumbnail: false, // --- Or true for bigger thumbnail
1316
- url: 'https://www.npmjs.com/package/@lordmega/baileys' // --- Optional, used for WhatsApp internal thumbnail caching and direct URL
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
- > It only works in group chat (`@g.us`)
1109
+ > Only works in group chats (`@g.us`).
1327
1110
 
1328
1111
  ```javascript
1329
1112
  sock.sendMessage(jid, {
1330
- image: {
1331
- url: './path/to/image.jpg'
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: '๐Ÿ“ƒ Built manually from scratch using the raw WhatsApp proto structure',
1133
+ text: '๐Ÿ“ƒ Manually constructed proto message',
1358
1134
  contextInfo: {
1359
1135
  externalAdReply: {
1360
- title: '@lordmega/baileys',
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: '๐Ÿท๏ธ Just a label!',
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 plain text
1210
+ // --- Edit text
1457
1211
  sock.sendMessage(jid, {
1458
- text: 'โœจ I mean, nice!',
1212
+ text: 'โœจ Corrected message',
1459
1213
  edit: message.key
1460
1214
  })
1461
1215
 
1462
- // --- Edit media messages caption
1216
+ // --- Edit media caption
1463
1217
  sock.sendMessage(jid, {
1464
- caption: 'โœจ I mean, here is the image!',
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
- > The ID must contain numbers only (no +, (), or -) and must include the country code with WhatsApp ID format.
1228
+ > Numbers only โ€” no `+`, `()`, or `-`. Must include country code.
1475
1229
 
1476
1230
  ```javascript
1477
- // --- PN (Phone Number)
1478
- const phoneNumber = '6281111111111@s.whatsapp.net'
1479
-
1480
- const ids = await sock.findUserId(phoneNumber)
1481
-
1482
- console.log('๐Ÿท๏ธ Got user ID', ':', ids)
1483
-
1484
- // --- LID (Local Identifier)
1485
- const lid = '43411111111111@lid'
1486
-
1487
- const ids = await sock.findUserId(lid)
1488
-
1489
- console.log('๐Ÿท๏ธ Got user ID', ':', ids)
1231
+ const ids = await sock.findUserId('6281111111111@s.whatsapp.net')
1232
+ console.log('๐Ÿท๏ธ User ID:', ids)
1490
1233
 
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
- const phoneNumber = '6281111111111'
1511
- const customPairingCode = 'STARFALL'
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
- const img = lib.sharp.default(bufferOrFilePath)
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
- // --- Must in buffer format
1546
- const inputBuffer = Buffer.isBuffer(bufferOrFilePath)
1547
- ? bufferOrFilePath
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
- const img = await lib.jimp.Jimp.read(bufferOrFilePath)
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
- // --- Create a new one
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
- // --- Demote admin
1597
- sock.newsletterDemote('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
1598
-
1599
- // --- Change owner
1600
- sock.newsletterChangeOwner('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
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
- // --- Create a new one and add participants using their JIDs
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
- // --- Add participants
1663
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'add')
1664
-
1665
- // --- Remove participants
1666
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'remove')
1667
-
1668
- // --- Promote to admin
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
- // --- Set group as admin only for chatting
1692
- sock.groupSettingUpdate(jid, 'announcement')
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
- console.dir(requests, { depth: null })
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
- // --- Create a new one and add description
1739
- const community = await sock.communityCreate('@lordmega/baileys', '๐Ÿ“ฃ Fresh updates weekly')
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
- // --- Accept join requests
1769
- sock.communityRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
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
- console.dir(requests, { depth: null })
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
- console.dir(blocked, { depth: null })
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: '๐Ÿงฉ Starseed (Premium)',
1893
- description: 'Get a full version of Starseed!',
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: '๐Ÿงฉ Starseed (Premium)',
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
- jid: '628123456789@s.whatsapp.net',
1925
- limit: 10
1412
+ jid: '628...@s.whatsapp.net',
1413
+ limit: 10
1926
1414
  })
1927
1415
 
1928
- // --- Get collections
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: '๐Ÿ›’ Official Starseed Store',
1940
- websites: ['https://www.npmjs.com/package/@lordmega/baileys'],
1941
- email: 'more-more@gmail.com',
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
- // --- Update cover
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
- // --- Update last seen privacy
1970
- sock.updateLastSeenPrivacy('all')
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
- // --- Update read receipts privacy
1986
- sock.updateReadReceiptsPrivacy('all')
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 fast, lightweight, and modular WhatsApp bot built with [@lordmega/baileys](https://www.npmjs.com/package/@lordmega/baileys).
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
- ๐Ÿ‘‰๐Ÿป [@itsliaaa/starseed](https://github.com/itsliaaa/starseed#readme)
1493
+ ๐Ÿ‘‰๐Ÿป [MegaBot MD](https://github.com/lordmega/starseed#readme)
2119
1494
 
2120
1495
  ### ๐Ÿ“ฆ Fork Base
2121
1496
 
2122
- This fork is based on [Baileys (GitHub)](https://github.com/WhiskeySockets/Baileys)
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)