@blurose/baileys 1.1.21 → 1.1.22

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 (80) hide show
  1. package/README.md +268 -0
  2. package/WAProto/WAProto.proto +16 -0
  3. package/WAProto/index.d.ts +1830 -4263
  4. package/WAProto/index.js +32527 -29313
  5. package/lib/Defaults/index.js +1 -1
  6. package/lib/Socket/business.d.ts.map +1 -1
  7. package/lib/Socket/communities.d.ts.map +1 -1
  8. package/lib/Socket/groups.d.ts.map +1 -1
  9. package/lib/Socket/groups.js +8 -6
  10. package/lib/Socket/groups.js.map +1 -1
  11. package/lib/Socket/index.d.ts.map +1 -1
  12. package/lib/Socket/messages-recv.d.ts.map +1 -1
  13. package/lib/Socket/messages-recv.js +5 -2
  14. package/lib/Socket/messages-recv.js.map +1 -1
  15. package/lib/Socket/messages-send.d.ts.map +1 -1
  16. package/lib/Socket/messages-send.js +72 -1
  17. package/lib/Socket/messages-send.js.map +1 -1
  18. package/lib/Types/Events.d.ts +1 -0
  19. package/lib/Types/Events.d.ts.map +1 -1
  20. package/lib/Types/Message.d.ts +12 -7
  21. package/lib/Types/Message.d.ts.map +1 -1
  22. package/lib/Utils/a2ui.d.ts +45 -1
  23. package/lib/Utils/a2ui.d.ts.map +1 -1
  24. package/lib/Utils/a2ui.js +217 -1
  25. package/lib/Utils/a2ui.js.map +1 -1
  26. package/lib/Utils/generics.js +1 -1
  27. package/lib/Utils/history.d.ts +2 -2
  28. package/lib/Utils/html-apps.d.ts +30 -0
  29. package/lib/Utils/html-apps.d.ts.map +1 -0
  30. package/lib/Utils/html-apps.js +99 -0
  31. package/lib/Utils/html-apps.js.map +1 -0
  32. package/lib/Utils/html-multiplayer.d.ts +10 -0
  33. package/lib/Utils/html-multiplayer.d.ts.map +1 -0
  34. package/lib/Utils/html-multiplayer.js +90 -0
  35. package/lib/Utils/html-multiplayer.js.map +1 -0
  36. package/lib/Utils/index.d.ts +9 -0
  37. package/lib/Utils/index.d.ts.map +1 -1
  38. package/lib/Utils/index.js +9 -0
  39. package/lib/Utils/index.js.map +1 -1
  40. package/lib/Utils/mbuilder-airich.d.ts +124 -0
  41. package/lib/Utils/mbuilder-airich.d.ts.map +1 -0
  42. package/lib/Utils/mbuilder-airich.js +960 -0
  43. package/lib/Utils/mbuilder-airich.js.map +1 -0
  44. package/lib/Utils/mbuilder-base.d.ts +32 -0
  45. package/lib/Utils/mbuilder-base.d.ts.map +1 -0
  46. package/lib/Utils/mbuilder-base.js +65 -0
  47. package/lib/Utils/mbuilder-base.js.map +1 -0
  48. package/lib/Utils/mbuilder-buttonv2.d.ts +27 -0
  49. package/lib/Utils/mbuilder-buttonv2.d.ts.map +1 -0
  50. package/lib/Utils/mbuilder-buttonv2.js +165 -0
  51. package/lib/Utils/mbuilder-buttonv2.js.map +1 -0
  52. package/lib/Utils/mbuilder-carousel.d.ts +21 -0
  53. package/lib/Utils/mbuilder-carousel.d.ts.map +1 -0
  54. package/lib/Utils/mbuilder-carousel.js +120 -0
  55. package/lib/Utils/mbuilder-carousel.js.map +1 -0
  56. package/lib/Utils/mbuilder-toolkit.d.ts +90 -0
  57. package/lib/Utils/mbuilder-toolkit.d.ts.map +1 -0
  58. package/lib/Utils/mbuilder-toolkit.js +266 -0
  59. package/lib/Utils/mbuilder-toolkit.js.map +1 -0
  60. package/lib/Utils/mbuilder-utils.d.ts +69 -0
  61. package/lib/Utils/mbuilder-utils.d.ts.map +1 -0
  62. package/lib/Utils/mbuilder-utils.js +214 -0
  63. package/lib/Utils/mbuilder-utils.js.map +1 -0
  64. package/lib/Utils/messages.d.ts +1 -0
  65. package/lib/Utils/messages.d.ts.map +1 -1
  66. package/lib/Utils/messages.js +66 -9
  67. package/lib/Utils/messages.js.map +1 -1
  68. package/lib/Utils/scheduled-message.d.ts +75 -0
  69. package/lib/Utils/scheduled-message.d.ts.map +1 -0
  70. package/lib/Utils/scheduled-message.js +101 -0
  71. package/lib/Utils/scheduled-message.js.map +1 -0
  72. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -7
  73. package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -1
  74. package/lib/Utils/use-multi-file-auth-state.js +39 -47
  75. package/lib/Utils/use-multi-file-auth-state.js.map +1 -1
  76. package/lib/index.d.ts +1 -0
  77. package/lib/index.d.ts.map +1 -1
  78. package/lib/index.js +1 -0
  79. package/lib/index.js.map +1 -1
  80. package/package.json +3 -2
package/README.md CHANGED
@@ -79,6 +79,13 @@ import makeWASocket from '@blurose/baileys'
79
79
  - [Blurose Custom Features](#blurose-custom-features)
80
80
  - [Buttons and Interactive Messages](#buttons-and-interactive-messages)
81
81
  - [A2UI Bloks Widgets](#a2ui-bloks-widgets)
82
+ - [MessageBuilder (Ported from Nixel V4.7)](#messagebuilder-ported-from-nixel-v47)
83
+ - [InteractiveBuilder — nativeFlowMessage Buttons](#interactivebuilder--nativeflowmessage-buttons)
84
+ - [sendInteractiveMessage — Raw nativeFlowMessage](#sendinteractivemessage--raw-nativeflowmessage)
85
+ - [AIRich — GenAI / AiRich Bubble](#airich--genai--airich-bubble)
86
+ - [Carousel](#carousel)
87
+ - [ButtonV2 (Deprecated)](#buttonv2-deprecated)
88
+ - [Toolkit — Media Utilities](#toolkit--media-utilities)
82
89
  - [Custom Pairing](#custom-pairing)
83
90
  - [Session Auto-Heal (Pre-Keys)](#session-auto-heal-pre-keys)
84
91
  - [Connecting Account](#connecting-account)
@@ -258,6 +265,264 @@ await sock.sendMessage(jid, {
258
265
  })
259
266
  ```
260
267
 
268
+
269
+ ---
270
+
271
+ ### MessageBuilder (Ported from Nixel V4.7)
272
+
273
+ Semua class MessageBuilder dari [Nixel V4.7](https://gist.github.com/ValdazGT/adc8b767a082d18d12ff3e7f01b78651) sudah terintegrasi langsung ke library ini. Import langsung dari `@blurose/baileys` — tidak perlu file eksternal lagi.
274
+
275
+ ```ts
276
+ import {
277
+ InteractiveBuilder,
278
+ sendInteractiveMessage,
279
+ AIRich,
280
+ Carousel,
281
+ ButtonV2,
282
+ Toolkit,
283
+ } from '@blurose/baileys'
284
+ ```
285
+
286
+ ---
287
+
288
+ #### InteractiveBuilder — nativeFlowMessage Buttons
289
+
290
+ Fluent builder untuk mengirim pesan dengan button `quick_reply`, `cta_copy`, `cta_url`, `cta_call`, `send_location`, dan list menu `single_select`.
291
+
292
+ ```ts
293
+ import { InteractiveBuilder } from '@blurose/baileys'
294
+
295
+ // Button copy + reply
296
+ await new InteractiveBuilder(conn, m.chat)
297
+ .text('Pilih aksi:')
298
+ .footer('Powered by blurose')
299
+ .addCopy('📋 Salin Kode Lokasi', 'LOC-JAKARTA-01')
300
+ .addReply('🗺️ Buka Google Maps', 'open_maps')
301
+ .send()
302
+
303
+ // Button URL + Call + Location
304
+ await new InteractiveBuilder(conn, m.chat)
305
+ .text('Hubungi kami:')
306
+ .addUrl('🌐 Website', 'https://example.com')
307
+ .addCall('📞 Telepon', '6281234567890')
308
+ .addLocation()
309
+ .quoted(m)
310
+ .send()
311
+
312
+ // List Menu (single_select)
313
+ await new InteractiveBuilder(conn, m.chat)
314
+ .text('Pilih produk top up:')
315
+ .addList('📦 Lihat Pilihan')
316
+ .addSection('🎮 Game')
317
+ .addRow('Mobile Legends', '100 Diamonds', 'ml_100')
318
+ .addRow('Free Fire', '100 Diamonds', 'ff_100')
319
+ .addSection('📺 Streaming')
320
+ .addRow('Spotify Premium', '1 Bulan', 'spotify_1m')
321
+ .addRow('Netflix', '1 Bulan', 'netflix_1m')
322
+ .send()
323
+ ```
324
+
325
+ | Method | Keterangan |
326
+ |---|---|
327
+ | `.text(body)` | Teks isi pesan |
328
+ | `.footer(text)` | Teks footer |
329
+ | `.image(src, caption?)` | Header gambar (Buffer atau URL) |
330
+ | `.video(src, caption?)` | Header video |
331
+ | `.quoted(msg)` | Reply ke pesan tertentu |
332
+ | `.addReply(text, id?)` | Button quick reply |
333
+ | `.addCopy(text, code)` | Button salin teks |
334
+ | `.addUrl(text, url, webview?)` | Button buka URL |
335
+ | `.addCall(text, phone)` | Button telepon |
336
+ | `.addLocation()` | Button kirim lokasi |
337
+ | `.addList(buttonText)` | Buka list menu |
338
+ | `.addSection(title)` | Tambah section di list |
339
+ | `.addRow(title, desc?, id?)` | Tambah item di section |
340
+ | `.send()` | Kirim pesan |
341
+
342
+ ---
343
+
344
+ #### sendInteractiveMessage — Raw nativeFlowMessage
345
+
346
+ Untuk yang sudah punya struktur `nativeFlowMessage` raw dan tidak mau ubah banyak kode.
347
+
348
+ ```ts
349
+ import { sendInteractiveMessage } from '@blurose/baileys'
350
+
351
+ await sendInteractiveMessage(conn, m.chat, {
352
+ body: 'Pilih aksi:',
353
+ footer: 'Powered by blurose',
354
+ nativeFlowMessage: {
355
+ buttons: [
356
+ {
357
+ name: 'cta_copy',
358
+ buttonParamsJson: JSON.stringify({
359
+ display_text: '📋 Salin Kode Lokasi',
360
+ copy_code: 'LOC-JAKARTA-01'
361
+ })
362
+ },
363
+ {
364
+ name: 'quick_reply',
365
+ buttonParamsJson: JSON.stringify({
366
+ display_text: '🗺️ Buka Google Maps',
367
+ id: 'open_maps'
368
+ })
369
+ }
370
+ ]
371
+ },
372
+ quoted: m
373
+ })
374
+ ```
375
+
376
+ ---
377
+
378
+ #### AIRich — GenAI / AiRich Bubble
379
+
380
+ Builder untuk pesan AiRich (`botForwardedMessage`) — bubble ChatAI WhatsApp dengan teks markdown, kode, tabel, gambar, video, saran follow-up, dll.
381
+
382
+ ```ts
383
+ import { AIRich } from '@blurose/baileys'
384
+
385
+ // Teks + kode + saran
386
+ await new AIRich(conn)
387
+ .setTitle('Hasil Bot')
388
+ .addText('Halo! Berikut hasilnya:')
389
+ .addCode('javascript', 'const x = 1 + 2\nconsole.log(x)')
390
+ .addTip('Coba tanya hal lain!')
391
+ .addSuggest(['Hitung lagi', 'Coba Python', 'Bantuan'])
392
+ .send(m.chat)
393
+
394
+ // Tabel data
395
+ await new AIRich(conn)
396
+ .addTable([
397
+ ['Nama', 'Harga', 'Stok'],
398
+ ['ML Diamonds', 'Rp 15.000', '✅'],
399
+ ['FF Diamonds', 'Rp 12.000', '✅'],
400
+ ])
401
+ .send(m.chat)
402
+
403
+ // Edit pesan AiRich yang sudah ada
404
+ const airich = new AIRich(conn).loadFrom(existingMsg)
405
+ airich.addText('Update!')
406
+ await airich.sendEdit(m.chat, existingMsg.key.id)
407
+ ```
408
+
409
+ | Method | Keterangan |
410
+ |---|---|
411
+ | `.setTitle(text)` | Disclaimer/judul kecil di atas bubble |
412
+ | `.addText(text)` | Teks markdown |
413
+ | `.addCode(lang, code)` | Blok kode dengan syntax highlight |
414
+ | `.addTable(arr)` | Tabel dari nested array string |
415
+ | `.addImage(url/buffer)` | Gambar |
416
+ | `.addVideo(url/buffer)` | Video |
417
+ | `.addSource(sources)` | Kartu sumber referensi |
418
+ | `.addReels(items)` | Kartu reels |
419
+ | `.addProduct(data)` | Kartu produk |
420
+ | `.addPost(data)` | Kartu post sosmed |
421
+ | `.addWidget(data)` | Widget 3P custom |
422
+ | `.addFooterAction(data)` | Tombol CTA bawah |
423
+ | `.addSuggest(text/arr)` | Chip saran follow-up |
424
+ | `.addTip(text)` | Teks tips ⓘ |
425
+ | `.loadFrom(msg)` | Load dari pesan AiRich existing |
426
+ | `.send(jid)` | Kirim pesan |
427
+ | `.sendEdit(jid, id)` | Edit pesan AiRich yang sudah terkirim |
428
+
429
+ ---
430
+
431
+ #### Carousel
432
+
433
+ Builder untuk pesan carousel (swipe card) dengan media + button di setiap card.
434
+
435
+ ```ts
436
+ import { Carousel } from '@blurose/baileys'
437
+ import { prepareWAMessageMedia } from '@blurose/baileys'
438
+
439
+ const imageMedia = await prepareWAMessageMedia(
440
+ { image: { url: 'https://example.com/img.png' } },
441
+ { upload: conn.waUploadToServer }
442
+ )
443
+
444
+ await new Carousel(conn)
445
+ .setBody('Pilih produk favorit kamu:')
446
+ .setFooter('Swipe untuk lihat lebih →')
447
+ .addCard({
448
+ header: {
449
+ hasMediaAttachment: true,
450
+ imageMessage: imageMedia.imageMessage
451
+ },
452
+ body: { text: 'ML Diamonds' },
453
+ footer: { text: 'Mulai Rp 5.000' },
454
+ nativeFlowMessage: {
455
+ buttons: [
456
+ { name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: '🛒 Beli', id: 'buy_ml' }) }
457
+ ],
458
+ messageParamsJson: '{}'
459
+ }
460
+ })
461
+ .send(m.chat)
462
+ ```
463
+
464
+ > [!NOTE]
465
+ > Setiap card **wajib** punya `header.hasMediaAttachment: true` dan minimal satu media (image/video).
466
+
467
+ ---
468
+
469
+ #### ButtonV2 (Deprecated)
470
+
471
+ Builder untuk `buttonsMessage` — format lama yang sudah diblokir render di WhatsApp versi baru. Masih bisa dipakai untuk client atau testing.
472
+
473
+ ```ts
474
+ import { ButtonV2 } from '@blurose/baileys'
475
+
476
+ await new ButtonV2(conn)
477
+ .setBody('Pilih salah satu:')
478
+ .setFooter('Footer teks')
479
+ .setTitle('Judul')
480
+ .setThumbnail('https://example.com/thumb.png')
481
+ .addButton('Option 1', 'btn_1')
482
+ .addButton('Option 2', 'btn_2')
483
+ .send(m.chat)
484
+ ```
485
+
486
+ ---
487
+
488
+ #### Toolkit — Media Utilities
489
+
490
+ Static helper untuk proses media sebelum dikirim ke WhatsApp.
491
+
492
+ ```ts
493
+ import { Toolkit } from '@blurose/baileys'
494
+
495
+ // Fetch URL → Buffer
496
+ const buf = await Toolkit.fetchBuffer('https://example.com/image.png')
497
+
498
+ // Resize gambar (output: PNG Buffer)
499
+ const thumb = await Toolkit.resize(imageBuffer, 300, 300)
500
+
501
+ // Upload Buffer ke CDN WhatsApp → URL CDN
502
+ const cdnUrl = await Toolkit.toUrl(conn, imageBuffer, 'image')
503
+
504
+ // Resolve media (URL/Buffer/base64) → URL atau Buffer
505
+ const url = await Toolkit.resolveMedia(conn, 'https://example.com/img.png', 'image')
506
+ const b64 = await Toolkit.resolveMedia(conn, buf, 'image', { result: 'base64', resize: true })
507
+
508
+ // Durasi video MP4 dari Buffer (tanpa ffmpeg)
509
+ const secs = Toolkit.getMp4Duration(videoBuffer) // → number (detik)
510
+
511
+ // Frame preview dari video MP4
512
+ const preview = await Toolkit.getMp4Preview(videoBuffer, { time: 5, result: 'buffer' })
513
+
514
+ // JSON stringify dengan unicode escape
515
+ const escaped = Toolkit.stringifyEscaped({ key: 'nilai ñ 🎯' })
516
+
517
+ // Resolve Promise bersarang rekursif
518
+ const resolved = await Toolkit.waitAllPromises({
519
+ a: Promise.resolve(1),
520
+ b: { c: Promise.resolve('hello') }
521
+ }) // → { a: 1, b: { c: 'hello' } }
522
+ ```
523
+
524
+ ---
525
+
261
526
  ### Custom Pairing
262
527
  Enhanced pairing code logic tailored for custom device registration and bypassing common connection limits.
263
528
  ```ts
@@ -1381,6 +1646,9 @@ sock.ws.on('CB:edge_routing,id:abcd', (node: BinaryNode) => { })
1381
1646
  sock.ws.on('CB:edge_routing,id:abcd,routing_info', (node: BinaryNode) => { })
1382
1647
  ```
1383
1648
 
1649
+ # Blurose Exclusive Features
1650
+ See [BLUROSE_FEATURES.md](BLUROSE_FEATURES.md) for documentation on the 5 exclusive features (Album Message, Scheduled Messages, HTML Mini Apps, Account Health Signals, and Full Newsletter Support).
1651
+
1384
1652
  # License
1385
1653
  Copyright (c) 2025 blurose
1386
1654
 
@@ -2159,6 +2159,18 @@ message Message {
2159
2159
  optional PollCreationMessage pollCreationMessageV5 = 111;
2160
2160
  optional NewsletterFollowerInviteMessage newsletterFollowerInviteMessageV2 = 113;
2161
2161
  optional PollResultSnapshotMessage pollResultSnapshotMessageV3 = 114;
2162
+ optional PollCreationMessage pollCreationMessageV6 = 119;
2163
+ optional ConditionalRevealMessage conditionalRevealMessage = 120;
2164
+ message ConditionalRevealMessage {
2165
+ optional bytes encPayload = 1;
2166
+ optional bytes encIv = 2;
2167
+ optional ConditionalRevealMessageType conditionalRevealMessageType = 3;
2168
+ optional string revealKeyId = 4;
2169
+ enum ConditionalRevealMessageType {
2170
+ UNKNOWN = 0;
2171
+ SCHEDULED_MESSAGE = 1;
2172
+ }
2173
+ }
2162
2174
  message AlbumMessage {
2163
2175
  optional uint32 expectedImageCount = 2;
2164
2176
  optional uint32 expectedVideoCount = 3;
@@ -3236,6 +3248,9 @@ message Message {
3236
3248
  optional Message.PollContentType pollContentType = 6;
3237
3249
  optional Message.PollType pollType = 7;
3238
3250
  optional Option correctAnswer = 8;
3251
+ optional int64 endTime = 9;
3252
+ optional bool hideParticipantName = 10;
3253
+ optional bool allowAddOption = 11;
3239
3254
  message Option {
3240
3255
  optional string optionName = 1;
3241
3256
  optional string optionHash = 2;
@@ -3340,6 +3355,7 @@ message Message {
3340
3355
  HISTORY_SYNC_NOTIFICATION = 5;
3341
3356
  APP_STATE_SYNC_KEY_SHARE = 6;
3342
3357
  APP_STATE_SYNC_KEY_REQUEST = 7;
3358
+ MESSAGE_UNSCHEDULE = 32;
3343
3359
  MSG_FANOUT_BACKFILL_REQUEST = 8;
3344
3360
  INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC = 9;
3345
3361
  APP_STATE_FATAL_EXCEPTION_NOTIFICATION = 10;