elynn-baileys 1.0.1 โ 1.0.3
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 +950 -317
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,115 +1,266 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# elynn-baileys
|
|
4
|
+
|
|
5
|
+
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:0a0a12,50:2b1a2e,100:0a0a12&height=220§ion=header&text=ELYNN%20BAILEYS&fontSize=62&fontColor=e8b76a&fontAlign=50&fontAlignY=38&desc=WhatsApp%20%C2%B7%20Telegram%20%C2%B7%20Discord%20%E2%80%94%20Unified%20Engine&descAlign=50&descAlignY=62&descSize=18&animation=fadeIn" width="100%"/>
|
|
6
|
+
|
|
7
|
+
<br>
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<img src="https://i.ibb.co/xq4NzXq0/elynn28760176.png" width="100%" style="border-radius:14px;box-shadow:0 8px 30px rgba(0,0,0,0.55);" />
|
|
11
|
+
|
|
12
|
+
<br><br>
|
|
13
|
+
|
|
14
|
+
<picture>
|
|
15
|
+
<img alt="elynn-baileys" src="https://readme-typing-svg.demolab.com/?font=Georgia&size=30&duration=3200&pause=900&color=E8B76A¢er=true&vCenter=true&width=820&height=55&lines=elynn-baileys;Satu+Library%2C+Tiga+Platform;WhatsApp+%C2%B7+Telegram+%C2%B7+Discord;Dibangun+untuk+yang+Serius+Membangun" />
|
|
16
|
+
</picture>
|
|
17
|
+
|
|
18
|
+
<br><br>
|
|
19
|
+
|
|
20
|
+
<sub>โฆ ECMASCRIPT MODULES ยท NODE.JS 20+ ยท MIT LICENSE ยท MAINTAINED BY ELYNN โฆ</sub>
|
|
21
|
+
|
|
22
|
+
<br><br>
|
|
23
|
+
|
|
24
|
+
[](https://www.npmjs.com/package/elynn-baileys)
|
|
25
|
+
[](https://www.npmjs.com/package/elynn-baileys)
|
|
26
|
+
[](https://nodejs.org)
|
|
27
|
+
[](#)
|
|
28
|
+
[](#)
|
|
29
|
+
[](#)
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<br>
|
|
34
|
+
|
|
35
|
+
> [!IMPORTANT]
|
|
36
|
+
> **Elynn Baileys** adalah library WhatsApp Web API yang kuat, stabil, dan ditingkatkan jauh dari basis aslinya โ kini menyatu dengan engine Telegram Bot (`ElynnTelegraf`) **dan** Discord Client (`ElynnDiscord`) dalam satu package. Mendukung penuh protokol WhatsApp 2026 โ *View-Once Text*, *View-Once Voice Note*, *Community Events*, *Group Message History*, *Channel Polling*, dan lainnya โ dilengkapi plugin Brat/Bratvid bawaan serta fungsi eksklusif `testMessage` untuk menguji seluruh jenis pesan dalam satu panggilan. Dibangun khusus untuk Node.js dengan format ECMAScript Modules (ESM).
|
|
37
|
+
|
|
38
|
+
<br>
|
|
39
|
+
|
|
40
|
+
<div align="right">
|
|
41
|
+
|
|
42
|
+
<sub>โ PETA NAVIGASI โ</sub>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<table width="100%">
|
|
47
|
+
<tr>
|
|
48
|
+
<td width="33%" valign="top" align="center">
|
|
49
|
+
|
|
50
|
+
### โก WhatsApp
|
|
51
|
+
|
|
52
|
+
Engine inti, *enhanced* dari Baileys dengan dukungan protokol 2026 penuh โ pesan interaktif, media, event komunitas, hingga sistem keamanan session.
|
|
53
|
+
|
|
54
|
+
`makeWASocket` ยท `useMultiFileAuthState` ยท `makeInMemoryStore`
|
|
55
|
+
|
|
56
|
+
</td>
|
|
57
|
+
<td width="33%" valign="top" align="center">
|
|
58
|
+
|
|
59
|
+
### โก Telegram
|
|
60
|
+
|
|
61
|
+
`ElynnTelegraf` โ engine bot Telegram lengkap dari long-polling dasar hingga Bot API 10.1: managed bots, guest mode, rich messages.
|
|
62
|
+
|
|
63
|
+
`ElynnTelegraf` ยท Scenes & Wizard ยท Inline Keyboard
|
|
64
|
+
|
|
65
|
+
</td>
|
|
66
|
+
<td width="34%" valign="top" align="center">
|
|
67
|
+
|
|
68
|
+
### โก Discord
|
|
69
|
+
|
|
70
|
+
`ElynnDiscord` โ client Discord dari nol, mendukung slash command, sharding, modals UI 2026, dan per-guild bot profile.
|
|
71
|
+
|
|
72
|
+
`ElynnDiscord` ยท Slash Commands ยท ShardManager
|
|
73
|
+
|
|
74
|
+
</td>
|
|
75
|
+
</tr>
|
|
76
|
+
</table>
|
|
77
|
+
|
|
78
|
+
<br>
|
|
79
|
+
|
|
80
|
+
<div align="center">
|
|
81
|
+
|
|
82
|
+
### โก Mengapa elynn-baileys
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
| | |
|
|
87
|
+
|:---:|:---|
|
|
88
|
+
| **โ** | Satu dependency untuk **tiga platform messaging** sekaligus โ tidak perlu lagi merangkai tiga library berbeda dengan API yang tidak konsisten |
|
|
89
|
+
| **โ** | Dukungan penuh **protokol WhatsApp 2026** โ fitur-fitur terbaru yang belum tersedia di kebanyakan fork Baileys lain |
|
|
90
|
+
| **โ** | `testMessage` bawaan โ **uji 16 jenis pesan** dalam satu panggilan fungsi, tanpa setup tambahan |
|
|
91
|
+
| **โ** | `sessionGuard` โ kunci session ke IP server pertama, **proteksi nyata dari pencurian session** |
|
|
92
|
+
| **โ** | Plugin Brat/Bratvid **bawaan**, tidak perlu API key eksternal tambahan |
|
|
93
|
+
| **โ** | Tiga jenis Auth State (`multiFile`, `singleFile`, `sqlite`) โ fleksibel untuk **semua skala deployment** |
|
|
94
|
+
|
|
95
|
+
<br>
|
|
96
|
+
|
|
97
|
+
<div align="center">
|
|
98
|
+
|
|
99
|
+
<hr>
|
|
100
|
+
|
|
101
|
+
### โฆ Daftar Isi
|
|
102
|
+
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<table width="100%"><tr><td>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<code>01</code> <a href="#01-installation"><strong>Installation</strong></a><br>
|
|
109
|
+
|
|
110
|
+
<code>02</code> <a href="#02-quick-start"><strong>Quick Start</strong></a><br>
|
|
111
|
+
|
|
112
|
+
<code>03</code> <a href="#03-auth-state"><strong>Auth State</strong></a><br>
|
|
113
|
+
โฆ <a href="#-31-multi-file-auth-state">3.1 ยท Multi File Auth State</a><br>
|
|
114
|
+
โฆ <a href="#-32-single-file-auth-state">3.2 ยท Single File Auth State</a><br>
|
|
115
|
+
โฆ <a href="#-33-sqlite-auth-state">3.3 ยท SQLite Auth State</a><br>
|
|
116
|
+
<br>
|
|
117
|
+
|
|
118
|
+
<code>04</code> <a href="#04-makeinmemorystore"><strong>makeInMemoryStore</strong></a><br>
|
|
119
|
+
|
|
120
|
+
<details>
|
|
121
|
+
<summary><code>05</code> <a href="#05-sending-messages"><strong>Sending Messages</strong></a> <sub>(38 topik)</sub></summary>
|
|
122
|
+
<br>
|
|
123
|
+
|
|
124
|
+
โฆ <a href="#-51-text-biasa">5.1 ยท Text Biasa</a><br>
|
|
125
|
+
โฆ <a href="#-52-text-dengan-mention-user">5.2 ยท Text dengan Mention User</a><br>
|
|
126
|
+
โฆ <a href="#-53-mention-all">5.3 ยท Mention All</a><br>
|
|
127
|
+
โฆ <a href="#-54-reply-quote-message">5.4 ยท Reply / Quote Message</a><br>
|
|
128
|
+
โฆ <a href="#-55-reaction">5.5 ยท Reaction</a><br>
|
|
129
|
+
โฆ <a href="#-56-image">5.6 ยท Image</a><br>
|
|
130
|
+
โฆ <a href="#-57-video">5.7 ยท Video</a><br>
|
|
131
|
+
โฆ <a href="#-58-audio">5.8 ยท Audio</a><br>
|
|
132
|
+
โฆ <a href="#-59-document">5.9 ยท Document</a><br>
|
|
133
|
+
โฆ <a href="#-510-sticker">5.10 ยท Sticker</a><br>
|
|
134
|
+
โฆ <a href="#-511-sticker-pack">5.11 ยท Sticker Pack</a><br>
|
|
135
|
+
โฆ <a href="#-512-contact-vcard">5.12 ยท Contact / vCard</a><br>
|
|
136
|
+
โฆ <a href="#-513-location">5.13 ยท Location</a><br>
|
|
137
|
+
โฆ <a href="#-514-live-location">5.14 ยท Live Location</a><br>
|
|
138
|
+
โฆ <a href="#-515-poll">5.15 ยท Poll</a><br>
|
|
139
|
+
โฆ <a href="#-516-album">5.16 ยท Album</a><br>
|
|
140
|
+
โฆ <a href="#-517-interactive-buttons-native-flow">5.17 ยท Interactive โ Buttons (Native Flow)</a><br>
|
|
141
|
+
โฆ <a href="#-518-interactive-list">5.18 ยท Interactive โ List</a><br>
|
|
142
|
+
โฆ <a href="#-519-interactive-image-header">5.19 ยท Interactive โ Image Header</a><br>
|
|
143
|
+
โฆ <a href="#-520-interactive-sebagai-template">5.20 ยท Interactive sebagai Template</a><br>
|
|
144
|
+
โฆ <a href="#-521-hydrated-template-button">5.21 ยท Hydrated Template Button</a><br>
|
|
145
|
+
โฆ <a href="#-522-view-once">5.22 ยท View Once</a><br>
|
|
146
|
+
โฆ <a href="#-523-ephemeral">5.23 ยท Ephemeral</a><br>
|
|
147
|
+
โฆ <a href="#-524-spoiler">5.24 ยท Spoiler</a><br>
|
|
148
|
+
โฆ <a href="#-525-group-status">5.25 ยท Group Status</a><br>
|
|
149
|
+
โฆ <a href="#-526-external-ad-reply">5.26 ยท External Ad Reply</a><br>
|
|
150
|
+
โฆ <a href="#-527-forward-pesan">5.27 ยท Forward Pesan</a><br>
|
|
151
|
+
โฆ <a href="#-528-pin-pesan">5.28 ยท Pin Pesan</a><br>
|
|
152
|
+
โฆ <a href="#-529-raw-message">5.29 ยท Raw Message</a><br>
|
|
153
|
+
โฆ <a href="#-530-group-invite-link">5.30 ยท Group Invite Link</a><br>
|
|
154
|
+
โฆ <a href="#-531-event-dengan-reminder-fitur-wa-januari-2026">5.31 ยท Event dengan Reminder (fitur WA Januari 2026)</a><br>
|
|
155
|
+
โฆ <a href="#-532-text-sticker-fitur-wa-januari-2026">5.32 ยท Text Sticker (fitur WA Januari 2026)</a><br>
|
|
156
|
+
โฆ <a href="#-533-view-once-text-teks-sekali-lihat-wa-2026">5.33 ยท View-Once Text โ Teks Sekali Lihat (WA 2026)</a><br>
|
|
157
|
+
โฆ <a href="#-534-view-once-voice-note-audio-sekali-dengar-wa-2026">5.34 ยท View-Once Voice Note โ Audio Sekali Dengar (WA 2026)</a><br>
|
|
158
|
+
โฆ <a href="#-535-community-event-rsvp-virtual-meeting-call-wa-2026">5.35 ยท Community Event โ RSVP & Virtual Meeting Call (WA 2026)</a><br>
|
|
159
|
+
โฆ <a href="#-536-group-message-history-share-wa-2026">5.36 ยท Group Message History Share (WA 2026)</a><br>
|
|
160
|
+
โฆ <a href="#-537-channel-poll-polling-di-saluranchannel-wa-2026">5.37 ยท Channel Poll โ Polling di Saluran/Channel (WA 2026)</a><br>
|
|
161
|
+
โฆ <a href="#-538-channel-voice-note-wa-2026">5.38 ยท Channel Voice Note (WA 2026)</a><br>
|
|
162
|
+
|
|
163
|
+
</details>
|
|
164
|
+
<br>
|
|
165
|
+
|
|
166
|
+
<code>06</code> <a href="#06-rich-response-messages"><strong>Rich Response Messages</strong></a><br>
|
|
167
|
+
โฆ <a href="#-61-text-rich">6.1 ยท Text Rich</a><br>
|
|
168
|
+
โฆ <a href="#-62-code-block">6.2 ยท Code Block</a><br>
|
|
169
|
+
โฆ <a href="#-63-table">6.3 ยท Table</a><br>
|
|
170
|
+
โฆ <a href="#-64-inline-image">6.4 ยท Inline Image</a><br>
|
|
171
|
+
โฆ <a href="#-65-inline-link-citation">6.5 ยท Inline Link / Citation</a><br>
|
|
172
|
+
โฆ <a href="#-66-rich-response-kombinasi">6.6 ยท Rich Response Kombinasi</a><br>
|
|
173
|
+
<br>
|
|
174
|
+
|
|
175
|
+
<code>07</code> <a href="#07-group-management"><strong>Group Management</strong></a><br>
|
|
176
|
+
|
|
177
|
+
<code>08</code> <a href="#08-newsletter-channel"><strong>Newsletter / Channel</strong></a><br>
|
|
178
|
+
|
|
179
|
+
<code>09</code> <a href="#09-privacy-profile"><strong>Privacy & Profile</strong></a><br>
|
|
180
|
+
|
|
181
|
+
<code>10</code> <a href="#10-handling-events"><strong>Handling Events</strong></a><br>
|
|
182
|
+
|
|
183
|
+
<code>11</code> <a href="#11-elynn-plugins-brat-bratvid"><strong>Elynn Plugins : Brat & Bratvid</strong></a><br>
|
|
184
|
+
|
|
185
|
+
<code>12</code> <a href="#12-read-messages-presence"><strong>Read Messages & Presence</strong></a><br>
|
|
186
|
+
|
|
187
|
+
<code>13</code> <a href="#13-delete-edit-pesan"><strong>Delete / Edit Pesan</strong></a><br>
|
|
188
|
+
|
|
189
|
+
<code>14</code> <a href="#14-message-options-tambahan"><strong>Message Options Tambahan</strong></a><br>
|
|
190
|
+
|
|
191
|
+
<code>15</code> <a href="#15-browser-fingerprint-kiwi-uc-browser-dll"><strong>Browser Fingerprint (Kiwi, UC Browser, dll)</strong></a><br>
|
|
192
|
+
|
|
193
|
+
<details>
|
|
194
|
+
<summary><code>16</code> <a href="#16-telegram-bot-elynntelegraf"><strong>Telegram Bot (ElynnTelegraf)</strong></a> <sub>(17 topik)</sub></summary>
|
|
195
|
+
<br>
|
|
196
|
+
|
|
197
|
+
โฆ <a href="#-161-setup-dasar-long-polling">16.1 ยท Setup Dasar & Long Polling</a><br>
|
|
198
|
+
โฆ <a href="#-162-setup-via-webhook">16.2 ยท Setup via Webhook</a><br>
|
|
199
|
+
โฆ <a href="#-163-inline-keyboard-reply-keyboard">16.3 ยท Inline Keyboard & Reply Keyboard</a><br>
|
|
200
|
+
โฆ <a href="#-164-session-scenes-wizard">16.4 ยท Session, Scenes & Wizard</a><br>
|
|
201
|
+
โฆ <a href="#-165-memanggil-elynn-plugins-bratbratvid-dari-bot-telegram">16.5 ยท Memanggil Elynn Plugins (Brat/Bratvid) dari Bot Telegram</a><br>
|
|
202
|
+
โฆ <a href="#-166-cek-koneksi-bot-dengan-connecttelegram">16.6 ยท Cek Koneksi Bot dengan `connectTelegram`</a><br>
|
|
203
|
+
โฆ <a href="#-167-bot-api-9394-sendmessagedraft-profile-photo-bot-button-style-icon">16.7 ยท Bot API 9.3โ9.4 โ sendMessageDraft, Profile Photo Bot, Button Style & Icon</a><br>
|
|
204
|
+
โฆ <a href="#-168-bot-api-95-member-tags-date-time-entity">16.8 ยท Bot API 9.5 โ Member Tags, Date-Time Entity</a><br>
|
|
205
|
+
โฆ <a href="#-169-bot-api-96-managed-bots">16.9 ยท Bot API 9.6 โ Managed Bots</a><br>
|
|
206
|
+
โฆ <a href="#-1610-bot-api-100-guest-mode">16.10 ยท Bot API 10.0 โ Guest Mode</a><br>
|
|
207
|
+
โฆ <a href="#-1611-bot-api-100-bot-to-bot-communication">16.11 ยท Bot API 10.0 โ Bot-to-Bot Communication</a><br>
|
|
208
|
+
โฆ <a href="#-1612-bot-api-100-delete-reactions">16.12 ยท Bot API 10.0 โ Delete Reactions</a><br>
|
|
209
|
+
โฆ <a href="#-1613-bot-api-100-live-photo">16.13 ยท Bot API 10.0 โ Live Photo</a><br>
|
|
210
|
+
โฆ <a href="#-1614-bot-api-100-managed-bot-access-settings">16.14 ยท Bot API 10.0 โ Managed Bot Access Settings</a><br>
|
|
211
|
+
โฆ <a href="#-1615-bot-api-100-get-user-personal-chat-messages">16.15 ยท Bot API 10.0 โ Get User Personal Chat Messages</a><br>
|
|
212
|
+
โฆ <a href="#-1616-bot-api-101-join-request-queries">16.16 ยท Bot API 10.1 โ Join Request Queries</a><br>
|
|
213
|
+
โฆ <a href="#-1617-bot-api-101-rich-messages">16.17 ยท Bot API 10.1 โ Rich Messages</a><br>
|
|
214
|
+
|
|
215
|
+
</details>
|
|
216
|
+
<br>
|
|
217
|
+
|
|
218
|
+
<code>17</code> <a href="#17-discord-bot-elynndiscord"><strong>Discord Bot (ElynnDiscord)</strong></a><br>
|
|
219
|
+
โฆ <a href="#-171-setup-dasar-login-bot">17.1 ยท Setup Dasar & Login Bot</a><br>
|
|
220
|
+
โฆ <a href="#-172-menangani-event-pesan">17.2 ยท Menangani Event & Pesan</a><br>
|
|
221
|
+
โฆ <a href="#-173-slash-commands-application-commands">17.3 ยท Slash Commands (Application Commands)</a><br>
|
|
222
|
+
โฆ <a href="#-174-embed-file-upload">17.4 ยท Embed & File Upload</a><br>
|
|
223
|
+
โฆ <a href="#-175-sharding-dengan-shardmanager">17.5 ยท Sharding dengan ShardManager</a><br>
|
|
224
|
+
โฆ <a href="#-176-cek-koneksi-bot-dengan-connectdiscord">17.6 ยท Cek Koneksi Bot dengan `connectDiscord`</a><br>
|
|
225
|
+
<br>
|
|
226
|
+
|
|
227
|
+
<code>18</code> <a href="#18-testmessage-tes-semua-jenis-pesan"><strong>testMessage : Tes Semua Jenis Pesan</strong></a><br>
|
|
228
|
+
โฆ <a href="#-cara-import-penggunaan">Cara import & penggunaan</a><br>
|
|
229
|
+
โฆ <a href="#-signature-lengkap">Signature lengkap</a><br>
|
|
230
|
+
โฆ <a href="#-yang-diuji-16-jenis-pesan">Yang diuji (16 jenis pesan)</a><br>
|
|
231
|
+
<br>
|
|
232
|
+
|
|
233
|
+
<details>
|
|
234
|
+
<summary><code>19</code> <a href="#19-sessionguard-proteksi-session-dari-pencurian"><strong>sessionGuard : Proteksi Session dari Pencurian</strong></a> <sub>(7 topik)</sub></summary>
|
|
235
|
+
<br>
|
|
236
|
+
|
|
237
|
+
โฆ <a href="#-cara-import">Cara Import</a><br>
|
|
238
|
+
โฆ <a href="#-penggunaan-dasar">Penggunaan Dasar</a><br>
|
|
239
|
+
โฆ <a href="#-opsi-lengkap">Opsi Lengkap</a><br>
|
|
240
|
+
โฆ <a href="#-cara-kerja">Cara Kerja</a><br>
|
|
241
|
+
โฆ <a href="#-cek-status-guard">Cek Status Guard</a><br>
|
|
242
|
+
โฆ <a href="#-reset-guard-pindah-server">Reset Guard (Pindah Server)</a><br>
|
|
243
|
+
โฆ <a href="#-contoh-output-log">Contoh Output Log</a><br>
|
|
244
|
+
|
|
245
|
+
</details>
|
|
246
|
+
<br>
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
</td></tr></table>
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
<br>
|
|
253
|
+
|
|
254
|
+
<br>
|
|
255
|
+
|
|
256
|
+
<div align="right"><sub>ยง SECTION 01</sub></div>
|
|
257
|
+
|
|
258
|
+
## 01 โ Installation
|
|
259
|
+
|
|
260
|
+
<hr>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
Anda dapat menginstal package ini menggunakan manajer paket Node.js favorit Anda. Package ini membutuhkan Node.js versi 20 ke atas.
|
|
113
264
|
```bash
|
|
114
265
|
npm install elynn-baileys
|
|
115
266
|
|
|
@@ -127,7 +278,17 @@ Untuk memaksimalkan semua fitur yang ada, terutama fitur manipulasi media, integ
|
|
|
127
278
|
npm install sharp jimp @napi-rs/image audio-decode better-sqlite3 link-preview-js
|
|
128
279
|
|
|
129
280
|
```
|
|
130
|
-
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
<br>
|
|
284
|
+
|
|
285
|
+
<div align="right"><sub>ยง SECTION 02</sub></div>
|
|
286
|
+
|
|
287
|
+
## 02 โ Quick Start
|
|
288
|
+
|
|
289
|
+
<hr>
|
|
290
|
+
|
|
291
|
+
|
|
131
292
|
Berikut adalah contoh lengkap cara melakukan inisialisasi koneksi ke WhatsApp. Kode ini menangani pembuatan socket, integrasi kredensial login, dan logika rekoneksi otomatis. Terdapat dua metode login: menggunakan Pairing Code atau QR Code.
|
|
132
293
|
```js
|
|
133
294
|
import pino from 'pino'
|
|
@@ -182,9 +343,21 @@ async function connectToWhatsApp() {
|
|
|
182
343
|
connectToWhatsApp()
|
|
183
344
|
|
|
184
345
|
```
|
|
185
|
-
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
<br>
|
|
349
|
+
|
|
350
|
+
<div align="right"><sub>ยง SECTION 03</sub></div>
|
|
351
|
+
|
|
352
|
+
## 03 โ Auth State
|
|
353
|
+
|
|
354
|
+
<hr>
|
|
355
|
+
|
|
356
|
+
|
|
186
357
|
elynn-baileys menyediakan tiga jenis mekanisme penyimpanan status autentikasi yang dapat Anda pilih sesuai dengan infrastruktur aplikasi Anda.
|
|
187
|
-
|
|
358
|
+
|
|
359
|
+
#### โ 3.1 ยท Multi File Auth State
|
|
360
|
+
|
|
188
361
|
Menyimpan data kredensial dan keys dalam sebuah direktori yang berisi banyak file JSON. Sangat stabil dan direkomendasikan untuk penggunaan standar.
|
|
189
362
|
```js
|
|
190
363
|
import { useMultiFileAuthState } from 'elynn-baileys'
|
|
@@ -195,7 +368,9 @@ async function setupAuth() {
|
|
|
195
368
|
}
|
|
196
369
|
|
|
197
370
|
```
|
|
198
|
-
|
|
371
|
+
|
|
372
|
+
#### โ 3.2 ยท Single File Auth State
|
|
373
|
+
|
|
199
374
|
Menyimpan seluruh data kredensial ke dalam satu file JSON tunggal. Mudah dipindahkan namun bisa menjadi sangat besar seiring waktu.
|
|
200
375
|
```js
|
|
201
376
|
import { useSingleFileAuthState } from 'elynn-baileys'
|
|
@@ -206,7 +381,9 @@ async function setupAuth() {
|
|
|
206
381
|
}
|
|
207
382
|
|
|
208
383
|
```
|
|
209
|
-
|
|
384
|
+
|
|
385
|
+
#### โ 3.3 ยท SQLite Auth State
|
|
386
|
+
|
|
210
387
|
Menyimpan data autentikasi ke dalam database SQLite. Sangat cepat, hemat memori, dan sangat disarankan untuk produksi berskala besar.
|
|
211
388
|
```js
|
|
212
389
|
import { useSqliteAuthState } from 'elynn-baileys'
|
|
@@ -218,7 +395,17 @@ async function setupAuth() {
|
|
|
218
395
|
}
|
|
219
396
|
|
|
220
397
|
```
|
|
221
|
-
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
<br>
|
|
401
|
+
|
|
402
|
+
<div align="right"><sub>ยง SECTION 04</sub></div>
|
|
403
|
+
|
|
404
|
+
## 04 โ makeInMemoryStore
|
|
405
|
+
|
|
406
|
+
<hr>
|
|
407
|
+
|
|
408
|
+
|
|
222
409
|
makeInMemoryStore adalah sistem penyimpanan data sesi dalam memori yang ditingkatkan. Menyediakan caching cerdas untuk pesan, kontak, dan metadata grup.
|
|
223
410
|
Konfigurasi dan implementasi lengkap:
|
|
224
411
|
```js
|
|
@@ -272,9 +459,21 @@ async function useStoreFeatures(sock, jid, messageId) {
|
|
|
272
459
|
}
|
|
273
460
|
|
|
274
461
|
```
|
|
275
|
-
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
<br>
|
|
465
|
+
|
|
466
|
+
<div align="right"><sub>ยง SECTION 05</sub></div>
|
|
467
|
+
|
|
468
|
+
## 05 โ Sending Messages
|
|
469
|
+
|
|
470
|
+
<hr>
|
|
471
|
+
|
|
472
|
+
|
|
276
473
|
Seksi ini memuat seluruh metode dan struktur pengiriman pesan menggunakan library ini.
|
|
277
|
-
|
|
474
|
+
|
|
475
|
+
#### โ 5.1 ยท Text Biasa
|
|
476
|
+
|
|
278
477
|
```js
|
|
279
478
|
async function sendText(sock, jid) {
|
|
280
479
|
await sock.sendMessage(jid, {
|
|
@@ -283,7 +482,9 @@ async function sendText(sock, jid) {
|
|
|
283
482
|
}
|
|
284
483
|
|
|
285
484
|
```
|
|
286
|
-
|
|
485
|
+
|
|
486
|
+
#### โ 5.2 ยท Text dengan Mention User
|
|
487
|
+
|
|
287
488
|
```js
|
|
288
489
|
async function sendMention(sock, jid) {
|
|
289
490
|
await sock.sendMessage(jid, {
|
|
@@ -293,7 +494,9 @@ async function sendMention(sock, jid) {
|
|
|
293
494
|
}
|
|
294
495
|
|
|
295
496
|
```
|
|
296
|
-
|
|
497
|
+
|
|
498
|
+
#### โ 5.3 ยท Mention All
|
|
499
|
+
|
|
297
500
|
```js
|
|
298
501
|
async function sendMentionAll(sock, jid) {
|
|
299
502
|
const meta = await sock.groupMetadata(jid)
|
|
@@ -305,7 +508,9 @@ async function sendMentionAll(sock, jid) {
|
|
|
305
508
|
}
|
|
306
509
|
|
|
307
510
|
```
|
|
308
|
-
|
|
511
|
+
|
|
512
|
+
#### โ 5.4 ยท Reply / Quote Message
|
|
513
|
+
|
|
309
514
|
```js
|
|
310
515
|
async function sendReply(sock, jid, quotedMessage) {
|
|
311
516
|
await sock.sendMessage(jid, {
|
|
@@ -315,7 +520,9 @@ async function sendReply(sock, jid, quotedMessage) {
|
|
|
315
520
|
}
|
|
316
521
|
|
|
317
522
|
```
|
|
318
|
-
|
|
523
|
+
|
|
524
|
+
#### โ 5.5 ยท Reaction
|
|
525
|
+
|
|
319
526
|
```js
|
|
320
527
|
async function sendReaction(sock, jid, messageKey) {
|
|
321
528
|
await sock.sendMessage(jid, {
|
|
@@ -327,7 +534,9 @@ async function sendReaction(sock, jid, messageKey) {
|
|
|
327
534
|
}
|
|
328
535
|
|
|
329
536
|
```
|
|
330
|
-
|
|
537
|
+
|
|
538
|
+
#### โ 5.6 ยท Image
|
|
539
|
+
|
|
331
540
|
```js
|
|
332
541
|
import fs from 'fs'
|
|
333
542
|
|
|
@@ -345,7 +554,9 @@ async function sendImages(sock, jid) {
|
|
|
345
554
|
}
|
|
346
555
|
|
|
347
556
|
```
|
|
348
|
-
|
|
557
|
+
|
|
558
|
+
#### โ 5.7 ยท Video
|
|
559
|
+
|
|
349
560
|
```js
|
|
350
561
|
async function sendVideo(sock, jid) {
|
|
351
562
|
await sock.sendMessage(jid, {
|
|
@@ -356,7 +567,9 @@ async function sendVideo(sock, jid) {
|
|
|
356
567
|
}
|
|
357
568
|
|
|
358
569
|
```
|
|
359
|
-
|
|
570
|
+
|
|
571
|
+
#### โ 5.8 ยท Audio
|
|
572
|
+
|
|
360
573
|
```js
|
|
361
574
|
async function sendAudio(sock, jid) {
|
|
362
575
|
await sock.sendMessage(jid, {
|
|
@@ -372,7 +585,9 @@ async function sendAudio(sock, jid) {
|
|
|
372
585
|
}
|
|
373
586
|
|
|
374
587
|
```
|
|
375
|
-
|
|
588
|
+
|
|
589
|
+
#### โ 5.9 ยท Document
|
|
590
|
+
|
|
376
591
|
```js
|
|
377
592
|
async function sendDocument(sock, jid) {
|
|
378
593
|
await sock.sendMessage(jid, {
|
|
@@ -384,7 +599,9 @@ async function sendDocument(sock, jid) {
|
|
|
384
599
|
}
|
|
385
600
|
|
|
386
601
|
```
|
|
387
|
-
|
|
602
|
+
|
|
603
|
+
#### โ 5.10 ยท Sticker
|
|
604
|
+
|
|
388
605
|
```js
|
|
389
606
|
import fs from 'fs'
|
|
390
607
|
|
|
@@ -396,7 +613,9 @@ async function sendSticker(sock, jid) {
|
|
|
396
613
|
}
|
|
397
614
|
|
|
398
615
|
```
|
|
399
|
-
|
|
616
|
+
|
|
617
|
+
#### โ 5.11 ยท Sticker Pack
|
|
618
|
+
|
|
400
619
|
```js
|
|
401
620
|
import fs from 'fs'
|
|
402
621
|
|
|
@@ -416,7 +635,9 @@ async function sendStickerPack(sock, jid) {
|
|
|
416
635
|
}
|
|
417
636
|
|
|
418
637
|
```
|
|
419
|
-
|
|
638
|
+
|
|
639
|
+
#### โ 5.12 ยท Contact / vCard
|
|
640
|
+
|
|
420
641
|
```js
|
|
421
642
|
async function sendContact(sock, jid) {
|
|
422
643
|
const vcardString = 'BEGIN:VCARD\nVERSION:3.0\nFN:Elynn\nTEL;type=CELL;waid=6281234567890:+62 812 3456 7890\nEND:VCARD'
|
|
@@ -432,7 +653,9 @@ async function sendContact(sock, jid) {
|
|
|
432
653
|
}
|
|
433
654
|
|
|
434
655
|
```
|
|
435
|
-
|
|
656
|
+
|
|
657
|
+
#### โ 5.13 ยท Location
|
|
658
|
+
|
|
436
659
|
```js
|
|
437
660
|
async function sendLocation(sock, jid) {
|
|
438
661
|
await sock.sendMessage(jid, {
|
|
@@ -446,24 +669,51 @@ async function sendLocation(sock, jid) {
|
|
|
446
669
|
}
|
|
447
670
|
|
|
448
671
|
```
|
|
449
|
-
|
|
672
|
+
|
|
673
|
+
#### โ 5.14 ยท Live Location
|
|
674
|
+
|
|
450
675
|
```js
|
|
676
|
+
import { generateWAMessageFromContent } from 'elynn-baileys'
|
|
677
|
+
|
|
451
678
|
async function sendLiveLocation(sock, jid) {
|
|
452
|
-
|
|
453
|
-
|
|
679
|
+
const messageContent = {
|
|
680
|
+
locationMessage: {
|
|
454
681
|
degreesLatitude: -6.2087634,
|
|
455
682
|
degreesLongitude: 106.845599,
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
683
|
+
name: 'Lokasi Terkini',
|
|
684
|
+
address: 'Berbagi Lokasi Langsung',
|
|
685
|
+
liveLocation: {
|
|
686
|
+
degreesLatitude: -6.2087634,
|
|
687
|
+
degreesLongitude: 106.845599,
|
|
688
|
+
accuracyInMeters: 10,
|
|
689
|
+
speedInMps: 0,
|
|
690
|
+
degreesClockwiseFromMagneticNorth: 0,
|
|
691
|
+
caption: 'Saya sedang membagikan lokasi langsung',
|
|
692
|
+
sequenceNumber: 1,
|
|
693
|
+
timeOffset: 3600
|
|
694
|
+
},
|
|
695
|
+
contextInfo: {
|
|
696
|
+
forwardingScore: 1,
|
|
697
|
+
isForwarded: false
|
|
698
|
+
}
|
|
461
699
|
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
const generatedMessage = await generateWAMessageFromContent(
|
|
703
|
+
jid,
|
|
704
|
+
messageContent,
|
|
705
|
+
{ userJid: sock.user.id }
|
|
706
|
+
)
|
|
707
|
+
|
|
708
|
+
await sock.relayMessage(jid, generatedMessage.message, {
|
|
709
|
+
messageId: generatedMessage.key.id
|
|
462
710
|
})
|
|
463
711
|
}
|
|
464
712
|
|
|
465
713
|
```
|
|
466
|
-
|
|
714
|
+
|
|
715
|
+
#### โ 5.15 ยท Poll
|
|
716
|
+
|
|
467
717
|
```js
|
|
468
718
|
async function sendPoll(sock, jid) {
|
|
469
719
|
await sock.sendMessage(jid, {
|
|
@@ -476,7 +726,9 @@ async function sendPoll(sock, jid) {
|
|
|
476
726
|
}
|
|
477
727
|
|
|
478
728
|
```
|
|
479
|
-
|
|
729
|
+
|
|
730
|
+
#### โ 5.16 ยท Album
|
|
731
|
+
|
|
480
732
|
```js
|
|
481
733
|
import fs from 'fs'
|
|
482
734
|
|
|
@@ -493,91 +745,157 @@ async function sendAlbum(sock, jid) {
|
|
|
493
745
|
}
|
|
494
746
|
|
|
495
747
|
```
|
|
496
|
-
|
|
748
|
+
|
|
749
|
+
#### โ 5.17 ยท Interactive โ Buttons (Native Flow)
|
|
750
|
+
|
|
497
751
|
```js
|
|
752
|
+
import { generateWAMessageFromContent } from 'elynn-baileys'
|
|
753
|
+
|
|
498
754
|
async function sendInteractiveButtons(sock, jid) {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
nativeFlowMessage: {
|
|
506
|
-
buttons: [
|
|
507
|
-
{
|
|
508
|
-
name: 'quick_reply',
|
|
509
|
-
buttonParamsJson: JSON.stringify({
|
|
510
|
-
display_text: 'โ
Konfirmasi Pesanan',
|
|
511
|
-
id: 'btn_confirm_order'
|
|
512
|
-
})
|
|
755
|
+
const messageContent = {
|
|
756
|
+
viewOnceMessage: {
|
|
757
|
+
message: {
|
|
758
|
+
interactiveMessage: {
|
|
759
|
+
header: {
|
|
760
|
+
hasMediaAttachment: false
|
|
513
761
|
},
|
|
514
|
-
{
|
|
515
|
-
|
|
516
|
-
buttonParamsJson: JSON.stringify({
|
|
517
|
-
display_text: '๐ Kunjungi Website Resmi',
|
|
518
|
-
url: 'https://example.com',
|
|
519
|
-
merchant_url: 'https://example.com'
|
|
520
|
-
})
|
|
762
|
+
body: {
|
|
763
|
+
text: 'Silakan pilih salah satu opsi di bawah ini untuk melanjutkan:'
|
|
521
764
|
},
|
|
522
|
-
{
|
|
523
|
-
|
|
524
|
-
buttonParamsJson: JSON.stringify({
|
|
525
|
-
display_text: '๐ Salin Kode Promo',
|
|
526
|
-
copy_code: 'ELYNN2026PROMO'
|
|
527
|
-
})
|
|
765
|
+
footer: {
|
|
766
|
+
text: 'elynn-baileys'
|
|
528
767
|
},
|
|
529
|
-
{
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
768
|
+
nativeFlowMessage: {
|
|
769
|
+
buttons: [
|
|
770
|
+
{
|
|
771
|
+
name: 'quick_reply',
|
|
772
|
+
buttonParamsJson: JSON.stringify({
|
|
773
|
+
display_text: 'โ
Konfirmasi Pesanan',
|
|
774
|
+
id: 'btn_confirm_order'
|
|
775
|
+
})
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
name: 'cta_url',
|
|
779
|
+
buttonParamsJson: JSON.stringify({
|
|
780
|
+
display_text: '๐ Kunjungi Website Resmi',
|
|
781
|
+
url: 'https://example.com',
|
|
782
|
+
merchant_url: 'https://example.com'
|
|
783
|
+
})
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
name: 'cta_copy',
|
|
787
|
+
buttonParamsJson: JSON.stringify({
|
|
788
|
+
display_text: '๐ Salin Kode Promo',
|
|
789
|
+
copy_code: 'ELYNN2026PROMO'
|
|
790
|
+
})
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
name: 'cta_call',
|
|
794
|
+
buttonParamsJson: JSON.stringify({
|
|
795
|
+
display_text: '๐ Hubungi Customer Service',
|
|
796
|
+
phone_number: '+6281234567890'
|
|
797
|
+
})
|
|
798
|
+
}
|
|
799
|
+
],
|
|
800
|
+
messageVersion: 1
|
|
535
801
|
}
|
|
536
|
-
|
|
802
|
+
}
|
|
537
803
|
}
|
|
538
804
|
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
const generatedMessage = await generateWAMessageFromContent(
|
|
808
|
+
jid,
|
|
809
|
+
messageContent,
|
|
810
|
+
{ userJid: sock.user.id }
|
|
811
|
+
)
|
|
812
|
+
|
|
813
|
+
await sock.relayMessage(jid, generatedMessage.message, {
|
|
814
|
+
messageId: generatedMessage.key.id
|
|
539
815
|
})
|
|
540
816
|
}
|
|
541
817
|
|
|
542
818
|
```
|
|
543
|
-
|
|
819
|
+
|
|
820
|
+
#### โ 5.18 ยท Interactive โ List
|
|
821
|
+
|
|
544
822
|
```js
|
|
823
|
+
import { generateWAMessageFromContent } from 'elynn-baileys'
|
|
824
|
+
|
|
545
825
|
async function sendInteractiveList(sock, jid) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
title: '๐ Makanan Utama',
|
|
559
|
-
rows: [
|
|
560
|
-
{ id: 'menu_nasi_goreng', title: 'Nasi Goreng Spesial', description: 'Rp 25.000 - Ekstra Telur' },
|
|
561
|
-
{ id: 'menu_mie_goreng', title: 'Mie Goreng Seafood', description: 'Rp 30.000 - Udang & Cumi' }
|
|
562
|
-
]
|
|
563
|
-
},
|
|
826
|
+
const messageContent = {
|
|
827
|
+
viewOnceMessage: {
|
|
828
|
+
message: {
|
|
829
|
+
interactiveMessage: {
|
|
830
|
+
body: {
|
|
831
|
+
text: 'Berikut adalah katalog produk kami. Silakan pilih kategori yang Anda inginkan:'
|
|
832
|
+
},
|
|
833
|
+
footer: {
|
|
834
|
+
text: 'elynn-baileys'
|
|
835
|
+
},
|
|
836
|
+
nativeFlowMessage: {
|
|
837
|
+
buttons: [
|
|
564
838
|
{
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
839
|
+
name: 'single_select',
|
|
840
|
+
buttonParamsJson: JSON.stringify({
|
|
841
|
+
title: '๐ Buka Katalog Menu',
|
|
842
|
+
sections: [
|
|
843
|
+
{
|
|
844
|
+
title: '๐ Makanan Utama',
|
|
845
|
+
rows: [
|
|
846
|
+
{
|
|
847
|
+
id: 'menu_nasi_goreng',
|
|
848
|
+
title: 'Nasi Goreng Spesial',
|
|
849
|
+
description: 'Rp 25.000 - Ekstra Telur'
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
id: 'menu_mie_goreng',
|
|
853
|
+
title: 'Mie Goreng Seafood',
|
|
854
|
+
description: 'Rp 30.000 - Udang & Cumi'
|
|
855
|
+
}
|
|
856
|
+
]
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
title: '๐ฅค Minuman Segar',
|
|
860
|
+
rows: [
|
|
861
|
+
{
|
|
862
|
+
id: 'menu_es_teh',
|
|
863
|
+
title: 'Es Teh Manis',
|
|
864
|
+
description: 'Rp 5.000 - Gula Asli'
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
id: 'menu_jus_jeruk',
|
|
868
|
+
title: 'Jus Jeruk Peras',
|
|
869
|
+
description: 'Rp 12.000 - Jeruk Murni'
|
|
870
|
+
}
|
|
871
|
+
]
|
|
872
|
+
}
|
|
873
|
+
]
|
|
874
|
+
})
|
|
570
875
|
}
|
|
571
|
-
]
|
|
572
|
-
|
|
573
|
-
|
|
876
|
+
],
|
|
877
|
+
messageVersion: 1
|
|
878
|
+
}
|
|
879
|
+
}
|
|
574
880
|
}
|
|
575
881
|
}
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
const generatedMessage = await generateWAMessageFromContent(
|
|
885
|
+
jid,
|
|
886
|
+
messageContent,
|
|
887
|
+
{ userJid: sock.user.id }
|
|
888
|
+
)
|
|
889
|
+
|
|
890
|
+
await sock.relayMessage(jid, generatedMessage.message, {
|
|
891
|
+
messageId: generatedMessage.key.id
|
|
576
892
|
})
|
|
577
893
|
}
|
|
578
894
|
|
|
579
895
|
```
|
|
580
|
-
|
|
896
|
+
|
|
897
|
+
#### โ 5.19 ยท Interactive โ Image Header
|
|
898
|
+
|
|
581
899
|
```js
|
|
582
900
|
async function sendInteractiveImageHeader(sock, jid) {
|
|
583
901
|
const imagePreparation = await sock.prepareMessage(jid, {
|
|
@@ -609,9 +927,12 @@ async function sendInteractiveImageHeader(sock, jid) {
|
|
|
609
927
|
}
|
|
610
928
|
|
|
611
929
|
```
|
|
612
|
-
### 5.20 Interactive sebagai Template
|
|
613
930
|
|
|
614
|
-
|
|
931
|
+
#### โ 5.20 ยท Interactive sebagai Template
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
> [!IMPORTANT]
|
|
935
|
+
> Opsi `interactiveAsTemplate` membungkus pesan jadi `templateMessage`, format legacy yang **tidak tampil di akun WhatsApp personal** (lihat catatan di 5.21). Hanya gunakan ini jika tujuan target adalah WhatsApp Business Cloud API resmi dengan template approved. Untuk bot/personal account biasa, kirim langsung tanpa flag `interactiveAsTemplate` (lihat 5.17).
|
|
615
936
|
|
|
616
937
|
```js
|
|
617
938
|
async function sendInteractiveAsTemplate(sock, jid) {
|
|
@@ -637,9 +958,12 @@ async function sendInteractiveAsTemplate(sock, jid) {
|
|
|
637
958
|
}
|
|
638
959
|
|
|
639
960
|
```
|
|
640
|
-
### 5.21 Hydrated Template Button
|
|
641
961
|
|
|
642
|
-
|
|
962
|
+
#### โ 5.21 ยท Hydrated Template Button
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
> [!WARNING]
|
|
966
|
+
> **PENTING โ `templateMessage`/`buttonsMessage` (legacy) SUDAH TIDAK WORK di akun WhatsApp personal.** Berdasarkan dokumentasi resmi WhatsApp (developers.facebook.com), button & template format lama ini hanya didukung lewat **WhatsApp Business Cloud API** dengan template yang sudah di-approve Meta โ bukan lewat koneksi personal/MD seperti Baileys. Mengirim `templateMessage` mentah dari akun biasa akan terkirim tapi **buttonnya tidak muncul / pesan tidak tampil** di sisi penerima (silent fail). Gunakan **5.17 Native Flow** sebagai gantinya โ itu yang dipakai WA app resmi sekarang untuk personal account.
|
|
643
967
|
|
|
644
968
|
Helper `templateButtons` di bawah ini tetap disediakan untuk kompatibilitas kode lama, tapi secara internal **otomatis di-convert** memakai struktur yang sama dengan native flow agar tetap bisa tampil:
|
|
645
969
|
|
|
@@ -675,7 +999,9 @@ async function sendHydratedTemplate(sock, jid) {
|
|
|
675
999
|
}
|
|
676
1000
|
|
|
677
1001
|
```
|
|
678
|
-
|
|
1002
|
+
|
|
1003
|
+
#### โ 5.22 ยท View Once
|
|
1004
|
+
|
|
679
1005
|
```js
|
|
680
1006
|
async function sendViewOnce(sock, jid) {
|
|
681
1007
|
await sock.sendMessage(jid, {
|
|
@@ -691,7 +1017,9 @@ async function sendViewOnce(sock, jid) {
|
|
|
691
1017
|
}
|
|
692
1018
|
|
|
693
1019
|
```
|
|
694
|
-
|
|
1020
|
+
|
|
1021
|
+
#### โ 5.23 ยท Ephemeral
|
|
1022
|
+
|
|
695
1023
|
```js
|
|
696
1024
|
async function sendEphemeral(sock, jid) {
|
|
697
1025
|
await sock.sendMessage(jid, {
|
|
@@ -703,7 +1031,9 @@ async function sendEphemeral(sock, jid) {
|
|
|
703
1031
|
}
|
|
704
1032
|
|
|
705
1033
|
```
|
|
706
|
-
|
|
1034
|
+
|
|
1035
|
+
#### โ 5.24 ยท Spoiler
|
|
1036
|
+
|
|
707
1037
|
```js
|
|
708
1038
|
async function sendSpoiler(sock, jid) {
|
|
709
1039
|
await sock.sendMessage(jid, {
|
|
@@ -714,7 +1044,9 @@ async function sendSpoiler(sock, jid) {
|
|
|
714
1044
|
}
|
|
715
1045
|
|
|
716
1046
|
```
|
|
717
|
-
|
|
1047
|
+
|
|
1048
|
+
#### โ 5.25 ยท Group Status
|
|
1049
|
+
|
|
718
1050
|
```js
|
|
719
1051
|
async function sendGroupStatus(sock, jid) {
|
|
720
1052
|
await sock.sendMessage(jid, {
|
|
@@ -724,11 +1056,15 @@ async function sendGroupStatus(sock, jid) {
|
|
|
724
1056
|
}
|
|
725
1057
|
|
|
726
1058
|
```
|
|
727
|
-
### 5.26 External Ad Reply
|
|
728
1059
|
|
|
729
|
-
|
|
1060
|
+
#### โ 5.26 ยท External Ad Reply
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
> [!IMPORTANT]
|
|
1064
|
+
> **Catatan penting:** `externalAdReply` di shorthand `sock.sendMessage()` butuh field `url` (string, dipakai untuk `mediaUrl`/`sourceUrl`/`thumbnailUrl` sekaligus) dan `thumbnail` (Buffer JPEG, bukan `thumbnailUrl` string) โ bukan `thumbnailUrl`/`sourceUrl` terpisah. Tanpa `thumbnail` (Buffer), preview card sering tidak muncul karena WA app butuh gambar sudah ter-embed, tidak bisa fetch dari URL eksternal saat render. Sertakan juga `forwardingScore` + `isForwarded: true` โ pola ini paling konsisten membuat card-nya muncul.
|
|
730
1065
|
>
|
|
731
|
-
>
|
|
1066
|
+
> [!WARNING]
|
|
1067
|
+
> **Limitasi yang tidak bisa diperbaiki dari sisi kode:** `externalAdReply` murni metadata dekorasi di `contextInfo`, bukan tipe pesan sendiri โ apakah card-nya dirender atau tidak itu **keputusan WhatsApp app di sisi penerima**, tergantung platform (Android/iOS) dan versi app. Ini dikonfirmasi sebagai known issue di banyak fork Baileys (lihat issue [#51](https://github.com/WhiskeySockets/Baileys/issues/51) dan [#75](https://github.com/WhiskeySockets/Baileys/issues/75) di repo WhiskeySockets/Baileys). Gejala umum: pengirim/linked-device sendiri melihat card lengkap (karena disinkron via WA Web/Desktop yang versinya lebih baru), tapi penerima dengan WA app versi/platform berbeda **hanya melihat teks biasa tanpa card**. Tidak ada konfigurasi proto yang menjamin tampil 100% di semua device โ anggap fitur ini sebagai *progressive enhancement*, bukan sesuatu yang reliable untuk dipakai sebagai fitur utama bot.
|
|
732
1068
|
|
|
733
1069
|
```js
|
|
734
1070
|
import fs from 'fs'
|
|
@@ -773,7 +1109,9 @@ async function sendExternalAdReplyRaw(sock, jid) {
|
|
|
773
1109
|
}
|
|
774
1110
|
|
|
775
1111
|
```
|
|
776
|
-
|
|
1112
|
+
|
|
1113
|
+
#### โ 5.27 ยท Forward Pesan
|
|
1114
|
+
|
|
777
1115
|
```js
|
|
778
1116
|
async function sendForwardMessage(sock, jid, messageToForward) {
|
|
779
1117
|
await sock.sendMessage(jid, {
|
|
@@ -782,7 +1120,9 @@ async function sendForwardMessage(sock, jid, messageToForward) {
|
|
|
782
1120
|
}
|
|
783
1121
|
|
|
784
1122
|
```
|
|
785
|
-
|
|
1123
|
+
|
|
1124
|
+
#### โ 5.28 ยท Pin Pesan
|
|
1125
|
+
|
|
786
1126
|
```js
|
|
787
1127
|
async function pinMessageInChat(sock, jid, messageKey) {
|
|
788
1128
|
await sock.sendMessage(jid, {
|
|
@@ -794,7 +1134,9 @@ async function pinMessageInChat(sock, jid, messageKey) {
|
|
|
794
1134
|
}
|
|
795
1135
|
|
|
796
1136
|
```
|
|
797
|
-
|
|
1137
|
+
|
|
1138
|
+
#### โ 5.29 ยท Raw Message
|
|
1139
|
+
|
|
798
1140
|
```js
|
|
799
1141
|
async function sendRawProtoMessage(sock, jid) {
|
|
800
1142
|
await sock.sendMessage(jid, {
|
|
@@ -804,7 +1146,9 @@ async function sendRawProtoMessage(sock, jid) {
|
|
|
804
1146
|
}
|
|
805
1147
|
|
|
806
1148
|
```
|
|
807
|
-
|
|
1149
|
+
|
|
1150
|
+
#### โ 5.30 ยท Group Invite Link
|
|
1151
|
+
|
|
808
1152
|
```js
|
|
809
1153
|
async function sendGroupInvite(sock, jid) {
|
|
810
1154
|
const currentTime = Math.round(new Date().getTime() / 1000)
|
|
@@ -822,7 +1166,9 @@ async function sendGroupInvite(sock, jid) {
|
|
|
822
1166
|
}
|
|
823
1167
|
|
|
824
1168
|
```
|
|
825
|
-
|
|
1169
|
+
|
|
1170
|
+
#### โ 5.31 ยท Event dengan Reminder (fitur WA Januari 2026)
|
|
1171
|
+
|
|
826
1172
|
WhatsApp resmi menambahkan "Event Reminders" pada update grup chat 7 Januari 2026 โ pembuat event kini bisa menyetel pengingat otomatis untuk semua undangan sebelum acara dimulai. Cukup tambahkan `reminderOffsetSec` (dalam detik) ke object `event` yang sudah ada di elynn-baileys.
|
|
827
1173
|
```js
|
|
828
1174
|
async function sendEventWithReminder(sock, jid) {
|
|
@@ -832,16 +1178,23 @@ async function sendEventWithReminder(sock, jid) {
|
|
|
832
1178
|
description: 'Kumpul bareng nonton final di basecamp ya, jangan telat!',
|
|
833
1179
|
startDate: new Date('2026-08-01T20:00:00+07:00'),
|
|
834
1180
|
endDate: new Date('2026-08-01T23:00:00+07:00'),
|
|
835
|
-
location:
|
|
1181
|
+
location: {
|
|
1182
|
+
degreesLatitude: -7.983908,
|
|
1183
|
+
degreesLongitude: 112.621391,
|
|
1184
|
+
name: 'Basecamp Komunitas, Jl. Mawar No. 5'
|
|
1185
|
+
},
|
|
836
1186
|
extraGuestsAllowed: true,
|
|
837
|
-
reminderOffsetSec: 3600
|
|
1187
|
+
reminderOffsetSec: 3600
|
|
838
1188
|
}
|
|
839
1189
|
})
|
|
840
1190
|
}
|
|
841
1191
|
|
|
842
1192
|
```
|
|
1193
|
+
> [!NOTE]
|
|
843
1194
|
> Catatan: jika `reminderOffsetSec` diisi, elynn-baileys otomatis menyetel `hasReminder: true` pada `eventMessage`. Tanpa parameter ini, event tetap terkirim normal tanpa pengingat โ perilaku ini sepenuhnya backward-compatible dengan kode event lama Anda.
|
|
844
|
-
|
|
1195
|
+
|
|
1196
|
+
#### โ 5.32 ยท Text Sticker (fitur WA Januari 2026)
|
|
1197
|
+
|
|
845
1198
|
WhatsApp juga merilis "Text Stickers" pada update yang sama โ mengubah kata apa pun menjadi stiker hanya dengan mengetik di Sticker Search. Karena fitur aslinya murni rendering sisi klien (tanpa endpoint protokol khusus), elynn-baileys menyediakan generator `renderTextSticker()` bawaan yang merender teks menjadi stiker WebP secara lokal (memakai `canvas` + `sharp`/`@napi-rs/image`, tanpa API pihak ketiga) lalu langsung bisa dikirim seperti stiker biasa.
|
|
846
1199
|
```js
|
|
847
1200
|
import { renderTextSticker } from 'elynn-baileys'
|
|
@@ -859,11 +1212,14 @@ async function sendTextSticker(sock, jid) {
|
|
|
859
1212
|
}
|
|
860
1213
|
|
|
861
1214
|
```
|
|
1215
|
+
> [!NOTE]
|
|
862
1216
|
> Beda dengan plugin `attp`/`ttp` (Bab 11) yang memanggil API eksternal untuk efek teks bergerak/glow, `renderTextSticker` murni lokal โ tidak butuh koneksi internet maupun API key, cocok untuk stiker teks polos yang cepat dan privat.
|
|
863
1217
|
|
|
864
1218
|
---
|
|
865
1219
|
|
|
866
|
-
|
|
1220
|
+
|
|
1221
|
+
#### โ 5.33 ยท View-Once Text โ Teks Sekali Lihat (WA 2026)
|
|
1222
|
+
|
|
867
1223
|
|
|
868
1224
|
Pertengahan 2026, WhatsApp merilis kemampuan mengirim **teks murni** sebagai view-once: pesan hanya bisa dibaca satu kali, setelah itu otomatis dihapus. Penerima tidak bisa menyalin, meneruskan, atau merekam layarnya. Di Baileys, ini bekerja dengan membungkus `extendedTextMessage` ke dalam `viewOnceMessageV2` via `generateWAMessageFromContent`.
|
|
869
1225
|
|
|
@@ -894,11 +1250,14 @@ async function sendViewOnceText(sock, jid) {
|
|
|
894
1250
|
}
|
|
895
1251
|
```
|
|
896
1252
|
|
|
1253
|
+
> [!NOTE]
|
|
897
1254
|
> **Catatan:** Pastikan WA penerima sudah versi yang mendukung view-once teks (2025.8+). Pada versi lebih lama pesan akan tampil sebagai teks biasa.
|
|
898
1255
|
|
|
899
1256
|
---
|
|
900
1257
|
|
|
901
|
-
|
|
1258
|
+
|
|
1259
|
+
#### โ 5.34 ยท View-Once Voice Note โ Audio Sekali Dengar (WA 2026)
|
|
1260
|
+
|
|
902
1261
|
|
|
903
1262
|
Voice note (PTT) kini resmi bisa dikirim sebagai view-once: audio hanya bisa diputar satu kali lalu hilang. Cocok untuk kirim kode OTP audio atau pesan suara rahasia.
|
|
904
1263
|
|
|
@@ -923,16 +1282,23 @@ async function sendViewOnceVoice(sock, jid) {
|
|
|
923
1282
|
}
|
|
924
1283
|
```
|
|
925
1284
|
|
|
1285
|
+
> [!NOTE]
|
|
926
1286
|
> **Catatan:** `ptt: true` wajib ada โ tanpa itu audio dikirim sebagai musik biasa dan flag `viewOnce` tidak akan aktif dengan benar.
|
|
927
1287
|
|
|
928
1288
|
---
|
|
929
1289
|
|
|
930
|
-
|
|
1290
|
+
|
|
1291
|
+
#### โ 5.35 ยท Community Event โ RSVP & Virtual Meeting Call (WA 2026)
|
|
1292
|
+
|
|
931
1293
|
|
|
932
1294
|
WhatsApp 2026 memperluas fitur event di **Community** dengan dukungan RSVP tracking dan link virtual meeting langsung di dalam pesan event. Berbeda dari 5.31 (event grup biasa dengan reminder), fitur ini spesifik untuk:
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1295
|
+
|
|
1296
|
+
| Kapabilitas | Penjelasan |
|
|
1297
|
+
|:---|:---|
|
|
1298
|
+
| **Virtual call** | Audio/video link tertanam langsung di pesan event |
|
|
1299
|
+
| **RSVP** | Bot mendeteksi siapa yang menerima/menolak via `messages.upsert` bertipe `eventResponseMessage` |
|
|
1300
|
+
| **extraGuestsAllowed** | Anggota grup bisa mengajak tamu di luar grup ke event |
|
|
1301
|
+
|
|
936
1302
|
|
|
937
1303
|
```js
|
|
938
1304
|
// Kirim event virtual meeting di community/grup
|
|
@@ -972,11 +1338,14 @@ sock.ev.on('messages.upsert', ({ messages }) => {
|
|
|
972
1338
|
})
|
|
973
1339
|
```
|
|
974
1340
|
|
|
1341
|
+
> [!NOTE]
|
|
975
1342
|
> **Perbedaan dari 5.31:** Section 5.31 fokus pada event grup biasa dengan `reminderOffsetSec` (pengingat waktu). Section ini fokus pada **virtual meeting** + **RSVP response handling** โ dua kemampuan berbeda yang hadir bersamaan di WA 2026.
|
|
976
1343
|
|
|
977
1344
|
---
|
|
978
1345
|
|
|
979
|
-
|
|
1346
|
+
|
|
1347
|
+
#### โ 5.36 ยท Group Message History Share (WA 2026)
|
|
1348
|
+
|
|
980
1349
|
|
|
981
1350
|
WhatsApp merilis fitur ini Februari 2026: saat member baru ditambahkan, admin/member bisa membagikan 25โ100 pesan terakhir ke member tersebut lewat prompt di UI client resmi. Fitur ini murni **client-side** (ditangani oleh aplikasi WA, bukan dikirim sebagai pesan protokol terpisah) dan field internalnya (`GroupHistoryBundleInfo`) ditandai `deprecated` di proto WA sendiri โ sehingga **belum ada endpoint resmi** untuk men-trigger ini lewat Baileys/elynn-baileys.
|
|
982
1351
|
|
|
@@ -1002,11 +1371,14 @@ async function shareRecentMessagesManually(sock, groupJid, newMemberJid, message
|
|
|
1002
1371
|
}
|
|
1003
1372
|
```
|
|
1004
1373
|
|
|
1374
|
+
> [!NOTE]
|
|
1005
1375
|
> **Catatan:** Belum ada method native (`groupToggleMessageHistory` dkk **tidak exist**) karena WA belum membuka protokol publik untuk fitur ini. Jangan gunakan nama method yang belum ada di lib โ cek dulu dengan `console.log(Object.keys(sock))` untuk daftar method yang benar-benar tersedia.
|
|
1006
1376
|
|
|
1007
1377
|
---
|
|
1008
1378
|
|
|
1009
|
-
|
|
1379
|
+
|
|
1380
|
+
#### โ 5.37 ยท Channel Poll โ Polling di Saluran/Channel (WA 2026)
|
|
1381
|
+
|
|
1010
1382
|
|
|
1011
1383
|
WhatsApp Channels kini mendukung pembuatan polling โ fitur interaksi satu arah berskala besar langsung di saluran. Gunakan `toAnnouncementGroup: true` agar poll terkirim ke channel/saluran (newsletter JID).
|
|
1012
1384
|
|
|
@@ -1053,7 +1425,9 @@ sock.ev.on('messages.upsert', ({ messages }) => {
|
|
|
1053
1425
|
|
|
1054
1426
|
---
|
|
1055
1427
|
|
|
1056
|
-
|
|
1428
|
+
|
|
1429
|
+
#### โ 5.38 ยท Channel Voice Note (WA 2026)
|
|
1430
|
+
|
|
1057
1431
|
|
|
1058
1432
|
WhatsApp Channels kini mendukung pengiriman voice note โ memungkinkan kreator saluran berinteraksi lebih personal dengan subscriber via audio langsung di channel.
|
|
1059
1433
|
|
|
@@ -1076,13 +1450,25 @@ async function sendChannelVoiceNote(sock, channelJid) {
|
|
|
1076
1450
|
}
|
|
1077
1451
|
```
|
|
1078
1452
|
|
|
1453
|
+
> [!NOTE]
|
|
1079
1454
|
> **Catatan:** Newsletter JID bisa didapat dari `sock.newsletterSubscribers(channelJid)`, `sock.newsletterFetchMessages(...)`, atau dari metadata channel yang sudah kamu follow saat event `messaging-history.set`.
|
|
1080
1455
|
|
|
1081
1456
|
---
|
|
1082
1457
|
|
|
1083
|
-
|
|
1458
|
+
|
|
1459
|
+
<br>
|
|
1460
|
+
|
|
1461
|
+
<div align="right"><sub>ยง SECTION 06</sub></div>
|
|
1462
|
+
|
|
1463
|
+
## 06 โ Rich Response Messages
|
|
1464
|
+
|
|
1465
|
+
<hr>
|
|
1466
|
+
|
|
1467
|
+
|
|
1084
1468
|
Fitur ini secara eksklusif memungkinkan Anda mengirim struktur data yang lebih kompleks menyerupai antarmuka dari bot AI resmi WhatsApp.
|
|
1085
|
-
|
|
1469
|
+
|
|
1470
|
+
#### โ 6.1 ยท Text Rich
|
|
1471
|
+
|
|
1086
1472
|
```js
|
|
1087
1473
|
import { prepareRichResponseMessage } from 'elynn-baileys'
|
|
1088
1474
|
|
|
@@ -1095,7 +1481,9 @@ async function sendRichText(sock, jid) {
|
|
|
1095
1481
|
}
|
|
1096
1482
|
|
|
1097
1483
|
```
|
|
1098
|
-
|
|
1484
|
+
|
|
1485
|
+
#### โ 6.2 ยท Code Block
|
|
1486
|
+
|
|
1099
1487
|
```js
|
|
1100
1488
|
import { prepareRichResponseMessage } from 'elynn-baileys'
|
|
1101
1489
|
|
|
@@ -1112,7 +1500,9 @@ async function sendRichCode(sock, jid) {
|
|
|
1112
1500
|
}
|
|
1113
1501
|
|
|
1114
1502
|
```
|
|
1115
|
-
|
|
1503
|
+
|
|
1504
|
+
#### โ 6.3 ยท Table
|
|
1505
|
+
|
|
1116
1506
|
```js
|
|
1117
1507
|
import { prepareRichResponseMessage } from 'elynn-baileys'
|
|
1118
1508
|
|
|
@@ -1136,7 +1526,9 @@ async function sendRichTable(sock, jid) {
|
|
|
1136
1526
|
}
|
|
1137
1527
|
|
|
1138
1528
|
```
|
|
1139
|
-
|
|
1529
|
+
|
|
1530
|
+
#### โ 6.4 ยท Inline Image
|
|
1531
|
+
|
|
1140
1532
|
```js
|
|
1141
1533
|
import { prepareRichResponseMessage } from 'elynn-baileys'
|
|
1142
1534
|
|
|
@@ -1152,7 +1544,9 @@ async function sendRichInlineImage(sock, jid) {
|
|
|
1152
1544
|
}
|
|
1153
1545
|
|
|
1154
1546
|
```
|
|
1155
|
-
|
|
1547
|
+
|
|
1548
|
+
#### โ 6.5 ยท Inline Link / Citation
|
|
1549
|
+
|
|
1156
1550
|
```js
|
|
1157
1551
|
import { prepareRichResponseMessage } from 'elynn-baileys'
|
|
1158
1552
|
|
|
@@ -1175,7 +1569,9 @@ async function sendRichCitation(sock, jid) {
|
|
|
1175
1569
|
}
|
|
1176
1570
|
|
|
1177
1571
|
```
|
|
1178
|
-
|
|
1572
|
+
|
|
1573
|
+
#### โ 6.6 ยท Rich Response Kombinasi
|
|
1574
|
+
|
|
1179
1575
|
```js
|
|
1180
1576
|
import { prepareRichResponseMessage } from 'elynn-baileys'
|
|
1181
1577
|
|
|
@@ -1200,7 +1596,17 @@ async function sendComplexRichResponse(sock, jid) {
|
|
|
1200
1596
|
}
|
|
1201
1597
|
|
|
1202
1598
|
```
|
|
1203
|
-
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
<br>
|
|
1602
|
+
|
|
1603
|
+
<div align="right"><sub>ยง SECTION 07</sub></div>
|
|
1604
|
+
|
|
1605
|
+
## 07 โ Group Management
|
|
1606
|
+
|
|
1607
|
+
<hr>
|
|
1608
|
+
|
|
1609
|
+
|
|
1204
1610
|
API yang ekstensif untuk memanipulasi dan mengelola data serta operasional grup secara menyeluruh.
|
|
1205
1611
|
```js
|
|
1206
1612
|
async function manageGroup(sock, jid) {
|
|
@@ -1240,7 +1646,17 @@ async function manageGroup(sock, jid) {
|
|
|
1240
1646
|
}
|
|
1241
1647
|
|
|
1242
1648
|
```
|
|
1243
|
-
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
<br>
|
|
1652
|
+
|
|
1653
|
+
<div align="right"><sub>ยง SECTION 08</sub></div>
|
|
1654
|
+
|
|
1655
|
+
## 08 โ Newsletter / Channel
|
|
1656
|
+
|
|
1657
|
+
<hr>
|
|
1658
|
+
|
|
1659
|
+
|
|
1244
1660
|
Fungsionalitas penuh untuk memoderasi saluran informasi siaran satu arah (Channel WhatsApp).
|
|
1245
1661
|
```js
|
|
1246
1662
|
async function manageNewsletter(sock) {
|
|
@@ -1273,7 +1689,17 @@ async function manageNewsletter(sock) {
|
|
|
1273
1689
|
}
|
|
1274
1690
|
|
|
1275
1691
|
```
|
|
1276
|
-
|
|
1692
|
+
|
|
1693
|
+
|
|
1694
|
+
<br>
|
|
1695
|
+
|
|
1696
|
+
<div align="right"><sub>ยง SECTION 09</sub></div>
|
|
1697
|
+
|
|
1698
|
+
## 09 โ Privacy & Profile
|
|
1699
|
+
|
|
1700
|
+
<hr>
|
|
1701
|
+
|
|
1702
|
+
|
|
1277
1703
|
Pengaturan terkait profil pribadi pengguna dan konfigurasi privasi keamanan akun.
|
|
1278
1704
|
```js
|
|
1279
1705
|
async function updateProfileAndPrivacy(sock) {
|
|
@@ -1311,7 +1737,17 @@ async function updateProfileAndPrivacy(sock) {
|
|
|
1311
1737
|
}
|
|
1312
1738
|
|
|
1313
1739
|
```
|
|
1314
|
-
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
<br>
|
|
1743
|
+
|
|
1744
|
+
<div align="right"><sub>ยง SECTION 10</sub></div>
|
|
1745
|
+
|
|
1746
|
+
## 10 โ Handling Events
|
|
1747
|
+
|
|
1748
|
+
<hr>
|
|
1749
|
+
|
|
1750
|
+
|
|
1315
1751
|
Cara komprehensif untuk mendaftarkan pendengar acara ke seluruh aktivitas yang terjadi di jaringan.
|
|
1316
1752
|
```js
|
|
1317
1753
|
function setupEventHandlers(sock, saveCreds) {
|
|
@@ -1399,14 +1835,23 @@ function setupEventHandlers(sock, saveCreds) {
|
|
|
1399
1835
|
}
|
|
1400
1836
|
|
|
1401
1837
|
```
|
|
1402
|
-
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
<br>
|
|
1841
|
+
|
|
1842
|
+
<div align="right"><sub>ยง SECTION 11</sub></div>
|
|
1843
|
+
|
|
1844
|
+
## 11 โ Elynn Plugins : Brat & Bratvid
|
|
1845
|
+
|
|
1846
|
+
<hr>
|
|
1847
|
+
|
|
1403
1848
|
|
|
1404
1849
|
elynn-baileys menyertakan **30+ plugin bawaan** siap pakai mencakup AI, berita, downloader, search, stalk, info, dan maker. Plugin dapat diimport langsung atau diakses via objek `plugins`. Output tiap plugin mengikuti format `{ ok, type, result }` โ langsung bisa dipakai di `sendMessage`.
|
|
1405
1850
|
|
|
1406
|
-
| Key
|
|
1407
|
-
|
|
1408
|
-
| `brat`
|
|
1409
|
-
| `bratvid` | GET
|
|
1851
|
+
| Key | Method | Endpoint | Output | Parameter |
|
|
1852
|
+
|:---|:---:|:---|:---:|:---|
|
|
1853
|
+
| `brat` | `GET` | `/api/maker/brat` | Sticker ยท img | `text` `string` |
|
|
1854
|
+
| `bratvid` | `GET` | `/api/maker/bratvid` | Sticker ยท vid | `text` `string` |
|
|
1410
1855
|
|
|
1411
1856
|
```js
|
|
1412
1857
|
import { plugins, listPlugins } from 'elynn-baileys'
|
|
@@ -1464,9 +1909,19 @@ sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
|
1464
1909
|
})
|
|
1465
1910
|
```
|
|
1466
1911
|
|
|
1912
|
+
> [!NOTE]
|
|
1467
1913
|
> Plugin Brat & Bratvid selalu mengembalikan `{ ok: boolean, type: 'sticker', result: string }` di mana `result` adalah URL gambar/video yang bisa langsung dipakai di `sendMessage`. Tidak ada API key tambahan yang diperlukan โ sudah ter-bundle di dalam library.
|
|
1468
1914
|
|
|
1469
|
-
|
|
1915
|
+
|
|
1916
|
+
<br>
|
|
1917
|
+
|
|
1918
|
+
<div align="right"><sub>ยง SECTION 12</sub></div>
|
|
1919
|
+
|
|
1920
|
+
## 12 โ Read Messages & Presence
|
|
1921
|
+
|
|
1922
|
+
<hr>
|
|
1923
|
+
|
|
1924
|
+
|
|
1470
1925
|
Kendali mutlak atas indikator pesan dibaca dan pelaporan presensi sesi secara waktu nyata.
|
|
1471
1926
|
```js
|
|
1472
1927
|
async function markMessagesAsRead(sock, kunciPesanTunggal, arrayKunciPesan) {
|
|
@@ -1480,7 +1935,17 @@ async function markMessagesAsRead(sock, kunciPesanTunggal, arrayKunciPesan) {
|
|
|
1480
1935
|
}
|
|
1481
1936
|
|
|
1482
1937
|
```
|
|
1483
|
-
|
|
1938
|
+
|
|
1939
|
+
|
|
1940
|
+
<br>
|
|
1941
|
+
|
|
1942
|
+
<div align="right"><sub>ยง SECTION 13</sub></div>
|
|
1943
|
+
|
|
1944
|
+
## 13 โ Delete / Edit Pesan
|
|
1945
|
+
|
|
1946
|
+
<hr>
|
|
1947
|
+
|
|
1948
|
+
|
|
1484
1949
|
Mekanisme pasca-pengiriman yang memungkinkan Anda menarik kembali atau merevisi pesan yang telah telanjur terkirim ke server tujuan.
|
|
1485
1950
|
```js
|
|
1486
1951
|
async function modifySentMessages(sock, jid, kunciPesanTerkirim) {
|
|
@@ -1495,7 +1960,17 @@ async function modifySentMessages(sock, jid, kunciPesanTerkirim) {
|
|
|
1495
1960
|
}
|
|
1496
1961
|
|
|
1497
1962
|
```
|
|
1498
|
-
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
<br>
|
|
1966
|
+
|
|
1967
|
+
<div align="right"><sub>ยง SECTION 14</sub></div>
|
|
1968
|
+
|
|
1969
|
+
## 14 โ Message Options Tambahan
|
|
1970
|
+
|
|
1971
|
+
<hr>
|
|
1972
|
+
|
|
1973
|
+
|
|
1499
1974
|
Modifikasi perilaku tambahan untuk pesan agar sesuai dengan spesifikasi kasus penggunaan tingkat lanjut.
|
|
1500
1975
|
```js
|
|
1501
1976
|
import { prepareDisappearingMessageSettingContent } from 'elynn-baileys'
|
|
@@ -1529,7 +2004,17 @@ async function applyAdvancedMessageOptions(sock, jid, dataPesanKutipan) {
|
|
|
1529
2004
|
}
|
|
1530
2005
|
|
|
1531
2006
|
```
|
|
1532
|
-
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
<br>
|
|
2010
|
+
|
|
2011
|
+
<div align="right"><sub>ยง SECTION 15</sub></div>
|
|
2012
|
+
|
|
2013
|
+
## 15 โ Browser Fingerprint (Kiwi, UC Browser, dll)
|
|
2014
|
+
|
|
2015
|
+
<hr>
|
|
2016
|
+
|
|
2017
|
+
|
|
1533
2018
|
Saat membuka koneksi dengan `makeWASocket`, properti `browser` menentukan perangkat & browser apa yang "terlihat" oleh WhatsApp sebagai linked device Anda. elynn-baileys menyediakan helper `Browsers` berisi preset fingerprint siap pakai โ termasuk Kiwi Browser dan UC Browser โ supaya Anda tidak perlu menulis array `[OS, Browser, Version]` secara manual.
|
|
1534
2019
|
```js
|
|
1535
2020
|
import { Browsers } from 'elynn-baileys'
|
|
@@ -1557,10 +2042,23 @@ const sock = makeWASocket({
|
|
|
1557
2042
|
})
|
|
1558
2043
|
|
|
1559
2044
|
```
|
|
2045
|
+
> [!NOTE]
|
|
1560
2046
|
> Catatan: fingerprint browser ini hanya memengaruhi bagaimana sesi tampil di daftar "Linked Devices" pada WhatsApp pengguna, dan tidak mengubah perilaku jaringan atau protokol koneksi itu sendiri.
|
|
1561
|
-
|
|
2047
|
+
|
|
2048
|
+
|
|
2049
|
+
<br>
|
|
2050
|
+
|
|
2051
|
+
<div align="right"><sub>ยง SECTION 16</sub></div>
|
|
2052
|
+
|
|
2053
|
+
## 16 โ Telegram Bot (ElynnTelegraf)
|
|
2054
|
+
|
|
2055
|
+
<hr>
|
|
2056
|
+
|
|
2057
|
+
|
|
1562
2058
|
Selain WhatsApp, elynn-baileys juga membungkus engine Telegraf secara penuh dengan nama `ElynnTelegraf`. Artinya Anda bisa membangun bot Telegram lengkap โ command, inline keyboard, scenes/wizard, session, hingga webhook โ tanpa perlu menginstal package `telegraf` terpisah.
|
|
1563
|
-
|
|
2059
|
+
|
|
2060
|
+
#### โ 16.1 ยท Setup Dasar & Long Polling
|
|
2061
|
+
|
|
1564
2062
|
```js
|
|
1565
2063
|
import { ElynnTelegraf } from 'elynn-baileys'
|
|
1566
2064
|
|
|
@@ -1586,7 +2084,9 @@ process.once('SIGINT', () => bot.stop('SIGINT'))
|
|
|
1586
2084
|
process.once('SIGTERM', () => bot.stop('SIGTERM'))
|
|
1587
2085
|
|
|
1588
2086
|
```
|
|
1589
|
-
|
|
2087
|
+
|
|
2088
|
+
#### โ 16.2 ยท Setup via Webhook
|
|
2089
|
+
|
|
1590
2090
|
Cocok untuk deployment di platform serverless seperti Vercel atau VPS dengan domain HTTPS aktif.
|
|
1591
2091
|
```js
|
|
1592
2092
|
import { ElynnTelegraf } from 'elynn-baileys'
|
|
@@ -1604,7 +2104,9 @@ await bot.launch({
|
|
|
1604
2104
|
})
|
|
1605
2105
|
|
|
1606
2106
|
```
|
|
1607
|
-
|
|
2107
|
+
|
|
2108
|
+
#### โ 16.3 ยท Inline Keyboard & Reply Keyboard
|
|
2109
|
+
|
|
1608
2110
|
```js
|
|
1609
2111
|
import { ElynnTelegraf, TelegramMarkup as Markup } from 'elynn-baileys'
|
|
1610
2112
|
|
|
@@ -1628,7 +2130,9 @@ bot.action('menu_dl', (ctx) => {
|
|
|
1628
2130
|
})
|
|
1629
2131
|
|
|
1630
2132
|
```
|
|
1631
|
-
|
|
2133
|
+
|
|
2134
|
+
#### โ 16.4 ยท Session, Scenes & Wizard
|
|
2135
|
+
|
|
1632
2136
|
Untuk membangun percakapan bertahap (misalnya alur registrasi atau form multi-langkah), gunakan `telegramSession` bersama `TelegramScenes`.
|
|
1633
2137
|
```js
|
|
1634
2138
|
import { ElynnTelegraf, telegramSession, TelegramScenes } from 'elynn-baileys'
|
|
@@ -1661,7 +2165,9 @@ bot.command('daftar', (ctx) => ctx.scene.enter('register-wizard'))
|
|
|
1661
2165
|
bot.launch()
|
|
1662
2166
|
|
|
1663
2167
|
```
|
|
1664
|
-
|
|
2168
|
+
|
|
2169
|
+
#### โ 16.5 ยท Memanggil Elynn Plugins (Brat/Bratvid) dari Bot Telegram
|
|
2170
|
+
|
|
1665
2171
|
Karena `plugins` adalah objek universal yang sama dipakai di sisi WhatsApp, Anda bisa memanggil fungsi AI/downloader/tools yang identik di dalam bot Telegram.
|
|
1666
2172
|
```js
|
|
1667
2173
|
import { ElynnTelegraf, plugins } from 'elynn-baileys'
|
|
@@ -1688,7 +2194,9 @@ bot.command('tiktok', async (ctx) => {
|
|
|
1688
2194
|
bot.launch()
|
|
1689
2195
|
|
|
1690
2196
|
```
|
|
1691
|
-
|
|
2197
|
+
|
|
2198
|
+
#### โ 16.6 ยท Cek Koneksi Bot dengan `connectTelegram`
|
|
2199
|
+
|
|
1692
2200
|
Helper bawaan untuk memvalidasi token bot secara cepat tanpa harus memulai polling/webhook penuh โ cocok dipakai saat startup aplikasi untuk logging status.
|
|
1693
2201
|
```js
|
|
1694
2202
|
import { connectTelegram } from 'elynn-baileys'
|
|
@@ -1700,7 +2208,9 @@ if (botInfo) {
|
|
|
1700
2208
|
|
|
1701
2209
|
```
|
|
1702
2210
|
|
|
1703
|
-
|
|
2211
|
+
|
|
2212
|
+
#### โ 16.7 ยท Bot API 9.3โ9.4 โ sendMessageDraft, Profile Photo Bot, Button Style & Icon
|
|
2213
|
+
|
|
1704
2214
|
|
|
1705
2215
|
**sendMessageDraft** โ Pre-isi input box user dengan draft pesan. User bisa edit dan kirim sendiri.
|
|
1706
2216
|
|
|
@@ -1744,7 +2254,9 @@ bot.on('message', async (ctx) => {
|
|
|
1744
2254
|
})
|
|
1745
2255
|
```
|
|
1746
2256
|
|
|
1747
|
-
|
|
2257
|
+
|
|
2258
|
+
#### โ 16.8 ยท Bot API 9.5 โ Member Tags, Date-Time Entity
|
|
2259
|
+
|
|
1748
2260
|
|
|
1749
2261
|
**setChatMemberTag** โ Set tag custom untuk member grup (butuh hak `can_manage_tags`).
|
|
1750
2262
|
|
|
@@ -1767,7 +2279,9 @@ await ctx.telegram.setChatMemberTag(chatId, userId, '')
|
|
|
1767
2279
|
const audios = await bot.telegram.getUserProfileAudios(userId, { limit: 5 })
|
|
1768
2280
|
```
|
|
1769
2281
|
|
|
1770
|
-
|
|
2282
|
+
|
|
2283
|
+
#### โ 16.9 ยท Bot API 9.6 โ Managed Bots
|
|
2284
|
+
|
|
1771
2285
|
Bot kini bisa membuat, mengonfigurasi, dan mengelola bot lain secara programatik tanpa perlu ke @BotFather.
|
|
1772
2286
|
|
|
1773
2287
|
```js
|
|
@@ -1781,7 +2295,9 @@ await bot.telegram.replaceManagedBotToken(botUserId)
|
|
|
1781
2295
|
await bot.telegram.savePreparedKeyboardButton(button, userId)
|
|
1782
2296
|
```
|
|
1783
2297
|
|
|
1784
|
-
|
|
2298
|
+
|
|
2299
|
+
#### โ 16.10 ยท Bot API 10.0 โ Guest Mode
|
|
2300
|
+
|
|
1785
2301
|
Bot bisa menerima pesan dan membalas di chat yang **bukan** anggotanya โ tanpa perlu join grup.
|
|
1786
2302
|
|
|
1787
2303
|
```js
|
|
@@ -1794,7 +2310,9 @@ bot.on('guest_message', async (ctx) => {
|
|
|
1794
2310
|
})
|
|
1795
2311
|
```
|
|
1796
2312
|
|
|
1797
|
-
|
|
2313
|
+
|
|
2314
|
+
#### โ 16.11 ยท Bot API 10.0 โ Bot-to-Bot Communication
|
|
2315
|
+
|
|
1798
2316
|
Bot bisa kirim pesan ke bot lain via @username (keduanya harus opt-in via @BotFather).
|
|
1799
2317
|
|
|
1800
2318
|
```js
|
|
@@ -1802,7 +2320,9 @@ Bot bisa kirim pesan ke bot lain via @username (keduanya harus opt-in via @BotFa
|
|
|
1802
2320
|
await bot.telegram.sendMessage('@other_bot_username', 'Halo bot lain!')
|
|
1803
2321
|
```
|
|
1804
2322
|
|
|
1805
|
-
|
|
2323
|
+
|
|
2324
|
+
#### โ 16.12 ยท Bot API 10.0 โ Delete Reactions
|
|
2325
|
+
|
|
1806
2326
|
```js
|
|
1807
2327
|
// Hapus satu reaction spesifik pada pesan
|
|
1808
2328
|
bot.on('message', async (ctx) => {
|
|
@@ -1819,7 +2339,9 @@ await bot.telegram.deleteMessageReaction(chatId, messageId, { type: 'emoji', emo
|
|
|
1819
2339
|
await bot.telegram.deleteAllMessageReactions(chatId, messageId)
|
|
1820
2340
|
```
|
|
1821
2341
|
|
|
1822
|
-
|
|
2342
|
+
|
|
2343
|
+
#### โ 16.13 ยท Bot API 10.0 โ Live Photo
|
|
2344
|
+
|
|
1823
2345
|
Bot bisa mengirim foto dengan video pendek (seperti iPhone Live Photos).
|
|
1824
2346
|
|
|
1825
2347
|
```js
|
|
@@ -1832,7 +2354,9 @@ bot.on('message', async (ctx) => {
|
|
|
1832
2354
|
await bot.telegram.sendLivePhoto(chatId, { source: './photo.heic' }, { caption: 'Keren!' })
|
|
1833
2355
|
```
|
|
1834
2356
|
|
|
1835
|
-
|
|
2357
|
+
|
|
2358
|
+
#### โ 16.14 ยท Bot API 10.0 โ Managed Bot Access Settings
|
|
2359
|
+
|
|
1836
2360
|
```js
|
|
1837
2361
|
// Cek siapa yang bisa kirim pesan ke managed bot
|
|
1838
2362
|
const settings = await bot.telegram.getManagedBotAccessSettings(botUserId)
|
|
@@ -1845,7 +2369,9 @@ await bot.telegram.setManagedBotAccessSettings(botUserId, {
|
|
|
1845
2369
|
})
|
|
1846
2370
|
```
|
|
1847
2371
|
|
|
1848
|
-
|
|
2372
|
+
|
|
2373
|
+
#### โ 16.15 ยท Bot API 10.0 โ Get User Personal Chat Messages
|
|
2374
|
+
|
|
1849
2375
|
```js
|
|
1850
2376
|
// Ambil pesan dari personal chat user (yang di-pin di profil mereka)
|
|
1851
2377
|
const messages = await bot.telegram.getUserPersonalChatMessages(userId, {
|
|
@@ -1854,7 +2380,9 @@ const messages = await bot.telegram.getUserPersonalChatMessages(userId, {
|
|
|
1854
2380
|
})
|
|
1855
2381
|
```
|
|
1856
2382
|
|
|
1857
|
-
|
|
2383
|
+
|
|
2384
|
+
#### โ 16.16 ยท Bot API 10.1 โ Join Request Queries
|
|
2385
|
+
|
|
1858
2386
|
Bot bisa merespons join request secara interaktif, termasuk membuka Mini App.
|
|
1859
2387
|
|
|
1860
2388
|
```js
|
|
@@ -1869,7 +2397,9 @@ bot.on('chat_join_request', async (ctx) => {
|
|
|
1869
2397
|
})
|
|
1870
2398
|
```
|
|
1871
2399
|
|
|
1872
|
-
|
|
2400
|
+
|
|
2401
|
+
#### โ 16.17 ยท Bot API 10.1 โ Rich Messages
|
|
2402
|
+
|
|
1873
2403
|
Fitur paling besar: bot bisa mengirim pesan super terstruktur โ heading, tabel, list, blockquote, slideshow, math, dan lain-lain. Cocok untuk bot AI yang perlu format output kaya.
|
|
1874
2404
|
|
|
1875
2405
|
```js
|
|
@@ -1910,10 +2440,21 @@ bot.on('message', async (ctx) => {
|
|
|
1910
2440
|
|
|
1911
2441
|
---
|
|
1912
2442
|
|
|
1913
|
-
|
|
2443
|
+
|
|
2444
|
+
<br>
|
|
2445
|
+
|
|
2446
|
+
<div align="right"><sub>ยง SECTION 17</sub></div>
|
|
2447
|
+
|
|
2448
|
+
## 17 โ Discord Bot (ElynnDiscord)
|
|
2449
|
+
|
|
2450
|
+
<hr>
|
|
2451
|
+
|
|
2452
|
+
|
|
1914
2453
|
Selain WhatsApp dan Telegram, elynn-baileys kini juga membungkus **Oceanic.js** secara penuh dengan nama `ElynnDiscord`. Artinya Anda bisa membangun bot Discord lengkap โ menangani pesan, slash commands, embeds, file upload, hingga sharding โ tanpa perlu menginstal package `oceanic.js` terpisah.
|
|
1915
2454
|
|
|
1916
|
-
|
|
2455
|
+
|
|
2456
|
+
#### โ 17.1 ยท Setup Dasar & Login Bot
|
|
2457
|
+
|
|
1917
2458
|
```js
|
|
1918
2459
|
import { ElynnDiscord } from 'elynn-baileys'
|
|
1919
2460
|
|
|
@@ -1931,9 +2472,12 @@ client.on('ready', () => {
|
|
|
1931
2472
|
client.connect()
|
|
1932
2473
|
```
|
|
1933
2474
|
|
|
2475
|
+
> [!NOTE]
|
|
1934
2476
|
> **Catatan:** `MESSAGE_CONTENT` adalah *privileged intent*. Aktifkan di [Discord Developer Portal](https://discord.com/developers/applications) โ Bot โ Privileged Gateway Intents.
|
|
1935
2477
|
|
|
1936
|
-
|
|
2478
|
+
|
|
2479
|
+
#### โ 17.2 ยท Menangani Event & Pesan
|
|
2480
|
+
|
|
1937
2481
|
```js
|
|
1938
2482
|
import { ElynnDiscord } from 'elynn-baileys'
|
|
1939
2483
|
|
|
@@ -1977,7 +2521,9 @@ client.on('error', (err) => {
|
|
|
1977
2521
|
client.connect()
|
|
1978
2522
|
```
|
|
1979
2523
|
|
|
1980
|
-
|
|
2524
|
+
|
|
2525
|
+
#### โ 17.3 ยท Slash Commands (Application Commands)
|
|
2526
|
+
|
|
1981
2527
|
Oceanic mendukung pendaftaran dan penanganan Application Commands (Slash Commands) secara native.
|
|
1982
2528
|
```js
|
|
1983
2529
|
import { ElynnDiscord } from 'elynn-baileys'
|
|
@@ -2034,7 +2580,9 @@ client.on('interactionCreate', async (interaction) => {
|
|
|
2034
2580
|
client.connect()
|
|
2035
2581
|
```
|
|
2036
2582
|
|
|
2037
|
-
|
|
2583
|
+
|
|
2584
|
+
#### โ 17.4 ยท Embed & File Upload
|
|
2585
|
+
|
|
2038
2586
|
```js
|
|
2039
2587
|
import { ElynnDiscord } from 'elynn-baileys'
|
|
2040
2588
|
import { readFileSync } from 'fs'
|
|
@@ -2091,7 +2639,9 @@ client.on('messageCreate', async (msg) => {
|
|
|
2091
2639
|
client.connect()
|
|
2092
2640
|
```
|
|
2093
2641
|
|
|
2094
|
-
|
|
2642
|
+
|
|
2643
|
+
#### โ 17.5 ยท Sharding dengan ShardManager
|
|
2644
|
+
|
|
2095
2645
|
Untuk bot berskala besar (1000+ guild), gunakan `ShardManager` bawaan Oceanic untuk mendistribusikan koneksi gateway.
|
|
2096
2646
|
```js
|
|
2097
2647
|
import { ElynnDiscord } from 'elynn-baileys'
|
|
@@ -2129,7 +2679,9 @@ client.on('messageCreate', async (msg) => {
|
|
|
2129
2679
|
client.connect()
|
|
2130
2680
|
```
|
|
2131
2681
|
|
|
2132
|
-
|
|
2682
|
+
|
|
2683
|
+
#### โ 17.6 ยท Cek Koneksi Bot dengan `connectDiscord`
|
|
2684
|
+
|
|
2133
2685
|
Helper bawaan untuk memvalidasi token bot Discord secara cepat tanpa harus memulai koneksi gateway penuh โ cocok dipakai saat startup aplikasi untuk logging status atau health-check deployment.
|
|
2134
2686
|
```js
|
|
2135
2687
|
import { connectDiscord } from 'elynn-baileys'
|
|
@@ -2178,13 +2730,24 @@ Infrastruktur *Privileged Gateway Intents* diatur ulang untuk sinkronisasi metad
|
|
|
2178
2730
|
|
|
2179
2731
|
* **Moderation Metadata**: Elynn Discord kini dapat mengatur transfer struktur *key-value* khusus kepada *server backend* eksternal. Informasi hukuman, limitasi akses, dan metadata pembatasan akun disinkronkan secara *real-time* menghindari latensi eskalasi konflik di Discord.
|
|
2180
2732
|
* **Peninjauan Ambang Batas Pengguna**: Kalkulasi kepemilikan *Privileged Intents* (`MESSAGE_CONTENT`, `GUILD_MEMBERS`, dll) tidak lagi dihitung berdasarkan agregasi server. Discord mengunci ambang batas pada jangkauan kumulatif 10.000 pengguna individu. Seluruh *platform* aplikasi diwajibkan untuk memvalidasi alur izin *intent* tersebut secara manual per putaran verifikasi tahunan di dalam dasbor Developer Portal.
|
|
2733
|
+
```
|
|
2181
2734
|
---
|
|
2182
2735
|
|
|
2183
|
-
|
|
2736
|
+
|
|
2737
|
+
<br>
|
|
2738
|
+
|
|
2739
|
+
<div align="right"><sub>ยง SECTION 18</sub></div>
|
|
2740
|
+
|
|
2741
|
+
## 18 โ testMessage : Tes Semua Jenis Pesan
|
|
2742
|
+
|
|
2743
|
+
<hr>
|
|
2744
|
+
|
|
2184
2745
|
|
|
2185
2746
|
`testMessage` adalah fungsi utilitas eksklusif elynn-baileys untuk **menguji pengiriman semua jenis pesan Baileys** secara cepat โ bisa dipakai di grup maupun private chat, tanpa perlu set target/total kirim. Cukup reply atau panggil di handler bot mana pun.
|
|
2186
2747
|
|
|
2187
|
-
|
|
2748
|
+
|
|
2749
|
+
#### โ Cara import & penggunaan
|
|
2750
|
+
|
|
2188
2751
|
|
|
2189
2752
|
```js
|
|
2190
2753
|
import { testMessage } from 'elynn-baileys'
|
|
@@ -2208,7 +2771,9 @@ sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
|
2208
2771
|
})
|
|
2209
2772
|
```
|
|
2210
2773
|
|
|
2211
|
-
|
|
2774
|
+
|
|
2775
|
+
#### โ Signature lengkap
|
|
2776
|
+
|
|
2212
2777
|
|
|
2213
2778
|
```js
|
|
2214
2779
|
/**
|
|
@@ -2221,44 +2786,60 @@ sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
|
2221
2786
|
await testMessage(sock, jid, { quoted: msg, delay: 700 })
|
|
2222
2787
|
```
|
|
2223
2788
|
|
|
2224
|
-
### Yang diuji (16 jenis pesan)
|
|
2225
|
-
|
|
2226
|
-
| # | Jenis Pesan | Keterangan |
|
|
2227
|
-
|---|-----------------------|---------------------------------------------------|
|
|
2228
|
-
| 1 | Text biasa | Plain text message |
|
|
2229
|
-
| 2 | Text + Mention | Mention member (group: semua, private: self) |
|
|
2230
|
-
| 3 | Image | Gambar dari URL + caption |
|
|
2231
|
-
| 4 | Video | Video dari URL + caption |
|
|
2232
|
-
| 5 | Audio | Audio musik (bukan PTT) |
|
|
2233
|
-
| 6 | PTT Voice Note | Voice note dengan codec opus |
|
|
2234
|
-
| 7 | Document | File PDF dengan filename |
|
|
2235
|
-
| 8 | Sticker | Stiker dari URL gambar |
|
|
2236
|
-
| 9 | Location | Koordinat lokasi |
|
|
2237
|
-
|10 | Contact / vCard | Kartu kontak WA |
|
|
2238
|
-
|11 | Reaction | Emoji reaction (jika `quoted` disediakan) |
|
|
2239
|
-
|12 | Edit Message | Kirim pesan โ tunggu โ edit isinya |
|
|
2240
|
-
|13 | Delete Message | Kirim pesan โ tunggu โ hapus |
|
|
2241
|
-
|14 | Forward Simulation | Simulasi forward (tanpa pesan asli) |
|
|
2242
|
-
|15 | Buttons (Legacy) | Tombol interaktif legacy |
|
|
2243
|
-
|16 | List Message | Pesan daftar pilihan (list) |
|
|
2244
2789
|
|
|
2790
|
+
#### โ Yang diuji (16 jenis pesan)
|
|
2791
|
+
|
|
2792
|
+
|
|
2793
|
+
| # | Jenis Pesan | Keterangan |
|
|
2794
|
+
|:---:|:---|:---|
|
|
2795
|
+
| `01` | Text biasa | Plain text message |
|
|
2796
|
+
| `02` | Text + Mention | Mention member โ group: semua, private: self |
|
|
2797
|
+
| `03` | Image | Gambar dari URL + caption |
|
|
2798
|
+
| `04` | Video | Video dari URL + caption |
|
|
2799
|
+
| `05` | Audio | Audio musik, bukan PTT |
|
|
2800
|
+
| `06` | PTT Voice Note | Voice note dengan codec opus |
|
|
2801
|
+
| `07` | Document | File PDF dengan filename |
|
|
2802
|
+
| `08` | Sticker | Stiker dari URL gambar |
|
|
2803
|
+
| `09` | Location | Koordinat lokasi |
|
|
2804
|
+
| `10` | Contact / vCard | Kartu kontak WA |
|
|
2805
|
+
| `11` | Reaction | Emoji reaction, jika `quoted` disediakan |
|
|
2806
|
+
| `12` | Edit Message | Kirim pesan โ tunggu โ edit isinya |
|
|
2807
|
+
| `13` | Delete Message | Kirim pesan โ tunggu โ hapus |
|
|
2808
|
+
| `14` | Forward Simulation | Simulasi forward tanpa pesan asli |
|
|
2809
|
+
| `15` | Buttons (Legacy) | Tombol interaktif legacy |
|
|
2810
|
+
| `16` | List Message | Pesan daftar pilihan (list) |
|
|
2811
|
+
|
|
2812
|
+
> [!NOTE]
|
|
2245
2813
|
> Semua tes berjalan **async berurutan** dengan jeda antar pesan. Bekerja di grup maupun private chat tanpa konfigurasi tambahan.
|
|
2246
2814
|
|
|
2247
2815
|
---
|
|
2248
2816
|
|
|
2249
|
-
|
|
2817
|
+
|
|
2818
|
+
<br>
|
|
2819
|
+
|
|
2820
|
+
<div align="right"><sub>ยง SECTION 19</sub></div>
|
|
2821
|
+
|
|
2822
|
+
## 19 โ sessionGuard : Proteksi Session dari Pencurian
|
|
2823
|
+
|
|
2824
|
+
<hr>
|
|
2825
|
+
|
|
2250
2826
|
|
|
2251
2827
|
`sessionGuard` adalah fitur keamanan opsional yang **mengunci session WhatsApp ke IP server pertama kali bot dijalankan**. Jika session dicuri dan dicoba dijalankan di server lain, bot akan otomatis diblokir dan dihentikan paksa.
|
|
2252
2828
|
|
|
2829
|
+
> [!NOTE]
|
|
2253
2830
|
> **Tidak dipanggil = tidak ada proteksi** (default behaviour tetap normal)
|
|
2254
2831
|
|
|
2255
|
-
|
|
2832
|
+
|
|
2833
|
+
#### โ Cara Import
|
|
2834
|
+
|
|
2256
2835
|
|
|
2257
2836
|
```js
|
|
2258
2837
|
import { sessionGuard, isGuardActive, resetGuard } from 'elynn-baileys'
|
|
2259
2838
|
```
|
|
2260
2839
|
|
|
2261
|
-
|
|
2840
|
+
|
|
2841
|
+
#### โ Penggunaan Dasar
|
|
2842
|
+
|
|
2262
2843
|
|
|
2263
2844
|
Panggil `sessionGuard()` **sebelum** `makeWASocket`:
|
|
2264
2845
|
|
|
@@ -2275,7 +2856,9 @@ const sock = makeWASocket({ auth: state })
|
|
|
2275
2856
|
sock.ev.on('creds.update', saveCreds)
|
|
2276
2857
|
```
|
|
2277
2858
|
|
|
2278
|
-
|
|
2859
|
+
|
|
2860
|
+
#### โ Opsi Lengkap
|
|
2861
|
+
|
|
2279
2862
|
|
|
2280
2863
|
```js
|
|
2281
2864
|
await sessionGuard({
|
|
@@ -2290,21 +2873,26 @@ await sessionGuard({
|
|
|
2290
2873
|
```
|
|
2291
2874
|
|
|
2292
2875
|
| Opsi | Type | Default | Keterangan |
|
|
2293
|
-
|
|
2876
|
+
|:---|:---:|:---|:---|
|
|
2294
2877
|
| `sessionFile` | `string` | `'./auth_state.json'` | Path ke file session WA |
|
|
2295
2878
|
| `silent` | `boolean` | `false` | Sembunyikan log info guard |
|
|
2296
2879
|
| `onBlock` | `function` | `null` | Callback dipanggil sebelum `process.exit(1)` saat IP mismatch |
|
|
2297
2880
|
|
|
2298
|
-
|
|
2881
|
+
|
|
2882
|
+
#### โ Cara Kerja
|
|
2883
|
+
|
|
2299
2884
|
|
|
2300
2885
|
1. **Pertama kali dijalankan** โ Guard ambil IP publik server, hash dengan SHA-256, simpan ke file `.elynn_guard` di folder yang sama dengan session.
|
|
2301
2886
|
2. **Jalankan berikutnya** โ Guard bandingkan IP server sekarang dengan hash yang tersimpan.
|
|
2302
2887
|
3. **IP cocok** โ Bot lanjut normal โ
|
|
2303
2888
|
4. **IP beda** โ Bot cetak pesan error dan `process.exit(1)` โ
|
|
2304
2889
|
|
|
2890
|
+
> [!NOTE]
|
|
2305
2891
|
> IP disimpan dalam bentuk **hash SHA-256**, bukan plaintext โ aman meski file `.elynn_guard` bocor.
|
|
2306
2892
|
|
|
2307
|
-
|
|
2893
|
+
|
|
2894
|
+
#### โ Cek Status Guard
|
|
2895
|
+
|
|
2308
2896
|
|
|
2309
2897
|
```js
|
|
2310
2898
|
import { isGuardActive } from 'elynn-baileys'
|
|
@@ -2314,7 +2902,9 @@ if (isGuardActive()) {
|
|
|
2314
2902
|
}
|
|
2315
2903
|
```
|
|
2316
2904
|
|
|
2317
|
-
|
|
2905
|
+
|
|
2906
|
+
#### โ Reset Guard (Pindah Server)
|
|
2907
|
+
|
|
2318
2908
|
|
|
2319
2909
|
Jika lo pindah server secara sah, hapus guard lama dulu sebelum jalankan bot:
|
|
2320
2910
|
|
|
@@ -2327,26 +2917,28 @@ await resetGuard('./auth_state/creds.json')
|
|
|
2327
2917
|
|
|
2328
2918
|
Atau hapus manual file `.elynn_guard` dari folder session lo, lalu jalankan bot kembali.
|
|
2329
2919
|
|
|
2330
|
-
|
|
2920
|
+
|
|
2921
|
+
#### โ Contoh Output Log
|
|
2922
|
+
|
|
2331
2923
|
|
|
2332
2924
|
**Pertama kali (registrasi):**
|
|
2333
2925
|
```
|
|
2334
2926
|
[ โฆ ] ELYNN GUARD: Mengaktifkan proteksi session...
|
|
2335
2927
|
[ โฆ ] ELYNN GUARD: IP Server: 103.xx.xx.xx
|
|
2336
|
-
[ โฆ ] ELYNN GUARD: Session terdaftar di server ini
|
|
2928
|
+
[ โฆ ] ELYNN GUARD: Session terdaftar di server ini โ
|
|
2337
2929
|
```
|
|
2338
2930
|
|
|
2339
2931
|
**Jalankan normal (IP cocok):**
|
|
2340
2932
|
```
|
|
2341
2933
|
[ โฆ ] ELYNN GUARD: Mengaktifkan proteksi session...
|
|
2342
2934
|
[ โฆ ] ELYNN GUARD: IP Server: 103.xx.xx.xx
|
|
2343
|
-
[ โฆ ] ELYNN GUARD: IP cocok, session aman
|
|
2935
|
+
[ โฆ ] ELYNN GUARD: IP cocok, session aman โ
|
|
2344
2936
|
```
|
|
2345
2937
|
|
|
2346
2938
|
**Session dicuri (IP beda):**
|
|
2347
2939
|
```
|
|
2348
2940
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
2349
|
-
โ
|
|
2941
|
+
โ [ ! ] ELYNN GUARD โ SESSION BLOCK
|
|
2350
2942
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
2351
2943
|
Session ini tidak bisa digunakan
|
|
2352
2944
|
di server ini karena IP berbeda.
|
|
@@ -2360,13 +2952,54 @@ Atau hapus manual file `.elynn_guard` dari folder session lo, lalu jalankan bot
|
|
|
2360
2952
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
2361
2953
|
```
|
|
2362
2954
|
|
|
2955
|
+
> [!NOTE]
|
|
2363
2956
|
> **Catatan:** Fitur ini tidak 100% foolproof jika server menggunakan IP dinamis (berubah setiap restart). Untuk VPS dengan IP statis, perlindungan ini sangat efektif.
|
|
2364
2957
|
|
|
2365
2958
|
---
|
|
2366
|
-
|
|
2959
|
+
|
|
2960
|
+
<br>
|
|
2961
|
+
|
|
2962
|
+
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:0a0a12,50:2b1a2e,100:0a0a12&height=130§ion=footer" width="100%"/>
|
|
2963
|
+
|
|
2964
|
+
<div align="center">
|
|
2965
|
+
|
|
2966
|
+
<hr>
|
|
2967
|
+
|
|
2968
|
+
### โฆ Credits & License
|
|
2969
|
+
|
|
2970
|
+
</div>
|
|
2971
|
+
|
|
2367
2972
|
Elynn Baileys dibangun di atas pondasi [Baileys](https://github.com/WhiskeySockets/Baileys) oleh Rajeh Taher/WhiskeySockets, dan diperluas oleh **Elynn** dengan integrasi Telegram Bot, plugin Brat/Bratvid bawaan, dukungan protokol WhatsApp 2026, serta berbagai peningkatan stabilitas.
|
|
2368
2973
|
|
|
2369
|
-
|
|
2370
|
-
|
|
2974
|
+
<table width="100%">
|
|
2975
|
+
<tr>
|
|
2976
|
+
<td align="center" width="50%">
|
|
2977
|
+
|
|
2978
|
+
**Lisensi**
|
|
2979
|
+
|
|
2980
|
+
Dirilis di bawah lisensi `MIT`
|
|
2981
|
+
Bebas dipakai, dimodifikasi, didistribusikan ulang
|
|
2982
|
+
|
|
2983
|
+
</td>
|
|
2984
|
+
<td align="center" width="50%">
|
|
2985
|
+
|
|
2986
|
+
**Copyright**
|
|
2987
|
+
|
|
2988
|
+
ยฉ 2025 Rajeh Taher / WhiskeySockets
|
|
2989
|
+
ยฉ 2026 **Elynn**
|
|
2990
|
+
|
|
2991
|
+
</td>
|
|
2992
|
+
</tr>
|
|
2993
|
+
</table>
|
|
2994
|
+
|
|
2995
|
+
<br>
|
|
2996
|
+
|
|
2997
|
+
<div align="center">
|
|
2998
|
+
|
|
2999
|
+
<sub>โฆ Dibuat dengan presisi oleh **Elynn** โฆ</sub>
|
|
3000
|
+
|
|
3001
|
+
<br><br>
|
|
3002
|
+
|
|
3003
|
+
<a href="#elynn-baileys"><img src="https://img.shields.io/badge/โ_KEMBALI_KE_ATAS-0a0a12?style=for-the-badge&labelColor=0a0a12&color=e8b76a" /></a>
|
|
2371
3004
|
|
|
2372
|
-
|
|
3005
|
+
</div>
|