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