@pontalabs/baileys 1.2.3 โ†’ 1.2.5

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 CHANGED
@@ -584,215 +584,170 @@ await sock.sendMessage(jid, {
584
584
 
585
585
  ---
586
586
 
587
- ### ๐Ÿงฑ Rich Builder API โ€” `build.*`
588
-
589
- `build.*` adalah cara singkat untuk membuat **Rich AI item** yang langsung bisa dipakai di `sock.sendMessage()`.
587
+ ### ๐Ÿค– Rich Messages
590
588
 
591
- > **Tidak perlu import `build`.** Package mengekspos `build` secara global saat dimuat.
589
+ > Semua fitur **Rich Message** dikirim melalui `sock.sendMessage()` dan dirender sebagai AI bot message di WhatsApp.
590
+ >
591
+ > **Tidak ada daftar `build.*` terpisah.** Builder, shortcut lama, `items`, `richResponse`, HTML WebView, interactive builder, dan opsi terkait semuanya didokumentasikan di bagian ini supaya API Rich tetap berada di satu tempat.
592
592
 
593
- #### ๐Ÿš€ Cara paling sederhana
593
+ <details>
594
+ <summary><b>๐Ÿ“Œ Quick Start โ€” Rich Message</b></summary>
594
595
 
595
596
  ```js
596
597
  await sock.sendMessage(jid, {
597
- items: [
598
- build.richText('Halo! ๐Ÿ‘‹'),
599
- build.richCode('console.log("hello")', 'javascript'),
600
- build.richTip('Selesai!')
601
- ]
602
- })
598
+ richText: 'Halo! ๐Ÿ‘‹'
599
+ }, { quoted: message })
603
600
  ```
604
601
 
605
- Factory `build.rich*()` **tidak mengirim pesan sendiri**. Mereka hanya membuat item payload. Pengiriman tetap menggunakan API Baileys biasa: `sock.sendMessage()`.
606
-
607
- #### โฑ๏ธ Delay antar build
608
-
609
- Kalau setiap item builder ingin dikirim sebagai **pesan terpisah**, gunakan `buildDelay` dalam milidetik:
602
+ Builder `build.*` hanya membuat payload. Pengiriman tetap melalui `sock.sendMessage()`:
610
603
 
611
604
  ```js
612
605
  await sock.sendMessage(jid, {
613
606
  items: [
614
- build.richText('Build 1'),
615
- build.richText('Build 2'),
616
- build.richTip('Build 3')
617
- ],
618
- buildDelay: 1000
607
+ build.richText('Halo! ๐Ÿ‘‹'),
608
+ build.richTip('Dikirim dari PontaLabs')
609
+ ]
619
610
  })
620
611
  ```
621
612
 
622
- Urutannya menjadi `Build 1 โ†’ tunggu 1 detik โ†’ Build 2 โ†’ tunggu 1 detik โ†’ Build 3`.
613
+ > `build` tersedia dari package dan tidak membutuhkan `sock` saat membuat payload.
623
614
 
624
- Tanpa `buildDelay`, perilaku `items` lama tetap dipakai: semua item digabung menjadi **satu Rich AI message**.
615
+ </details>
625
616
 
626
- > `buildDelay` hanya berlaku untuk `items`. Nilai dalam milidetik harus lebih besar dari `0`.
617
+ <details>
618
+ <summary><b>๐Ÿ“ Rich Text โ€” <code>richText</code></b></summary>
627
619
 
628
- #### โœจ Semua factory
620
+ Rich markdown text yang dirender sebagai `GenAIMarkdownTextUXPrimitive`.
629
621
 
630
- | Factory | Contoh | Hasil |
631
- | --- | --- | --- |
632
- | `build.richText(text)` | `build.richText('Halo')` | Text |
633
- | `build.richFOAText(text)` | `build.richFOAText('Halo')` | FOA text |
634
- | `build.richHtml(html)` | `build.richHtml('<html>...</html>')` | HTML WebView |
635
- | `build.richCode(code, language)` | `build.richCode('console.log(1)', 'javascript')` | Code |
636
- | `build.richTable(table)` | `build.richTable([['A', 'B']])` | Table |
637
- | `build.richSource(sources)` | `build.richSource([...])` | Sources |
638
- | `build.richReels(items)` | `build.richReels([...])` | Reels |
639
- | `build.richImage(url)` | `build.richImage('https://...')` | Image |
640
- | `build.richVideo(url)` | `build.richVideo('https://...')` | Video |
641
- | `build.richProduct(data)` | `build.richProduct({...})` | Product |
642
- | `build.richPost(data)` | `build.richPost({...})` | Post |
643
- | `build.richMetadata(text)` | `build.richMetadata('Info')` | Metadata |
644
- | `build.richTip(text)` | `build.richTip('Tip')` | Tip |
645
- | `build.richWidget(data)` | `build.richWidget({...})` | Widget |
646
- | `build.richFooterAction(data)` | `build.richFooterAction({...})` | Footer action |
647
- | `build.richSuggest(value)` | `build.richSuggest('Lanjutkan')` | Suggestion |
622
+ **Direct:**
648
623
 
649
- #### ๐Ÿงฉ Campur dengan shortcut lama
624
+ ```js
625
+ await sock.sendMessage(jid, {
626
+ richText: '*Halo!* Ini rich text dari bot.\nStatus: `success`\nWaktu: _120ms_'
627
+ }, { quoted: message })
628
+ ```
650
629
 
651
- API lama **tetap dipertahankan**. Builder bisa dicampur dengan object Rich AI biasa di `items`.
630
+ **Array / beberapa paragraf:**
652
631
 
653
632
  ```js
654
633
  await sock.sendMessage(jid, {
655
- items: [
656
- { richText: 'Shortcut lama tetap jalan' },
657
- build.richText('Item dari Builder'),
658
- { richTip: 'Shortcut lama' },
659
- build.richTip('Tip dari Builder')
634
+ richText: [
635
+ 'Baris pertama.',
636
+ 'Baris kedua.',
637
+ 'Baris ketiga.'
660
638
  ]
661
- })
639
+ }, { quoted: message })
662
640
  ```
663
641
 
664
- #### ๐ŸŒ HTML WebView
665
-
666
- `build.richHtml()` membuat primitive HTML Rich AI seperti webview. HTML dikirim sebagai payload langsung ke primitive `GenAIaeacdsnwHtmlPrimitive`.
642
+ **Builder:**
667
643
 
668
644
  ```js
669
- const html = `<!DOCTYPE html>
670
- <html>
671
- <body style="margin:0;padding:20px;font-family:Arial">
672
- <h2>๐ŸŽฎ Game Center</h2>
673
- <button onclick="document.body.innerHTML += '<p>Clicked!</p>'">
674
- Play
675
- </button>
676
- </body>
677
- </html>`
678
-
679
645
  await sock.sendMessage(jid, {
680
- items: [build.richHtml(html)]
646
+ items: [
647
+ build.richText('Halo! ๐Ÿ‘‹')
648
+ ]
681
649
  })
682
650
  ```
683
651
 
684
- Karena HTML berjalan di sisi client/webview, gunakan HTML/JavaScript yang memang kamu kontrol dan sesuaikan dengan dukungan client WhatsApp yang dituju.
685
-
686
- #### ๐Ÿ› ๏ธ Builder untuk edit / delete
687
-
688
- Untuk kebutuhan yang benar-benar membutuhkan state dan manipulasi node, gunakan `build.AIRich(sock)`.
652
+ **Raw item:**
689
653
 
690
654
  ```js
691
- const ai = build.AIRich(sock)
692
-
693
- ai.addText('โณ Loading...', { id: 'status' })
694
- ai.addTip('Mohon tunggu')
695
-
696
- await ai.send(jid)
697
-
698
- // Ganti node berdasarkan ID
699
- ai.addText('โœ… Selesai!', { replace: 'status' })
700
-
701
- // Hapus node
702
- ai.delete('status')
703
-
704
- // Sisipkan setelah node tertentu
705
- ai.addTip('Tambahan', { insertAt: 'status' })
655
+ await sock.sendMessage(jid, {
656
+ items: [
657
+ { text: 'Halo! ๐Ÿ‘‹' }
658
+ ]
659
+ })
706
660
  ```
707
661
 
708
- > `replace` dan `insertAt` adalah **options pada `add*()`**, bukan method `ai.replace()` atau `ai.insertAt()`.
709
-
710
- #### ๐Ÿ“ Contoh workflow edit
662
+ </details>
711
663
 
712
- ```js
713
- const ai = build.AIRich(sock)
714
- ai.addText('โณ Memproses...', { id: 'answer' })
664
+ <details>
665
+ <summary><b>๐ŸŒ Rich HTML WebView โ€” <code>richHtml</code></b></summary>
715
666
 
716
- await ai.send(jid)
667
+ Mengirim HTML langsung ke primitive `GenAIaeacdsnwHtmlPrimitive`.
717
668
 
718
- const result = await getAIResponse()
669
+ **Direct `sendMessage`:**
719
670
 
720
- ai.addText(result, { replace: 'answer' })
721
- ai.addTip('Generated by AI')
671
+ ```js
672
+ const html = `<!DOCTYPE html>
673
+ <html>
674
+ <head>
675
+ <meta name="viewport" content="width=device-width,initial-scale=1">
676
+ </head>
677
+ <body>
678
+ <h2>๐ŸŽฎ Game Center</h2>
679
+ <button onclick="document.body.innerHTML += '<p>Clicked!</p>'">
680
+ Play
681
+ </button>
682
+ </body>
683
+ </html>`
722
684
 
723
- await ai.sendEdit(jid)
685
+ await sock.sendMessage(jid, {
686
+ richHtml: html
687
+ }, { quoted: message })
724
688
  ```
725
689
 
726
- #### ๐Ÿ”Œ API lama tetap kompatibel
690
+ **Builder:**
727
691
 
728
692
  ```js
729
- await sock.sendMessage(jid, {
730
- richText: 'Halo'
731
- })
732
-
733
693
  await sock.sendMessage(jid, {
734
694
  items: [
735
- { richText: 'Halo' },
736
- { richTip: 'Testing' }
695
+ build.richHtml(html)
737
696
  ]
738
697
  })
739
698
  ```
740
699
 
741
- Dengan desain ini, developer bisa memilih:
742
-
743
- - **`sock.sendMessage()` + shortcut** โ†’ paling sederhana.
744
- - **`sock.sendMessage()` + `build.rich*()`** โ†’ payload Rich AI yang lebih rapi dan mudah dirangkai.
745
- - **`build.AIRich(sock)`** โ†’ kebutuhan advanced seperti `id`, `replace`, `insertAt`, `delete`, dan edit message.
746
-
747
-
748
- ### ๐Ÿค– Rich Messages
749
-
750
- > All rich messages are sent via standard `sendMessage` and rendered as AI bot messages in WhatsApp. Use the appropriate key instead of `text`, `image`, `video`, etc.
751
-
752
- **Quick jump:** [Rich Text](#rich-text) ยท [Code](#rich-code-block) ยท [Table](#rich-table) ยท [Images](#rich-images) ยท [Video](#rich-video) ยท [Suggestions](#rich-suggestions) ยท [LaTeX](#rich-latex) ยท [Product](#rich-product) ยท [Post](#rich-post) ยท [Reels](#rich-reels) ยท [Sources](#rich-sources) ยท [Tip & Footer](#rich-tip--footer) ยท [Mixed](#rich-mixed) ยท [Response](#rich-response)
753
-
754
- ---
755
-
756
- #### ๐Ÿ“ Rich Text
757
-
758
- > AI bot-styled markdown text rendered in `richResponseMessage`.
759
-
760
- <details>
761
- <summary><b>Simple Text</b></summary>
700
+ **Raw item:**
762
701
 
763
702
  ```js
764
- await sock.sendMessage(jid, { richText: 'Halo! Ini pesan dari bot.' }, { quoted: message })
703
+ await sock.sendMessage(jid, {
704
+ items: [
705
+ { html: html }
706
+ ]
707
+ })
765
708
  ```
766
- </details>
767
709
 
768
- <details>
769
- <summary><b>Markdown (bold, italic, inline code)</b></summary>
710
+ > HTML berjalan di sisi client/webview. Gunakan HTML/JavaScript yang kamu kontrol dan sesuaikan dengan dukungan client WhatsApp yang dituju.
770
711
 
771
- ```js
772
- await sock.sendMessage(jid, {
773
- richText: '*Hasil eksekusi:*\nStatus: `success`\nWaktu: _120ms_'
774
- }, { quoted: message })
775
- ```
776
712
  </details>
777
-
778
713
  <details>
779
- <summary><b>Multiple Paragraphs (Array)</b></summary>
714
+ <summary>๐Ÿ‘ค richCard โ€” Entity Card</summary>
715
+
716
+ Membuat Card Entity/Profile langsung melalui `sendMessage()`. Tidak membutuhkan `build` atau `AIRich`.
780
717
 
781
718
  ```js
782
- await sock.sendMessage(jid, {
783
- richText: ['Baris pertama.', 'Baris kedua.', 'Baris ketiga.']
784
- }, { quoted: message })
719
+ await conn.sendMessage(m.chat, {
720
+ richCard: {
721
+ thumbnail_url: 'https://example.com/profile.jpg',
722
+ verification: true,
723
+ title: 'PontaLabs',
724
+ subtitle: 'Owner: Ponta',
725
+ description: 'Ini Ownernya',
726
+ entity_id: '6283857182374',
727
+ entity_url: 'https://wa.me/6283857182374',
728
+ profile_url: 'https://example.com/profile.jpg'
729
+ }
730
+ });
785
731
  ```
786
- </details>
787
732
 
788
- ---
733
+ | Property | Type | Description |
734
+ |---|---|---|
735
+ | `thumbnail_url` | `string` | Thumbnail Card |
736
+ | `verification` | `boolean` | Status verified |
737
+ | `title` | `string` | Judul Entity |
738
+ | `subtitle` | `string` | Subjudul |
739
+ | `description` | `string` | Deskripsi |
740
+ | `entity_id` | `string` | ID Entity |
741
+ | `entity_url` | `string` | URL Entity |
742
+ | `profile_url` | `string` | URL fallback/profile |
789
743
 
790
- #### ๐Ÿ’ป Rich Code Block
744
+ </details>
791
745
 
792
- > Syntax-highlighted code. Use `code` for single block, `codes` for multiple.
793
746
 
794
747
  <details>
795
- <summary><b>Single Block</b></summary>
748
+ <summary><b>๐Ÿ’ป Rich Code โ€” <code>code</code> / <code>codes</code> / <code>richCode</code></b></summary>
749
+
750
+ **Single block:**
796
751
 
797
752
  ```js
798
753
  await sock.sendMessage(jid, {
@@ -800,50 +755,36 @@ await sock.sendMessage(jid, {
800
755
  language: 'javascript'
801
756
  }, { quoted: message })
802
757
  ```
803
- </details>
804
758
 
805
- <details>
806
- <summary><b>Multiple Blocks</b></summary>
759
+ **Multiple blocks:**
807
760
 
808
761
  ```js
809
762
  await sock.sendMessage(jid, {
810
763
  codes: [
811
- { code: 'SELECT * FROM users WHERE id = 1;', language: 'sql' },
812
- { code: '{ "id": 1, "name": "Ponta", "role": "admin" }', language: 'json' }
764
+ { code: 'console.log("hello")', language: 'javascript' },
765
+ { code: 'SELECT * FROM users;', language: 'sql' }
813
766
  ]
814
767
  }, { quoted: message })
815
768
  ```
816
- </details>
817
-
818
- <details>
819
- <summary><b>Supported Languages</b></summary>
820
-
821
- | Language | Key |
822
- |:---|:---|
823
- | JavaScript | `javascript` ยท `js` |
824
- | TypeScript | `typescript` ยท `ts` |
825
- | Python | `python` ยท `py` |
826
- | Bash / Shell | `bash` ยท `sh` ยท `zsh` |
827
- | Go | `go` ยท `golang` |
828
- | Rust | `rust` ยท `rs` |
829
- | C / C++ | `c` ยท `h` ยท `cpp` ยท `c++` |
830
- | C# | `csharp` ยท `cs` |
831
- | CSS / HTML | `css` ยท `html` |
832
- | PowerShell / CMD | `powershell` ยท `ps1` ยท `cmd` ยท `bat` |
833
- | SQL / JSON | `sql` ยท `json` |
834
769
 
835
- </details>
770
+ **Builder:**
836
771
 
837
- ---
772
+ ```js
773
+ await sock.sendMessage(jid, {
774
+ items: [
775
+ build.richCode('console.log("hello")', 'javascript')
776
+ ]
777
+ })
778
+ ```
838
779
 
839
- #### ๐Ÿ“Š Rich Table
780
+ **Supported language aliases:** `javascript`, `js`, `typescript`, `ts`, `python`, `py`, `bash`, `sh`, `zsh`, `go`, `golang`, `rust`, `rs`, `c`, `h`, `cpp`, `c++`, `csharp`, `cs`, `css`, `html`, `powershell`, `ps1`, `cmd`, `bat`, `sql`, `json`.
840
781
 
841
- > Structured table with `title`, `headers`, and `rows`.
842
- >
843
- > โš ๏ธ Shorthand `{ title?, headers?, rows }` ini hanya berlaku untuk key `table` top-level dan di dalam `items`. Kalau dipakai di dalam `richResponse`, isi `table` harus sudah berupa array baris jadi โ€” lihat [Rich Response](#-rich-response--richresponse).
782
+ </details>
844
783
 
845
784
  <details>
846
- <summary><b>Simple Table</b></summary>
785
+ <summary><b>๐Ÿ“Š Rich Table โ€” <code>table</code> / <code>richTable</code></b></summary>
786
+
787
+ **Top-level:**
847
788
 
848
789
  ```js
849
790
  await sock.sendMessage(jid, {
@@ -858,57 +799,37 @@ await sock.sendMessage(jid, {
858
799
  }
859
800
  }, { quoted: message })
860
801
  ```
861
- </details>
862
802
 
863
- <details>
864
- <summary><b>Table without Title</b></summary>
803
+ **Builder:**
865
804
 
866
805
  ```js
867
806
  await sock.sendMessage(jid, {
868
- table: {
869
- headers: ['Command', 'Description'],
870
- rows: [
871
- ['.ping', 'Cek latency bot'],
872
- ['.info', 'Info bot'],
873
- ['.help', 'List semua command']
874
- ]
875
- }
876
- }, { quoted: message })
807
+ items: [
808
+ build.richTable([
809
+ ['Name', 'Role'],
810
+ ['Ponta', 'Admin'],
811
+ ['Yue', 'Member']
812
+ ])
813
+ ]
814
+ })
877
815
  ```
878
- </details>
879
816
 
880
- <details>
881
- <summary><b>Data Only (no header)</b></summary>
817
+ > Untuk `richResponse`, format `table` berbeda: gunakan array baris siap-pakai seperti `{ items: [...], isHeading }`, bukan `{ headers, rows }`.
882
818
 
883
- ```js
884
- await sock.sendMessage(jid, {
885
- table: {
886
- rows: [
887
- ['RAM', '512 MB'],
888
- ['CPU', '4 Core'],
889
- ['Uptime', '99.9%']
890
- ]
891
- }
892
- }, { quoted: message })
893
- ```
894
819
  </details>
895
820
 
896
- ---
897
-
898
- #### ๐Ÿ–ผ๏ธ Rich Images
899
-
900
- > AI image grid. Single URL = single image, multiple URLs = carousel.
901
-
902
821
  <details>
903
- <summary><b>Single Image</b></summary>
822
+ <summary><b>๐Ÿ–ผ๏ธ Rich Images โ€” <code>richImages</code> / <code>richImage</code></b></summary>
823
+
824
+ **Single image:**
904
825
 
905
826
  ```js
906
- await sock.sendMessage(jid, { richImages: 'https://example.com/photo.jpg' }, { quoted: message })
827
+ await sock.sendMessage(jid, {
828
+ richImages: 'https://example.com/photo.jpg'
829
+ }, { quoted: message })
907
830
  ```
908
- </details>
909
831
 
910
- <details>
911
- <summary><b>Multiple Images (Grid)</b></summary>
832
+ **Multiple images:**
912
833
 
913
834
  ```js
914
835
  await sock.sendMessage(jid, {
@@ -919,252 +840,156 @@ await sock.sendMessage(jid, {
919
840
  ]
920
841
  }, { quoted: message })
921
842
  ```
922
- </details>
923
843
 
924
- <details>
925
- <summary><b>Inside items / richResponse</b></summary>
844
+ **Builder:**
926
845
 
927
846
  ```js
928
- // items
929
847
  await sock.sendMessage(jid, {
930
848
  items: [
931
- { text: 'Hasil foto hari ini:' },
932
- { images: ['https://example.com/1.jpg', 'https://example.com/2.jpg'] }
849
+ build.richImage('https://example.com/photo.jpg')
933
850
  ]
934
- }, { quoted: message })
935
-
936
- // richResponse
937
- await sock.sendMessage(jid, {
938
- richResponse: [
939
- { text: 'Lihat gambarnya:' },
940
- { images: 'https://example.com/banner.jpg' }
941
- ]
942
- }, { quoted: message })
851
+ })
943
852
  ```
944
- </details>
945
-
946
- ---
947
-
948
- #### ๐ŸŽฅ Rich Video
949
853
 
950
- > Video embed as AI animated media (`GenAIImaginePrimitive` with `imagine_type: ANIMATE`).
854
+ </details>
951
855
 
952
856
  <details>
953
- <summary><b>Shorthand URL</b></summary>
857
+ <summary><b>๐ŸŽฅ Rich Video โ€” <code>richVideo</code> / <code>richVideo</code> builder</b></summary>
858
+
859
+ **Shorthand:**
954
860
 
955
861
  ```js
956
- await sock.sendMessage(jid, { richVideo: 'https://example.com/clip.mp4' }, { quoted: message })
862
+ await sock.sendMessage(jid, {
863
+ richVideo: 'https://example.com/clip.mp4'
864
+ }, { quoted: message })
957
865
  ```
958
- </details>
959
866
 
960
- <details>
961
- <summary><b>Full Options</b></summary>
867
+ **Full options:**
962
868
 
963
869
  ```js
964
870
  await sock.sendMessage(jid, {
965
871
  richVideo: {
966
872
  url: 'https://example.com/clip.mp4',
967
- mimeType: 'video/mp4', // default: 'video/mp4'
968
- duration: 15, // seconds, default: 10
969
- fallbackText: 'Preview video' // default: '[ VIDEO - PontaCT ]'
873
+ mimeType: 'video/mp4',
874
+ duration: 15,
875
+ fallbackText: 'Preview video'
970
876
  }
971
877
  }, { quoted: message })
972
878
  ```
973
- </details>
974
879
 
975
- <details>
976
- <summary><b>Inside items / richResponse</b></summary>
880
+ **Builder:**
977
881
 
978
882
  ```js
979
- // items
980
883
  await sock.sendMessage(jid, {
981
884
  items: [
982
- { text: 'Cek videonya:' },
983
- { videoUrl: 'https://example.com/clip.mp4', duration: 20 }
984
- ]
985
- }, { quoted: message })
986
-
987
- // richResponse
988
- await sock.sendMessage(jid, {
989
- richResponse: [
990
- { text: 'Tutorial:' },
991
- { video: { url: 'https://example.com/tutorial.mp4', duration: 30 } }
885
+ build.richVideo('https://example.com/clip.mp4')
992
886
  ]
993
- }, { quoted: message })
887
+ })
994
888
  ```
995
- </details>
996
-
997
- ---
998
-
999
- #### ๐Ÿ’ก Rich Suggestions
1000
889
 
1001
- > Follow-up prompt pills โ€” like native AI chat buttons.
890
+ </details>
1002
891
 
1003
892
  <details>
1004
- <summary><b>Shorthand</b></summary>
893
+ <summary><b>๐Ÿ’ก Rich Suggestions โ€” <code>richSuggestions</code> / <code>richSuggest</code></b></summary>
894
+
895
+ **Direct:**
1005
896
 
1006
897
  ```js
1007
898
  await sock.sendMessage(jid, {
1008
899
  richSuggestions: ['Coba lagi', 'Lihat detail', 'Batalkan']
1009
900
  }, { quoted: message })
1010
901
  ```
1011
- </details>
1012
902
 
1013
- <details>
1014
- <summary><b>Inside items / richResponse</b></summary>
903
+ **Builder:**
1015
904
 
1016
905
  ```js
1017
- // items
1018
906
  await sock.sendMessage(jid, {
1019
907
  items: [
1020
- { text: 'Mau lanjut ke mana?' },
1021
- { suggestions: ['Halaman utama', 'Bantuan', 'Hubungi admin'] }
1022
- ]
1023
- }, { quoted: message })
1024
-
1025
- // richResponse
1026
- await sock.sendMessage(jid, {
1027
- richResponse: [
1028
- { text: 'Hasil pencarian ditemukan.' },
1029
- { suggestions: ['Tampilkan semua', 'Filter ulang', 'Export'] }
908
+ build.richSuggest('Lihat detail')
1030
909
  ]
1031
- }, { quoted: message })
910
+ })
1032
911
  ```
1033
- </details>
1034
912
 
1035
- ---
1036
-
1037
- #### ๐Ÿ”ฃ Rich LaTeX
1038
-
1039
- > Math formula rendering as `GenAILatexItem` inline entity. `url` points to a rendered formula image (PNG/JPG from external LaTeX renderer).
913
+ </details>
1040
914
 
1041
915
  <details>
1042
- <summary><b>Shorthand URL</b></summary>
916
+ <summary><b>๐Ÿ”ฃ Rich LaTeX โ€” <code>richLatex</code></b></summary>
917
+
918
+ **Shorthand URL:**
1043
919
 
1044
920
  ```js
1045
921
  await sock.sendMessage(jid, {
1046
922
  richLatex: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2'
1047
923
  }, { quoted: message })
1048
924
  ```
1049
- </details>
1050
925
 
1051
- <details>
1052
- <summary><b>Full Options</b></summary>
926
+ **Full options:**
1053
927
 
1054
928
  ```js
1055
929
  await sock.sendMessage(jid, {
1056
930
  richLatex: {
1057
931
  url: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2',
1058
- text: 'E = mcยฒ', // label & fallback
1059
- width: 120, // default: 100
1060
- height: 60, // default: 100
1061
- font_height: 83.33, // default: 83.33
1062
- padding: 15 // default: 15
932
+ text: 'E = mcยฒ',
933
+ width: 120,
934
+ height: 60,
935
+ font_height: 83.33,
936
+ padding: 15
1063
937
  }
1064
938
  }, { quoted: message })
1065
939
  ```
1066
- </details>
1067
-
1068
- <details>
1069
- <summary><b>Inside items / richResponse</b></summary>
1070
-
1071
- ```js
1072
- // items
1073
- await sock.sendMessage(jid, {
1074
- items: [
1075
- { text: 'Rumus energi kinetik:' },
1076
- {
1077
- latexUrl: 'https://latex.codecogs.com/png.latex?E_k%3D%5Cfrac%7B1%7D%7B2%7Dmv%5E2',
1078
- latexText: 'Ek = ยฝmvยฒ',
1079
- latexWidth: 150,
1080
- latexHeight: 60
1081
- }
1082
- ]
1083
- }, { quoted: message })
1084
940
 
1085
- // richResponse
1086
- await sock.sendMessage(jid, {
1087
- richResponse: [
1088
- { text: 'Solusi integral:' },
1089
- { latex: { url: 'https://latex.codecogs.com/png.latex?%5Cint%20x%5E2%20dx', text: 'โˆซxยฒ dx = xยณ/3 + C' } }
1090
- ]
1091
- }, { quoted: message })
1092
- ```
1093
941
  </details>
1094
942
 
1095
- ---
1096
-
1097
- #### ๐Ÿ›๏ธ Rich Product
1098
-
1099
- > Product card(s) as `GenAIProductItemCardPrimitive`. Object = single card, Array = horizontal scroll carousel.
1100
-
1101
943
  <details>
1102
- <summary><b>Single Product</b></summary>
944
+ <summary><b>๐Ÿ›๏ธ Rich Product โ€” <code>richProduct</code> / <code>richProduct</code> builder</b></summary>
945
+
946
+ **Single product:**
1103
947
 
1104
948
  ```js
1105
949
  await sock.sendMessage(jid, {
1106
950
  richProduct: {
1107
951
  title: 'Sepatu Adidas Samba',
1108
952
  price_display_string: 'Rp 1.200.000',
1109
- description: 'Sepatu casual ikonik, tersedia berbagai ukuran.',
953
+ description: 'Sepatu casual ikonik.',
1110
954
  retailer_id: 'adidas_store',
1111
- thumbnail: { url: 'https://example.com/adidas.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
955
+ thumbnail: {
956
+ url: 'https://example.com/adidas.jpg',
957
+ mime_type: 'image/jpeg',
958
+ width: 300,
959
+ height: 300
960
+ }
1112
961
  }
1113
962
  }, { quoted: message })
1114
963
  ```
1115
- </details>
1116
964
 
1117
- <details>
1118
- <summary><b>Product Carousel</b></summary>
965
+ **Carousel:**
1119
966
 
1120
967
  ```js
1121
968
  await sock.sendMessage(jid, {
1122
969
  richProduct: [
1123
- {
1124
- title: 'Sepatu A',
1125
- price_display_string: 'Rp 500.000',
1126
- thumbnail: { url: 'https://example.com/a.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
1127
- },
1128
- {
1129
- title: 'Sepatu B',
1130
- price_display_string: 'Rp 750.000',
1131
- thumbnail: { url: 'https://example.com/b.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
1132
- }
970
+ { title: 'Sepatu A', price_display_string: 'Rp 500.000' },
971
+ { title: 'Sepatu B', price_display_string: 'Rp 750.000' }
1133
972
  ]
1134
973
  }, { quoted: message })
1135
974
  ```
1136
- </details>
1137
975
 
1138
- <details>
1139
- <summary><b>Inside items / richResponse</b></summary>
976
+ **Builder:**
1140
977
 
1141
978
  ```js
1142
- // items
1143
979
  await sock.sendMessage(jid, {
1144
980
  items: [
1145
- { text: 'Rekomendasi produk hari ini:' },
1146
- { product: { title: 'Produk X', price_display_string: 'Rp 99.000' } }
1147
- ]
1148
- }, { quoted: message })
1149
-
1150
- // richResponse
1151
- await sock.sendMessage(jid, {
1152
- richResponse: [
1153
- { text: 'Pilih produkmu:' },
1154
- { product: [{ title: 'A' }, { title: 'B' }] }
981
+ build.richProduct({
982
+ title: 'Produk A',
983
+ price_display_string: 'Rp 99.000'
984
+ })
1155
985
  ]
1156
- }, { quoted: message })
986
+ })
1157
987
  ```
1158
- </details>
1159
-
1160
- ---
1161
-
1162
- #### ๐Ÿ“ฐ Rich Post
1163
988
 
1164
- > Post card(s) as `GenAIPostPrimitive`. Object = single post, Array = carousel.
989
+ </details>
1165
990
 
1166
991
  <details>
1167
- <summary><b>Single Post</b></summary>
992
+ <summary><b>๐Ÿ“ฐ Rich Post โ€” <code>richPost</code> / <code>richPost</code> builder</b></summary>
1168
993
 
1169
994
  ```js
1170
995
  await sock.sendMessage(jid, {
@@ -1177,29 +1002,25 @@ await sock.sendMessage(jid, {
1177
1002
  }
1178
1003
  }, { quoted: message })
1179
1004
  ```
1180
- </details>
1181
1005
 
1182
- <details>
1183
- <summary><b>Post Carousel</b></summary>
1006
+ **Builder:**
1184
1007
 
1185
1008
  ```js
1186
1009
  await sock.sendMessage(jid, {
1187
- richPost: [
1188
- { title: 'Post 1', author_display_name: '@user1', media_url: 'https://example.com/1.jpg' },
1189
- { title: 'Post 2', author_display_name: '@user2', media_url: 'https://example.com/2.jpg' }
1010
+ items: [
1011
+ build.richPost({
1012
+ title: 'Post PontaLabs',
1013
+ author_display_name: '@pontalabs',
1014
+ media_url: 'https://example.com/post.jpg'
1015
+ })
1190
1016
  ]
1191
- }, { quoted: message })
1017
+ })
1192
1018
  ```
1193
- </details>
1194
-
1195
- ---
1196
1019
 
1197
- #### ๐ŸŽฌ Rich Reels
1198
-
1199
- > Reels carousel as `GenAIReelPrimitive` with `contentItemsMetadata`. Auto-injects `richResponseSourcesMetadata` with `provider: 'PontaCT'`.
1020
+ </details>
1200
1021
 
1201
1022
  <details>
1202
- <summary><b>Single Reel</b></summary>
1023
+ <summary><b>๐ŸŽฌ Rich Reels โ€” <code>richReels</code> / <code>richReels</code> builder</b></summary>
1203
1024
 
1204
1025
  ```js
1205
1026
  await sock.sendMessage(jid, {
@@ -1217,352 +1038,405 @@ await sock.sendMessage(jid, {
1217
1038
  }
1218
1039
  }, { quoted: message })
1219
1040
  ```
1220
- </details>
1221
1041
 
1222
- <details>
1223
- <summary><b>Reels Carousel</b></summary>
1042
+ **Builder:**
1224
1043
 
1225
1044
  ```js
1226
1045
  await sock.sendMessage(jid, {
1227
- richReels: [
1228
- {
1229
- title: '@creator1',
1230
- profileIconUrl: 'https://example.com/av1.jpg',
1231
- thumbnailUrl: 'https://example.com/th1.jpg',
1232
- videoUrl: 'https://example.com/r1.mp4',
1233
- likes_count: 5000,
1234
- reel_source: 'IG'
1235
- },
1236
- {
1237
- title: '@creator2',
1238
- profileIconUrl: 'https://example.com/av2.jpg',
1239
- thumbnailUrl: 'https://example.com/th2.jpg',
1240
- videoUrl: 'https://example.com/r2.mp4',
1241
- likes_count: 8200,
1242
- reel_source: 'TT'
1243
- }
1046
+ items: [
1047
+ build.richReels([{
1048
+ title: '@creator',
1049
+ thumbnailUrl: 'https://example.com/thumb.jpg',
1050
+ videoUrl: 'https://example.com/reel.mp4'
1051
+ }])
1244
1052
  ]
1245
- }, { quoted: message })
1053
+ })
1246
1054
  ```
1247
- </details>
1248
-
1249
- <details>
1250
- <summary><b>๐Ÿ“‹ Fields Reference</b></summary>
1251
-
1252
- | Field | Type | Default | Description |
1253
- |:---|:---|:---:|:---|
1254
- | `title` | `string` | โ€” | Username / creator name |
1255
- | `profileIconUrl` | `string` | โ€” | Avatar URL |
1256
- | `thumbnailUrl` | `string` | โ€” | Thumbnail cover URL |
1257
- | `videoUrl` | `string` | โ€” | Video source URL |
1258
- | `reels_title` | `string` | `''` | Reel title |
1259
- | `likes_count` | `number` | `0` | Like count |
1260
- | `shares_count` | `number` | `0` | Share count |
1261
- | `view_count` | `number` | `0` | View count |
1262
- | `reel_source` | `string` | `'IG'` | Source platform |
1263
- | `is_verified` | `boolean` | `false` | Verified badge |
1264
1055
 
1265
1056
  </details>
1266
1057
 
1267
- ---
1268
-
1269
- #### ๐Ÿ” Rich Sources
1270
-
1271
- > Search result source list as `GenAISearchResultPrimitive`. Accepts full objects **or** shorthand `[faviconUrl, sourceUrl, displayName]`.
1272
-
1273
1058
  <details>
1274
- <summary><b>Shorthand Array</b></summary>
1059
+ <summary><b>๐Ÿ” Rich Sources โ€” <code>richSources</code> / <code>richSource</code></b></summary>
1060
+
1061
+ **Shorthand:**
1275
1062
 
1276
1063
  ```js
1277
1064
  await sock.sendMessage(jid, {
1278
1065
  richSources: [
1279
1066
  ['https://wikipedia.org/favicon.ico', 'https://wikipedia.org/wiki/Node.js', 'Wikipedia'],
1280
- ['https://nodejs.org/favicon.ico', 'https://nodejs.org/en/docs', 'Node.js Docs'],
1281
- ['https://github.com/favicon.ico', 'https://github.com/nodejs/node', 'GitHub']
1067
+ ['https://nodejs.org/favicon.ico', 'https://nodejs.org/en/docs', 'Node.js Docs']
1282
1068
  ]
1283
1069
  }, { quoted: message })
1284
1070
  ```
1285
- </details>
1286
1071
 
1287
- <details>
1288
- <summary><b>Full Object</b></summary>
1072
+ **Full object:**
1289
1073
 
1290
1074
  ```js
1291
1075
  await sock.sendMessage(jid, {
1292
- richSources: [
1293
- {
1294
- source_type: 'THIRD_PARTY',
1295
- source_display_name: 'Wikipedia',
1296
- source_subtitle: 'wikipedia.org',
1297
- source_url: 'https://wikipedia.org/wiki/Node.js',
1298
- favicon: { url: 'https://wikipedia.org/favicon.ico', mime_type: 'image/jpeg', width: 16, height: 16 }
1076
+ richSources: [{
1077
+ source_type: 'THIRD_PARTY',
1078
+ source_display_name: 'Wikipedia',
1079
+ source_subtitle: 'wikipedia.org',
1080
+ source_url: 'https://wikipedia.org/wiki/Node.js',
1081
+ favicon: {
1082
+ url: 'https://wikipedia.org/favicon.ico',
1083
+ mime_type: 'image/jpeg',
1084
+ width: 16,
1085
+ height: 16
1299
1086
  }
1300
- ]
1087
+ }]
1301
1088
  }, { quoted: message })
1302
1089
  ```
1090
+
1091
+ **Builder:**
1092
+
1093
+ ```js
1094
+ await sock.sendMessage(jid, {
1095
+ items: [
1096
+ build.richSource([
1097
+ ['https://example.com/favicon.ico', 'https://example.com', 'Example']
1098
+ ])
1099
+ ]
1100
+ })
1101
+ ```
1102
+
1303
1103
  </details>
1304
1104
 
1305
1105
  <details>
1306
- <summary><b>Mixed Format</b></summary>
1106
+ <summary><b>๐Ÿ“Œ Rich Tip, Footer & Metadata โ€” <code>richTip</code> / <code>richFooter</code> / <code>richMetadata</code></b></summary>
1307
1107
 
1308
1108
  ```js
1309
1109
  await sock.sendMessage(jid, {
1310
- richSources: [
1311
- ['https://wikipedia.org/fav.ico', 'https://wikipedia.org', 'Wikipedia'],
1312
- { source_type: 'THIRD_PARTY', source_display_name: 'Docs', source_url: 'https://docs.example.com' }
1313
- ]
1110
+ richTip: 'Dihasilkan oleh AI ยท PontaLabs'
1111
+ }, { quoted: message })
1112
+
1113
+ await sock.sendMessage(jid, {
1114
+ richFooter: 'ยฉ PontaLabs ยท Data bersumber dari layanan publik'
1314
1115
  }, { quoted: message })
1315
1116
  ```
1316
- </details>
1317
1117
 
1318
- ---
1118
+ **Builder:**
1319
1119
 
1320
- #### ๐Ÿ“Œ Rich Tip & Footer
1120
+ ```js
1121
+ await sock.sendMessage(jid, {
1122
+ items: [
1123
+ build.richTip('AI-generated content'),
1124
+ build.richMetadata('PontaLabs Rich Message'),
1125
+ build.richFooter('ยฉ PontaLabs')
1126
+ ]
1127
+ })
1128
+ ```
1321
1129
 
1322
- > `richTip` โ€” small metadata text above/center of message.
1323
- > `richFooter` โ€” metadata text below message (disclaimer / branding).
1130
+ </details>
1324
1131
 
1325
1132
  <details>
1326
- <summary><b>Rich Tip</b></summary>
1133
+ <summary><b>๐Ÿงฉ Rich FOA Text โ€” <code>richFOAText</code></b></summary>
1327
1134
 
1328
1135
  ```js
1329
1136
  await sock.sendMessage(jid, {
1330
- richTip: 'Dihasilkan oleh AI ยท pontalabs v0.3.4'
1331
- }, { quoted: message })
1137
+ items: [
1138
+ build.richFOAText('Halo dari FOA Rich Text')
1139
+ ]
1140
+ })
1332
1141
  ```
1142
+
1333
1143
  </details>
1334
1144
 
1335
1145
  <details>
1336
- <summary><b>Rich Footer</b></summary>
1146
+ <summary><b>๐Ÿงฑ Rich Widget โ€” <code>richWidget</code></b></summary>
1337
1147
 
1338
1148
  ```js
1339
1149
  await sock.sendMessage(jid, {
1340
- richFooter: 'ยฉ 2025 PontaCT ยท Data bersumber dari layanan publik'
1341
- }, { quoted: message })
1150
+ items: [
1151
+ build.richWidget({
1152
+ /* widget payload */
1153
+ })
1154
+ ]
1155
+ })
1342
1156
  ```
1157
+
1343
1158
  </details>
1344
1159
 
1345
1160
  <details>
1346
- <summary><b>Inside items / richResponse</b></summary>
1161
+ <summary><b>๐Ÿ”€ Mixed Rich โ€” <code>items</code></b></summary>
1162
+
1163
+ Semua Rich item dapat dicampur dalam satu `items`. Urutan array menjadi urutan tampilan.
1347
1164
 
1348
1165
  ```js
1349
- // items
1350
1166
  await sock.sendMessage(jid, {
1351
1167
  items: [
1352
- { text: 'Hasil pencarian:' },
1353
- { sources: [['https://fav.ico', 'https://example.com', 'Example']] },
1354
- { tip: 'AI-generated content' },
1355
- { footer: 'ยฉ PontaCT Baileys' }
1168
+ { text: '*Laporan Harian Bot*' },
1169
+ { table: {
1170
+ headers: ['Metric', 'Value'],
1171
+ rows: [
1172
+ ['Uptime', '99.9%'],
1173
+ ['Messages', '1.2K']
1174
+ ]
1175
+ }},
1176
+ build.richCode('SELECT COUNT(*) FROM messages;', 'sql'),
1177
+ build.richHtml('<h2>Dashboard</h2>'),
1178
+ build.richSuggest('Refresh'),
1179
+ build.richFooter('Auto-generated ยท PontaLabs')
1356
1180
  ]
1357
1181
  }, { quoted: message })
1182
+ ```
1183
+
1184
+ **Item shorthand yang tersedia:**
1185
+
1186
+ <details>
1187
+ <summary><b>๐Ÿ“‹ Lihat semua key <code>items</code></b></summary>
1188
+
1189
+ - `{ text, inlineEntities? }` โ€” Rich text
1190
+ - `{ code, language }` โ€” Code block
1191
+ - `{ table }` โ€” Table
1192
+ - `{ images }` โ€” Image grid
1193
+ - `{ videoUrl, mimeType?, duration? }` โ€” Video
1194
+ - `{ suggestions }` โ€” Suggestion pills
1195
+ - `{ latexUrl, latexText?, latexWidth?, latexHeight? }` โ€” LaTeX
1196
+ - `{ product }` โ€” Product card
1197
+ - `{ post }` โ€” Post card
1198
+ - `{ reels }` โ€” Reels
1199
+ - `{ sources }` โ€” Sources
1200
+ - `{ tip }` โ€” Tip
1201
+ - `{ footer }` โ€” Footer
1202
+
1203
+ </details>
1358
1204
 
1359
- // richResponse
1205
+ </details>
1206
+
1207
+ <details>
1208
+ <summary><b>๐Ÿ”— Rich Response โ€” <code>richResponse</code></b></summary>
1209
+
1210
+ `richResponse` adalah full array mode untuk menyusun Rich primitive secara manual, termasuk inline citation melalui `inlineEntities`.
1211
+
1212
+ **Basic:**
1213
+
1214
+ ```js
1360
1215
  await sock.sendMessage(jid, {
1361
1216
  richResponse: [
1362
- { text: 'Summary di sini.' },
1363
- { footer: 'ยฉ PontaCT ยท pontalabs' }
1217
+ { text: '*Hasil:* Node.js adalah runtime JavaScript.' },
1218
+ { code: 'node --version', language: 'bash' },
1219
+ { suggestions: ['Lihat docs', 'Install'] },
1220
+ { footer: 'PontaLabs' }
1364
1221
  ]
1365
1222
  }, { quoted: message })
1366
1223
  ```
1367
- </details>
1368
1224
 
1369
- ---
1225
+ **Inline citation:**
1370
1226
 
1371
- #### ๐Ÿ”€ Rich Mixed โ€” `items`
1227
+ ```js
1228
+ await sock.sendMessage(jid, {
1229
+ richResponse: [{
1230
+ text: 'Node.js {{SS_0}}ยน{{/SS_0}} adalah runtime JavaScript.',
1231
+ inlineEntities: [{
1232
+ key: 'SS_0',
1233
+ metadata: {
1234
+ reference_id: 1,
1235
+ reference_url: 'https://nodejs.org',
1236
+ reference_title: 'Node.js Official',
1237
+ reference_display_name: 'nodejs.org',
1238
+ sources: [{
1239
+ source_type: 'THIRD_PARTY',
1240
+ source_display_name: 'nodejs.org',
1241
+ source_subtitle: 'nodejs.org',
1242
+ source_url: 'https://nodejs.org'
1243
+ }],
1244
+ __typename: 'GenAISearchCitationItem'
1245
+ }
1246
+ }]
1247
+ }]
1248
+ }, { quoted: message })
1249
+ ```
1372
1250
 
1373
- > Combine all rich types in any order. Array order = display order.
1251
+ **Table di `richResponse`:**
1374
1252
 
1375
- **Valid keys in `items`:**
1253
+ ```js
1254
+ await sock.sendMessage(jid, {
1255
+ richResponse: [{
1256
+ table: [
1257
+ { items: ['Version', 'LTS', 'Release'], isHeading: true },
1258
+ { items: ['22.x', 'Yes', '2024'], isHeading: false }
1259
+ ]
1260
+ }]
1261
+ })
1262
+ ```
1376
1263
 
1377
- | Key | Type |
1378
- |:---|:---|
1379
- | `{ text }` | Rich text |
1380
- | `{ code, language }` | Code block |
1381
- | `{ table }` | Table |
1382
- | `{ images }` | Image grid |
1383
- | `{ videoUrl, mimeType?, duration? }` | Video embed |
1384
- | `{ suggestions }` | Suggestion pills |
1385
- | `{ latexUrl, latexText?, latexWidth?, latexHeight? }` | LaTeX formula |
1386
- | `{ product }` | Product card(s) |
1387
- | `{ post }` | Post card(s) |
1388
- | `{ reels }` | Reels carousel |
1389
- | `{ sources }` | Search sources |
1390
- | `{ tip }` | Tip metadata |
1391
- | `{ footer }` | Footer metadata |
1264
+ > Berbeda dari `table` top-level / `items`, format table di `richResponse` harus berupa array row siap-pakai.
1265
+
1266
+ </details>
1392
1267
 
1393
1268
  <details>
1394
- <summary><b>Text + Code + Table</b></summary>
1269
+ <summary><b>๐ŸŽ›๏ธ Interactive Rich Builder โ€” Button, ButtonV2 & Carousel</b></summary>
1270
+
1271
+ Builder interactive juga berada di namespace `build` dan dikirim melalui `sock.sendMessage()`.
1272
+
1273
+ **Native Flow Button:**
1395
1274
 
1396
1275
  ```js
1276
+ const button = build.button()
1277
+ .setTitle('Menu')
1278
+ .setBody('Pilih salah satu')
1279
+ .setFooter('PontaLabs')
1280
+ .addReply('Halo', 'hello')
1281
+ .addUrl('Website', 'https://example.com')
1282
+ .addCopy('Copy ID', 'ABC123')
1283
+
1397
1284
  await sock.sendMessage(jid, {
1398
- items: [
1399
- { text: 'Query yang dijalankan:' },
1400
- { code: 'SELECT id, name, score FROM users ORDER BY score DESC LIMIT 3', language: 'sql' },
1401
- { text: 'Hasil:' },
1402
- {
1403
- table: {
1404
- headers: ['id', 'name', 'score'],
1405
- rows: [
1406
- ['1', 'Ponta', '98'],
1407
- ['2', 'Yue', '87'],
1408
- ['3', 'Frieren', '75']
1409
- ]
1410
- }
1411
- }
1412
- ]
1413
- }, { quoted: message })
1285
+ items: [button]
1286
+ })
1287
+ ```
1288
+
1289
+ **ButtonV2:**
1290
+
1291
+ ```js
1292
+ const buttons = build.buttonV2()
1293
+ .setBody('Pilih aksi')
1294
+ .setFooter('PontaLabs')
1295
+ .addButton('Yes')
1296
+ .addButton('No')
1297
+
1298
+ await sock.sendMessage(jid, {
1299
+ items: [buttons]
1300
+ })
1301
+ ```
1302
+
1303
+ **Carousel:**
1304
+
1305
+ ```js
1306
+ const carousel = build.carousel()
1307
+ .setBody('Pilih produk')
1308
+ .setFooter('PontaLabs')
1309
+ .addCard(card)
1310
+
1311
+ await sock.sendMessage(jid, {
1312
+ items: [carousel]
1313
+ })
1414
1314
  ```
1315
+
1316
+ > `build.button()`, `build.buttonV2()`, dan `build.carousel()` tidak membutuhkan `sock` saat dibuat. Builder hanya menghasilkan payload.
1317
+
1415
1318
  </details>
1416
1319
 
1417
1320
  <details>
1418
- <summary><b>Text + Images + Video + Suggestions</b></summary>
1321
+ <summary><b>โฑ๏ธ Rich Build Delay โ€” <code>buildDelay</code></b></summary>
1322
+
1323
+ `buildDelay` digunakan bersama `items` untuk melakukan progressive update pada target message yang sama.
1419
1324
 
1420
1325
  ```js
1421
1326
  await sock.sendMessage(jid, {
1422
1327
  items: [
1423
- { text: '*Konten hari ini*' },
1424
- { images: ['https://example.com/1.jpg', 'https://example.com/2.jpg'] },
1425
- { videoUrl: 'https://example.com/preview.mp4', duration: 15 },
1426
- { suggestions: ['Lihat selengkapnya', 'Bagikan', 'Simpan'] }
1427
- ]
1428
- }, { quoted: message })
1328
+ build.richText('โณ Memproses...'),
1329
+ build.richText('๐Ÿ” Mencari data...'),
1330
+ build.richText('โœ… Selesai!')
1331
+ ],
1332
+ buildDelay: 1000
1333
+ })
1429
1334
  ```
1430
- </details>
1431
1335
 
1432
- <details>
1433
- <summary><b>Full Mixed (all types)</b></summary>
1336
+ Dengan `buildDelay: 1000`, item berikutnya diproses setiap 1 detik dan update tetap menggunakan message ID target yang sama.
1337
+
1338
+ **Custom message ID:**
1434
1339
 
1435
1340
  ```js
1436
1341
  await sock.sendMessage(jid, {
1342
+ messageId: 'MY_MESSAGE_ID',
1437
1343
  items: [
1438
- { text: '*Laporan Harian Bot*' },
1439
- { table: { headers: ['Metric', 'Value'], rows: [['Uptime', '99.9%'], ['Messages', '1.2K']] } },
1440
- { code: 'SELECT COUNT(*) FROM messages WHERE date = CURDATE()', language: 'sql' },
1441
- { text: 'Formula uptime:' },
1442
- {
1443
- latexUrl: 'https://latex.codecogs.com/png.latex?U%3D%5Cfrac%7Bt_u%7D%7Bt_t%7D%5Ctimes100',
1444
- latexText: 'U = (tu/tt) ร— 100'
1445
- },
1446
- { sources: [['https://example.com/fav.ico', 'https://example.com', 'Dashboard']] },
1447
- { suggestions: ['Refresh', 'Export PDF'] },
1448
- { footer: 'Auto-generated ยท PontaCT' }
1449
- ]
1450
- }, { quoted: message })
1344
+ build.richText('Build 1'),
1345
+ build.richText('Build 2')
1346
+ ],
1347
+ buildDelay: 1000
1348
+ })
1451
1349
  ```
1350
+
1351
+ > `buildDelay` hanya berlaku untuk `items` dan nilainya harus lebih besar dari `0`.
1352
+
1452
1353
  </details>
1453
1354
 
1454
- ---
1355
+ <details>
1356
+ <summary><b>๐Ÿ› ๏ธ Advanced Rich Builder โ€” <code>build.AIRich(sock)</code></b></summary>
1455
1357
 
1456
- #### ๐Ÿ”— Rich Response โ€” `richResponse`
1358
+ Untuk state, node ID, replace, insert, delete, dan edit message gunakan `build.AIRich(sock)`.
1457
1359
 
1458
- > Full array mode supporting all types including inline citations via `inlineEntities`.
1360
+ ```js
1361
+ const ai = build.AIRich(sock)
1459
1362
 
1460
- **Valid keys in `richResponse`:**
1363
+ ai.addText('โณ Loading...', { id: 'status' })
1364
+ ai.addTip('Mohon tunggu')
1461
1365
 
1462
- | Key | Type |
1463
- |:---|:---|
1464
- | `{ text, inlineEntities? }` | Text + optional citation/hyperlink |
1465
- | `{ code, language }` | Code block |
1466
- | `{ table, title? }` | Table โ€” โš ๏ธ format beda dari `items`/top-level: `table` di sini harus array baris siap-pakai `[{ items: [...], isHeading }]`, **bukan** `{ headers, rows }` |
1467
- | `{ images }` | Image grid |
1468
- | `{ video }` | Video embed |
1469
- | `{ suggestions }` | Suggestion pills |
1470
- | `{ latex }` | LaTeX formula |
1471
- | `{ product }` | Product card(s) |
1472
- | `{ post }` | Post card(s) |
1473
- | `{ reels }` | Reels carousel |
1474
- | `{ sources }` | Search sources |
1475
- | `{ tip }` | Tip metadata |
1476
- | `{ footer }` | Footer metadata |
1366
+ await ai.send(jid)
1477
1367
 
1478
- <details>
1479
- <summary><b>Inline Citation</b></summary>
1368
+ ai.addText('โœ… Selesai!', { replace: 'status' })
1369
+ ai.delete('status')
1370
+ ai.addTip('Tambahan', { insertAt: 'status' })
1371
+ ```
1372
+
1373
+ **Contoh edit:**
1480
1374
 
1481
1375
  ```js
1482
- await sock.sendMessage(jid, {
1483
- richResponse: [
1484
- {
1485
- text: 'Node.js {{SS_0}}ยน{{/SS_0}} adalah runtime JavaScript. Dibuat oleh Ryan Dahl {{SS_1}}ยฒ{{/SS_1}} pada 2009.',
1486
- inlineEntities: [
1487
- {
1488
- key: 'SS_0',
1489
- metadata: {
1490
- reference_id: 1,
1491
- reference_url: 'https://nodejs.org',
1492
- reference_title: 'Node.js Official',
1493
- reference_display_name: 'nodejs.org',
1494
- sources: [{
1495
- source_type: 'THIRD_PARTY',
1496
- source_display_name: 'nodejs.org',
1497
- source_subtitle: 'nodejs.org',
1498
- source_url: 'https://nodejs.org'
1499
- }],
1500
- __typename: 'GenAISearchCitationItem'
1501
- }
1502
- },
1503
- {
1504
- key: 'SS_1',
1505
- metadata: {
1506
- reference_id: 2,
1507
- reference_url: 'https://wikipedia.org/wiki/Ryan_Dahl',
1508
- reference_title: 'Ryan Dahl - Wikipedia',
1509
- reference_display_name: 'Wikipedia',
1510
- sources: [{
1511
- source_type: 'THIRD_PARTY',
1512
- source_display_name: 'Wikipedia',
1513
- source_subtitle: 'wikipedia.org',
1514
- source_url: 'https://wikipedia.org/wiki/Ryan_Dahl'
1515
- }],
1516
- __typename: 'GenAISearchCitationItem'
1517
- }
1518
- }
1519
- ]
1520
- }
1521
- ]
1522
- }, { quoted: message })
1376
+ const ai = build.AIRich(sock)
1377
+
1378
+ ai.addText('โณ Memproses...', { id: 'answer' })
1379
+ await ai.send(jid)
1380
+
1381
+ const result = await getAIResponse()
1382
+
1383
+ ai.addText(result, { replace: 'answer' })
1384
+ ai.addTip('Generated by AI')
1385
+
1386
+ await ai.sendEdit(jid)
1523
1387
  ```
1388
+
1389
+ > `replace` dan `insertAt` adalah options pada `add*()`, bukan method `ai.replace()` atau `ai.insertAt()`.
1390
+
1524
1391
  </details>
1525
1392
 
1526
1393
  <details>
1527
- <summary><b>Full Response โ€” all types at once</b></summary>
1394
+ <summary><b>โš™๏ธ Rich Options โ€” <code>aiForwarded</code></b></summary>
1395
+
1396
+ `aiForwarded` menambahkan label forwarded-from-AI-bot pada `contextInfo`.
1528
1397
 
1529
1398
  ```js
1530
1399
  await sock.sendMessage(jid, {
1531
- richResponse: [
1532
- { text: '*Hasil Pencarian:* Node.js {{SS_0}}ยน{{/SS_0}}', inlineEntities: [/* ... */] },
1533
- { images: ['https://example.com/nodejs.png'] },
1534
- { text: 'Cara install:' },
1535
- { code: 'npm install node', language: 'bash' },
1536
- {
1537
- table: [
1538
- { items: ['Version', 'LTS', 'Release'], isHeading: true },
1539
- { items: ['22.x', 'Yes', '2024'], isHeading: false },
1540
- { items: ['21.x', 'No', '2023'], isHeading: false }
1541
- ]
1542
- },
1543
- { sources: [['https://nodejs.org/fav.ico', 'https://nodejs.org', 'Node.js']] },
1544
- { suggestions: ['Lihat changelog', 'Download', 'Docs'] },
1545
- { footer: 'PontaCT ยท pontalabs' }
1546
- ]
1400
+ richText: 'Pesan dengan label AI bot',
1401
+ aiForwarded: true
1547
1402
  }, { quoted: message })
1548
1403
  ```
1549
- </details>
1550
1404
 
1551
- ---
1405
+ Bisa digunakan bersama `richText`, `items`, `richResponse`, `richHtml`, dan key Rich lainnya.
1552
1406
 
1553
- #### โš™๏ธ Rich Options
1407
+ </details>
1554
1408
 
1555
1409
  <details>
1556
- <summary><b><code>aiForwarded</code> โ€” toggle label "Diteruskan dari bot AI"</b></summary>
1410
+ <summary><b>๐Ÿ”Œ Legacy Compatibility</b></summary>
1557
1411
 
1558
- > Default `false`. Set `true` kalau mau pesan diberi tag forwarded-from-AI-bot di `contextInfo`. Bisa dipakai bareng key rich manapun (`richText`, `items`, `richResponse`, dll).
1412
+ API Rich lama tetap kompatibel:
1559
1413
 
1560
1414
  ```js
1561
1415
  await sock.sendMessage(jid, {
1562
- richText: 'Pesan dengan label AI bot',
1563
- aiForwarded: true
1564
- }, { quoted: message })
1416
+ richText: 'Halo'
1417
+ })
1418
+
1419
+ await sock.sendMessage(jid, {
1420
+ items: [
1421
+ { richText: 'Halo' },
1422
+ { richTip: 'Testing' }
1423
+ ]
1424
+ })
1565
1425
  ```
1426
+
1427
+ Kamu juga dapat mencampur object Rich lama dengan `build.*`:
1428
+
1429
+ ```js
1430
+ await sock.sendMessage(jid, {
1431
+ items: [
1432
+ { richText: 'Shortcut lama' },
1433
+ build.richText('Builder baru'),
1434
+ { richTip: 'Shortcut lama' },
1435
+ build.richTip('Builder baru')
1436
+ ]
1437
+ })
1438
+ ```
1439
+
1566
1440
  </details>
1567
1441
 
1568
1442
  ---