@kaels/casileys 0.3.8 โ†’ 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +411 -1583
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -3,8 +3,6 @@
3
3
  [![Logo](https://raw.githubusercontent.com/kyleee-max/mutsumi-file/main/uploads/1779033636326.jpeg)](https://www.npmjs.com/package/@kaels/casileys)
4
4
 
5
5
  <p align="center">
6
-
7
- <br><br>
8
6
  <a href="https://www.npmjs.com/package/@kaels/casileys">
9
7
  <img src="https://img.shields.io/npm/v/@kaels/casileys?style=for-the-badge&logo=npm"/>
10
8
  </a>
@@ -25,211 +23,127 @@
25
23
  </a>
26
24
  </p>
27
25
 
28
- ### ๐Ÿ“ฅ Installation
26
+ ---
29
27
 
30
- - ๐Ÿ“„ Via `package.json`
28
+ ## ๐Ÿ™ A Note & Apology
29
+
30
+ > [!IMPORTANT]
31
+ > Saya ingin menyampaikan permohonan maaf yang tulus kepada **[@itsliaaa](https://github.com/itsliaaa)** selaku penulis fork [`@itsliaaa/baileys`**, yang menjadi dasar awal dari package ini.
32
+ >
33
+ > Pada awalnya, `@kaels/casileys` dibuat berdasarkan fork tersebut tanpa memberikan atribusi yang layak โ€” hal itu tidak benar dan saya mengakuinya.
34
+ >
35
+ > **Terima kasih banyak kepada @itsliaaa** atas kerja kerasnya dalam membangun dan memelihara fork yang luar biasa ini. Kontribusinya sangat berarti bagi komunitas WhatsApp bot.
36
+ >
37
+ > Ke depannya, `@kaels/casileys` akan dikembangkan secara mandiri sebagai proyek independen dengan modifikasi, perbaikan, dan arah yang berbeda โ€” bukan lagi sekadar re-upload. Semua perubahan akan didokumentasikan secara transparan.
38
+
39
+ ---
40
+
41
+ ## โœจ Highlights
42
+
43
+ Package ini dirancang untuk penggunaan produksi dengan fokus pada kejelasan dan keamanan:
44
+
45
+ - ๐Ÿšซ Tanpa obfuscation โ€” mudah dibaca dan diaudit.
46
+ - ๐Ÿ”ง Dikembangkan secara aktif dengan modifikasi dan penyesuaian tersendiri.
47
+
48
+ > [!NOTE]
49
+ > Proyek ini tidak dimaksudkan untuk menggantikan upstream Baileys maupun fork `@itsliaaa/baileys`.
50
+
51
+ ---
52
+
53
+ ## ๐Ÿ“‹ Table of Contents
54
+
55
+ - [๐Ÿ™ A Note & Apology](#-a-note--apology)
56
+ - [โœจ Highlights](#-highlights)
57
+ - [๐Ÿ“ฅ Installation](#-installation)
58
+ - [๐ŸŒ Connect to WhatsApp](#-connect-to-whatsapp-quick-step)
59
+ - [๐Ÿ—„๏ธ Implementing Data Store](#๏ธ-implementing-data-store)
60
+ - [๐Ÿชช WhatsApp IDs Explain](#-whatsapp-ids-explain)
61
+ - [โœ‰๏ธ Sending Messages](#๏ธ-sending-messages)
62
+ - [Text, Mention, Reaction, Pin, Forward, Contact, Location, Event, Poll](#-text)
63
+ - [Rich Response, Code Block, Inline Entities, Table](#-rich-response)
64
+ - [๐Ÿ“ Sending Media Messages](#-sending-media-messages)
65
+ - [Image, Video, Sticker, Audio, Document, Album, Sticker Pack](#๏ธ-image)
66
+ - [๐Ÿ‘‰๐Ÿป Sending Interactive Messages](#-sending-interactive-messages)
67
+ - [Buttons, List, Native Flow, Carousel, Hydrated Template](#-buttons)
68
+ - [๐Ÿ’ณ Sending Payment Messages](#-sending-payment-messages)
69
+ - [๐Ÿ‘๏ธ Other Message Options](#๏ธ-other-message-options)
70
+ - [โ™ป๏ธ Modify Messages](#๏ธ-modify-messages)
71
+ - [๐Ÿงฐ Additional Contents](#-additional-contents)
72
+ - [Group, Community, Profile, Business, Privacy, Newsletter, Events](#-group-management)
73
+ - [๐Ÿ“ฃ Credits](#-credits)
74
+
75
+ ---
76
+
77
+ ## ๐Ÿ“ฅ Installation
78
+
79
+ Via `package.json`:
31
80
 
32
81
  ```json
33
- # NPM
34
82
  "dependencies": {
35
83
  "@kaels/casileys": "latest"
36
84
  }
37
-
38
- # GitHub
39
- "dependencies": {
40
- "@kaels/casileys": "github:kaels/casileys"
41
- }
42
85
  ```
43
86
 
44
- - โŒจ๏ธ Via terminal
87
+ Via terminal:
45
88
 
46
89
  ```bash
47
- # NPM
48
90
  npm i @kaels/casileys@latest
49
-
50
- # GitHub
51
- npm i github:kaels/casileys
52
91
  ```
53
92
 
54
- #### ๐Ÿงฉ Import (ESM & CJS)
93
+ ### ๐Ÿงฉ Import
55
94
 
56
95
  ```javascript
57
- // --- ESM
96
+ // ESM
58
97
  import { makeWASocket } from '@kaels/casileys'
59
98
 
60
- // --- CJS (tested and working on Node.js 24 โœ…)
99
+ // CJS
61
100
  const { makeWASocket } = require('@kaels/casileys')
62
101
  ```
63
102
 
64
- ### โœจ Highlights
65
-
66
- This fork designed for production use with a focus on clarity and safety:
103
+ ---
67
104
 
68
- - ๐Ÿšซ No obfuscation. Easy to read and audit.
69
- - ๐Ÿ“ข Auto-follow 1 update channel for bot info (transparent, can be unfollowed anytime).
70
-
71
- > [!NOTE]
72
- > ๐Ÿ“„ This project is maintained with limited scope and is not intended to replace upstream Baileys.
73
- >
74
- > ๐Ÿ˜ž And, really sorry for my bad english.
75
-
76
- ### ๐Ÿ› ๏ธ Internal Adjustments
77
- - ๐Ÿ–ผ๏ธ Fixed an issue where media could not be sent to newsletters due to an upstream issue.
78
- - ๐Ÿ“ Reintroduced [`makeInMemoryStore`](#%EF%B8%8F-implementing-data-store) with a minimal ESM adaptation and small adjustments for Baileys v7.
79
- - ๐Ÿ“ฆ Switched FFmpeg execution from `exec` to `spawn` for safer process handling.
80
- - ๐Ÿ—ƒ๏ธ Added [`@napi-rs/image`](https://www.npmjs.com/package/@napi-rs/image) as a supported image processing backend in [`getImageProcessingLibrary()`](#%EF%B8%8F-image-processing), offering a balance between performance and compatibility.
81
-
82
- ### ๐Ÿ“จ Messages Handling & Compatibility
83
- - ๐Ÿ“ฉ Expanded messages support for:
84
- - ๐Ÿ–ผ๏ธ [Album Message](#%EF%B8%8F-album-image--video)
85
- - ๐Ÿ‘ค [Group Status Message](#%E2%80%8D%E2%80%8D-group-status)
86
- - ๐Ÿ‘‰๐Ÿป [Interactive Message](#-sending-interactive-messages) (buttons, lists, native flows, templates, carousels).
87
- - ๐ŸŽž๏ธ [Status Mention Message](#%EF%B8%8F-status-mention)
88
- - ๐Ÿ“ฆ [Sticker Pack Message](#-sticker-pack)
89
- - โœจ [Rich Response Message](#-rich-response) **[NEW]**
90
- - ๐Ÿงพ [Message with Code Blocks](#-message-with-code-block) **[NEW]**
91
- - [๐ŸŒ Message with Inline Entities](#-message-with-inline-entities) **[NEW]**
92
- - ๐Ÿ“‹ [Message with Table](#-message-with-table) **[NEW]**
93
- - ๐Ÿ’ณ [Payment-related Message](#-sending-payment-messages) (payment requests, invites, orders, invoices).
94
- - ๐Ÿ“ฐ Simplified sending messages with ad thumbnail using [`externalAdReply`](#-external-ad-reply), without requiring manual `contextInfo`.
95
- - ๐Ÿ’ญ Added support for quoting messages inside channel (newsletter). **[NEW]**
96
- - ๐ŸŽ€ Added support for [custom button icon](#%EF%B8%8F-interactive). **[NEW]**
97
-
98
- ### ๐Ÿงฉ Additional Message Options
99
- - ๐Ÿ‘๏ธ Added optional boolean flags for message handling:
100
- - ๐Ÿค– [`ai`](#-ai-icon) - AI icon on message
101
- - ๐Ÿ“ฃ [`mentionAll`](#-mention) - Mention all group participants without requiring their JIDs in `mentions` or `mentionedJid` **[NEW]**
102
- - ๐Ÿ”ง [`ephemeral`](#-ephemeral), [`groupStatus`](#%E2%80%8D%E2%80%8D-group-status), [`isLottie`](#-lottie-sticker), [`spoiler`](#-spoiler), [`viewOnce`](#%EF%B8%8F-view-once), [`viewOnceV2`](#%EF%B8%8F-view-once-v2), [`viewOnceV2Extension`](#%EF%B8%8F-view-once-v2-extension), [`interactiveAsTemplate`](#%EF%B8%8F-interactive) - Message wrappers
103
- - ๐Ÿ”’ [`secureMetaServiceLabel`](#%EF%B8%8F-secure-meta-service-label) - Secure meta service label on message **[NEW]**
104
- - ๐Ÿ“„ [`raw`](#-raw) - Build your message manually **(DO NOT USE FOR EXPLOITATION)**
105
-
106
- ### ๐Ÿ“‹ Table of Contents
107
- - [โœจ Highlights](#-highlights)
108
- - [๐Ÿ› ๏ธ Internal Adjustments](#%EF%B8%8F-internal-adjustments)
109
- - [๐Ÿ“จ Messages Handling & Compatibility](#-highlights)
110
- - [๐Ÿงฉ Additional Message Options](#-additional-message-options)
111
- - [๐Ÿ“ฅ Installation](#-installation)
112
- - [๐Ÿงฉ Import (ESM & CJS)](#-import-esm--cjs)
113
- - [๐ŸŒ Connect to WhatsApp (Quick Step)](#-connect-to-whatsapp-quick-step)
114
- - [๐Ÿ” Auth State](#-auth-state)
115
- - [๐Ÿ—„๏ธ Implementing Data Store](#%EF%B8%8F-implementing-data-store)
116
- - [๐Ÿชช WhatsApp IDs Explain](#-whatsapp-ids-explain)
117
- - [โœ‰๏ธ Sending Messages](#%EF%B8%8F-sending-messages)
118
- - [๐Ÿ”  Text](#-text)
119
- - [๐Ÿ”” Mention](#-mention)
120
- - [๐Ÿ˜ Reaction](#-reaction)
121
- - [๐Ÿ“Œ Pin Message](#-pin-message)
122
- - [๐Ÿ”– Keep Chat](#-keep-chat)
123
- - [โžก๏ธ Forward Message](#%EF%B8%8F-forward-message)
124
- - [๐Ÿ‘ค Contact](#-contact)
125
- - [๐Ÿ“ Location](#-location)
126
- - [๐Ÿ—“๏ธ Event](#%EF%B8%8F-event)
127
- - [๐Ÿ‘ฅ Group Invite](#-group-invite)
128
- - [๐Ÿ›๏ธ Product](#%EF%B8%8F-product)
129
- - [๐Ÿ“Š Poll](#-poll)
130
- - [๐Ÿ’ญ Button Response](#-button-response)
131
- - [โœจ Rich Response](#-rich-response)
132
- - [๐Ÿงพ Message with Code Block](#-message-with-code-block)
133
- - [๐ŸŒ Message with Inline Entities](#-message-with-inline-entities)
134
- - [๐Ÿ“‹ Message with Table](#-message-with-table)
135
- - [๐ŸŽž๏ธ Status Mention](#%EF%B8%8F-status-mention)
136
- - [๐Ÿ“ Sending Media Messages](#-sending-media-messages)
137
- - [๐Ÿ–ผ๏ธ Image](#%EF%B8%8F-image)
138
- - [๐ŸŽฅ Video](#-video)
139
- - [๐Ÿ“ƒ Sticker](#-sticker)
140
- - [๐Ÿ’ฝ Audio](#-audio)
141
- - [๐Ÿ—‚๏ธ Document](#%EF%B8%8F-document)
142
- - [๐Ÿ–ผ๏ธ Album (Image & Video)](#%EF%B8%8F-album-image--video)
143
- - [๐Ÿ“ฆ Sticker Pack](#-sticker-pack)
144
- - [๐Ÿ‘‰๐Ÿป Sending Interactive Messages](#-sending-interactive-messages)
145
- - [๐Ÿ”˜ Buttons](#-buttons)
146
- - [๐Ÿ“‹ List](#-list)
147
- - [๐Ÿ—„๏ธ Interactive](#%EF%B8%8F-interactive)
148
- - [๐Ÿซ™ Hydrated Template](#-hydrated-template)
149
- - [๐Ÿ’ณ Sending Payment Messages](#-sending-payment-messages)
150
- - [โž• Invite Payment](#-invite-payment)
151
- - [๐Ÿงพ Invoice](#-invoice)
152
- - [๐Ÿ›๏ธ Order](#%EF%B8%8F-order)
153
- - [๐Ÿ’ณ Request Payment](#-request-payment)
154
- - [๐Ÿ‘๏ธ Other Message Options](#%EF%B8%8F-other-message-options)
155
- - [๐Ÿค– AI Icon](#-ai-icon)
156
- - [๐Ÿ•’ Ephemeral](#-ephemeral)
157
- - [๐Ÿ“ฐ External Ad Reply](#-external-ad-reply)
158
- - [๐Ÿง‘โ€๐Ÿง‘โ€๐Ÿง’ Group Status](#%E2%80%8D%E2%80%8D-group-status)
159
- - [๐Ÿฑ Lottie Sticker](#-lottie-sticker)
160
- - [๐Ÿงฉ Raw](#-raw)
161
- - [๐Ÿท๏ธ Secure Meta Service Label](#%EF%B8%8F-secure-meta-service-label)
162
- - [๐Ÿ“‘ Spoiler](#-spoiler)
163
- - [๐Ÿ‘๏ธ View Once](#%EF%B8%8F-view-once)
164
- - [๐Ÿ‘๏ธ View Once V2](#%EF%B8%8F-view-once-v2)
165
- - [๐Ÿ‘๏ธ View Once V2 Extension](#%EF%B8%8F-view-once-v2-extension)
166
- - [โ™ป๏ธ Modify Messages](#%EF%B8%8F-modify-messages)
167
- - [๐Ÿ—‘๏ธ Delete Messages](#%EF%B8%8F-delete-messages)
168
- - [โœ๏ธ Edit Messages](#%EF%B8%8F-edit-messages)
169
- - [๐Ÿงฐ Additional Contents](#-additional-contents)
170
- - [๐Ÿท๏ธ Find User ID (JID|PN/LID)](#%EF%B8%8F-find-user-id-jidpnlid)
171
- - [๐Ÿ”‘ Request Custom Pairing Code](#-request-custom-pairing-code)
172
- - [๐Ÿ–ผ๏ธ Image Processing](#%EF%B8%8F-image-processing)
173
- - [๐Ÿ“ฃ Newsletter Management](#-newsletter-management)
174
- - [๐Ÿ‘ฅ Group Management](#-group-management)
175
- - [๐Ÿ‘ฅ Community Management](#-community-management)
176
- - [๐Ÿ‘ค Profile Management](#-profile-management)
177
- - [๐Ÿ›’ Business Management](#-business-management)
178
- - [๐Ÿ” Privacy Management](#-privacy-management)
179
- - [๐Ÿ“ก Events](#-events)
180
- - [๐Ÿš€ Try the Bot](#-try-the-bot)
181
- - [๐Ÿ“ฆ Fork Base](#-fork-base)
182
- - [๐Ÿ“ฃ Credits](#-credits)
183
-
184
- ### ๐ŸŒ Connect to WhatsApp (Quick Step)
105
+ ## ๐ŸŒ Connect to WhatsApp (Quick Step)
185
106
 
186
107
  ```javascript
187
108
  import { makeWASocket, delay, DisconnectReason, useMultiFileAuthState } from '@kaels/casileys'
188
109
  import { Boom } from '@hapi/boom'
189
110
  import pino from 'pino'
190
111
 
191
- // --- Connect with pairing code
192
112
  const myPhoneNumber = '6288888888888'
193
113
 
194
- const logger = pino({ level: 'silent' })
195
-
196
114
  const connectToWhatsApp = async () => {
197
115
  const { state, saveCreds } = await useMultiFileAuthState('session')
198
-
116
+
199
117
  const sock = makeWASocket({
200
- logger,
118
+ logger: pino({ level: 'silent' }),
201
119
  auth: state
202
120
  })
203
121
 
204
122
  sock.ev.on('creds.update', saveCreds)
205
123
 
206
- sock.ev.on('connection.update', (update) => {
124
+ sock.ev.on('connection.update', async (update) => {
207
125
  const { connection, lastDisconnect } = update
126
+
208
127
  if (connection === 'connecting' && !sock.authState.creds.registered) {
209
128
  await delay(1500)
210
129
  const code = await sock.requestPairingCode(myPhoneNumber)
211
- console.log('๐Ÿ”— Pairing code', ':', code)
130
+ console.log('๐Ÿ”— Pairing code:', code)
212
131
  }
213
- else if (connection === 'close') {
214
- const shouldReconnect = new Boom(connection?.lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
215
- console.log('โš ๏ธ Connection closed because', lastDisconnect.error, ', reconnecting ', shouldReconnect)
216
- if (shouldReconnect) {
217
- connectToWhatsApp()
218
- }
132
+
133
+ if (connection === 'close') {
134
+ const shouldReconnect = new Boom(lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
135
+ if (shouldReconnect) connectToWhatsApp()
219
136
  }
220
- else if (connection === 'open') {
221
- console.log('โœ… Successfully connected to WhatsApp')
137
+
138
+ if (connection === 'open') {
139
+ console.log('โœ… Connected to WhatsApp')
222
140
  }
223
141
  })
224
142
 
225
143
  sock.ev.on('messages.upsert', async ({ messages }) => {
226
144
  for (const message of messages) {
227
145
  if (!message.message) continue
228
-
229
- console.log('๐Ÿ”” Got new message', ':', message)
230
- await sock.sendMessage(message.key.remoteJid, {
231
- text: '๐Ÿ‘‹๐Ÿป Hello world'
232
- })
146
+ await sock.sendMessage(message.key.remoteJid, { text: '๐Ÿ‘‹๐Ÿป Hello world' })
233
147
  }
234
148
  })
235
149
  }
@@ -237,1782 +151,696 @@ const connectToWhatsApp = async () => {
237
151
  connectToWhatsApp()
238
152
  ```
239
153
 
240
- #### ๐Ÿ” Auth State
154
+ ### ๐Ÿ” Auth State
241
155
 
242
156
  > [!NOTE]
243
- > You can use the experimental `useSingleFileAuthState` as an alternative to `useMultiFileAuthState`. However, `useSingleFileAuthState` already includes an internal caching mechanism, so there is no need to wrap `state.keys` with `makeCacheableSignalKeyStore`.
157
+ > Bisa gunakan `useSingleFileAuthState` sebagai alternatif `useMultiFileAuthState`. `useSingleFileAuthState` sudah memiliki mekanisme caching internal, sehingga tidak perlu wrap `state.keys` dengan `makeCacheableSignalKeyStore`.
244
158
 
245
- ### ๐Ÿ—„๏ธ Implementing Data Store
159
+ ---
160
+
161
+ ## ๐Ÿ—„๏ธ Implementing Data Store
246
162
 
247
163
  > [!CAUTION]
248
- > I highly recommend building your own data store, as keeping an entire chat history in memory can lead to excessive RAM usage.
164
+ > Sangat disarankan membangun data store sendiri โ€” menyimpan seluruh history chat di memory bisa menyebabkan RAM usage yang tinggi.
249
165
 
250
166
  ```javascript
251
167
  import { makeWASocket, makeInMemoryStore, delay, DisconnectReason, useMultiFileAuthState } from '@kaels/casileys'
252
168
  import { Boom } from '@hapi/boom'
253
169
  import pino from 'pino'
254
170
 
255
- const myPhoneNumber = '6288888888888'
256
-
257
- // --- Create your store path
258
171
  const storePath = './store.json'
259
172
 
260
- const logger = pino({ level: 'silent' })
261
-
262
173
  const connectToWhatsApp = async () => {
263
174
  const { state, saveCreds } = await useMultiFileAuthState('session')
264
-
265
- const sock = makeWASocket({
266
- logger,
267
- auth: state
268
- })
269
175
 
270
- const store = makeInMemoryStore({
271
- logger,
272
- socket: sock
273
- })
176
+ const sock = makeWASocket({ logger: pino({ level: 'silent' }), auth: state })
274
177
 
178
+ const store = makeInMemoryStore({ logger: pino({ level: 'silent' }), socket: sock })
275
179
  store.bind(sock.ev)
276
180
 
277
181
  sock.ev.on('creds.update', saveCreds)
278
182
 
279
- sock.ev.on('connection.update', (update) => {
280
- const { connection, lastDisconnect } = update
281
- if (connection === 'connecting' && !sock.authState.creds.registered) {
282
- await delay(1500)
283
- const code = await sock.requestPairingCode(myPhoneNumber)
284
- console.log('๐Ÿ”— Pairing code', ':', code)
285
- }
286
- else if (connection === 'close') {
287
- const shouldReconnect = new Boom(connection?.lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
288
- console.log('โš ๏ธ Connection closed because', lastDisconnect.error, ', reconnecting ', shouldReconnect)
289
- if (shouldReconnect) {
290
- connectToWhatsApp()
291
- }
292
- }
293
- else if (connection === 'open') {
294
- console.log('โœ… Successfully connected to WhatsApp')
295
- }
296
- })
297
-
298
- sock.ev.on('chats.upsert', () => {
299
- console.log('โœ‰๏ธ Got chats', store.chats.all())
300
- })
301
-
302
- sock.ev.on('contacts.upsert', () => {
303
- console.log('๐Ÿ‘ฅ Got contacts', Object.values(store.contacts))
304
- })
305
-
306
- // --- Read store from file
183
+ // Baca store dari file
307
184
  store.readFromFile(storePath)
308
185
 
309
- // --- Save store every 3 minutes
310
- setInterval(() => {
311
- store.writeToFile(storePath)
312
- }, 180000)
186
+ // Simpan store setiap 3 menit
187
+ setInterval(() => store.writeToFile(storePath), 180_000)
313
188
  }
314
189
 
315
190
  connectToWhatsApp()
316
191
  ```
317
192
 
318
- ### ๐Ÿชช WhatsApp IDs Explain
319
-
320
- `id` is the WhatsApp ID, called `jid` and `lid` too, of the person or group you're sending the message to.
321
- - It must be in the format `[country code][phone number]@s.whatsapp.net`
322
- - Example for people: `19999999999@s.whatsapp.net` and `12699999999@lid`.
323
- - For groups, it must be in the format `123456789-123345@g.us`.
324
- - For Meta AI, it's `11111111111@bot`.
325
- - For broadcast lists, it's `[timestamp of creation]@broadcast`.
326
- - For stories, the ID is `status@broadcast`.
327
-
328
- ### โœ‰๏ธ Sending Messages
193
+ ---
329
194
 
330
- > [!NOTE]
331
- > You can get the `jid` from `message.key.remoteJid` in the first example.
195
+ ## ๐Ÿชช WhatsApp IDs Explain
332
196
 
333
- #### ๐Ÿ”  Text
197
+ | Format | Keterangan |
198
+ |---|---|
199
+ | `628xxx@s.whatsapp.net` | User biasa |
200
+ | `628xxx@lid` | User dengan Local Identifier |
201
+ | `123456789-123456@g.us` | Grup |
202
+ | `11111111111@bot` | Meta AI |
203
+ | `status@broadcast` | Stories |
204
+ | `[timestamp]@broadcast` | Broadcast list |
334
205
 
335
- ```javascript
336
- // --- Send a regular text message
337
- sock.sendMessage(jid, {
338
- text: '๐Ÿ‘‹๐Ÿป Hello'
339
- }, {
340
- quoted: message
341
- })
206
+ ---
342
207
 
343
- // --- Send a text message with a link preview
344
- const urlA = 'https://www.npmjs.com/package/@kaels/casileys'
208
+ ## โœ‰๏ธ Sending Messages
345
209
 
346
- sock.sendMessage(jid, {
347
- text: urlA + ' ๐Ÿ‘†๐Ÿป Check it out!',
348
- linkPreview: {
349
- 'matched-text': urlA,
350
- title: '๐ŸŒฑ @kaels/casileys',
351
- description: 'Underrated Baileys Fork',
352
- previewType: 0, // --- Use 1 for video playback in the link preview
353
- jpegThumbnail: fs.readFileSync('./path/to/image.jpg')
354
- }
355
- })
356
-
357
- // --- Send a text message with a large link preview and favicon
358
- import { prepareWAMessageMedia } from '@kaels/casileys'
359
-
360
- const urlB = 'https://www.npmjs.com/package/@kaels/casileys#readme'
210
+ > [!NOTE]
211
+ > `jid` bisa diambil dari `message.key.remoteJid`.
361
212
 
362
- const { imageMessage: image } = await prepareWAMessageMedia({
363
- image: {
364
- url: './path/to/image.jpg'
365
- }
366
- }, {
367
- upload: sock.waUploadToServer,
368
- mediaTypeOverride: 'thumbnail-link'
369
- })
213
+ ### ๐Ÿ”  Text
370
214
 
371
- // --- Set the thumbnail display size
372
- image.height = 720
373
- image.width = 480
215
+ ```javascript
216
+ // Teks biasa
217
+ sock.sendMessage(jid, { text: '๐Ÿ‘‹๐Ÿป Hello' }, { quoted: message })
374
218
 
219
+ // Dengan link preview
375
220
  sock.sendMessage(jid, {
376
- text: urlB + ' ๐Ÿ‘†๐Ÿป Check it out!',
221
+ text: 'https://www.npmjs.com/package/@kaels/casileys ๐Ÿ‘†๐Ÿป Check it out!',
377
222
  linkPreview: {
378
- 'matched-text': urlB,
379
- title: '๐ŸŒฑ @kaels/casileys',
380
- description: 'Underrated Baileys Fork',
223
+ 'matched-text': 'https://www.npmjs.com/package/@kaels/casileys',
224
+ title: '๐ŸŒธ @kaels/casileys',
225
+ description: 'WhatsApp Web API',
381
226
  previewType: 0,
382
- jpegThumbnail: fs.readFileSync('./path/to/image.jpg'),
383
- highQualityThumbnail: image,
384
- linkPreviewMetadata: {
385
- linkMediaDuration: 0, // --- Duration in seconds (for video/audio content)
386
- socialMediaPostType: 1, // --- Enum: 0 = NONE, 1 = REEL, 2 = LIVE_VIDEO, 3 = LONG_VIDEO, 4 = SINGLE_IMAGE, 5 = CAROUSEL
387
- } // --- Additional metadata for large link preview
388
- },
389
- favicon: {
390
- url: './path/to/tiny-image.ico'
227
+ jpegThumbnail: fs.readFileSync('./path/to/image.jpg')
391
228
  }
392
229
  })
393
230
  ```
394
231
 
395
- #### ๐Ÿ”” Mention
232
+ ### ๐Ÿ”” Mention
396
233
 
397
234
  ```javascript
398
- // --- Regular mention
235
+ // Mention spesifik
399
236
  sock.sendMessage(jid, {
400
237
  text: '๐Ÿ‘‹๐Ÿป Hello @628123456789',
401
238
  mentions: ['628123456789@s.whatsapp.net']
402
- }, {
403
- quoted: message
404
- })
239
+ }, { quoted: message })
405
240
 
406
- // --- Mention all
241
+ // Mention semua member grup
407
242
  sock.sendMessage(jid, {
408
243
  text: '๐Ÿ‘‹๐Ÿป Hello @all',
409
244
  mentionAll: true
410
- }, {
411
- quoted: message
412
- })
245
+ }, { quoted: message })
413
246
  ```
414
247
 
415
- #### ๐Ÿ˜ Reaction
248
+ ### ๐Ÿ˜ Reaction
416
249
 
417
250
  ```javascript
418
251
  sock.sendMessage(jid, {
419
- react: {
420
- key: message.key,
421
- text: 'โœจ'
422
- }
252
+ react: { key: message.key, text: 'โœจ' }
423
253
  })
424
254
  ```
425
255
 
426
- #### ๐Ÿ“Œ Pin Message
256
+ ### ๐Ÿ“Œ Pin Message
427
257
 
428
258
  ```javascript
429
259
  sock.sendMessage(jid, {
430
260
  pin: message.key,
431
- time: 86400, // --- Set the value in seconds: 86400 (1d), 604800 (7d), or 2592000 (30d)
432
- type: 1 // --- Or 2 to remove
433
- })
434
- ```
435
-
436
- #### ๐Ÿ”– Keep Chat
437
-
438
- > [!NOTE]
439
- > Keep Chat can only be used in chats or groups with disappearing messages enabled.
440
-
441
- ```javascript
442
- sock.sendMessage(jid, {
443
- keep: message.key,
444
- type: 1 // --- Or 2 to remove
261
+ time: 86400, // 86400 (1d) | 604800 (7d) | 2592000 (30d)
262
+ type: 1 // 2 untuk unpin
445
263
  })
446
264
  ```
447
265
 
448
- #### โžก๏ธ Forward Message
266
+ ### โžก๏ธ Forward Message
449
267
 
450
268
  ```javascript
451
- sock.sendMessage(jid, {
452
- forward: message,
453
- force: true // --- Optional
454
- })
269
+ sock.sendMessage(jid, { forward: message, force: true })
455
270
  ```
456
271
 
457
- #### ๐Ÿ‘ค Contact
272
+ ### ๐Ÿ‘ค Contact
458
273
 
459
274
  ```javascript
460
- const vcard = 'BEGIN:VCARD\n'
461
- + 'VERSION:3.0\n'
462
- + 'FN:kaels\n'
463
- + 'ORG:Waitress;\n'
464
- + 'TEL;type=CELL;type=VOICE;waid=628123456789:+62 8123 4567 89\n'
465
- + 'END:VCARD'
275
+ const vcard = 'BEGIN:VCARD\nVERSION:3.0\nFN:Kaelz\nTEL;type=CELL;waid=628123456789:+62 812 3456 789\nEND:VCARD'
466
276
 
467
277
  sock.sendMessage(jid, {
468
- contacts: {
469
- displayName: 'kaels',
470
- contacts: [
471
- { vcard }
472
- ]
473
- }
474
- }, {
475
- quoted: message
476
- })
278
+ contacts: { displayName: 'Kaelz', contacts: [{ vcard }] }
279
+ }, { quoted: message })
477
280
  ```
478
281
 
479
- #### ๐Ÿ“ Location
282
+ ### ๐Ÿ“ Location
480
283
 
481
284
  ```javascript
482
285
  sock.sendMessage(jid, {
483
- location: {
484
- degreesLatitude: 24.121231,
485
- degreesLongitude: 55.1121221,
486
- name: '๐Ÿ‘‹๐Ÿป I am here'
487
- }
488
- }, {
489
- quoted: message
490
- })
286
+ location: { degreesLatitude: -6.2, degreesLongitude: 106.8, name: '๐Ÿ“ Jakarta' }
287
+ }, { quoted: message })
491
288
  ```
492
289
 
493
- #### ๐Ÿ—“๏ธ Event
290
+ ### ๐Ÿ—“๏ธ Event
494
291
 
495
292
  ```javascript
496
293
  sock.sendMessage(jid, {
497
294
  event: {
498
- name: '๐ŸŽถ Meet & Mingle Party',
499
- description: 'Meet & Mingle Party is a fun, casual gathering to connect, chat, and build new relationships within the community.',
500
- call: 'audio', // --- Or "video", this field is optional
501
- startDate: new Date(Date.now() + 3600000),
502
- endDate: new Date(Date.now() + 28800000),
503
- isCancelled: false, // --- Optional
504
- isScheduleCall: false, // --- Optional
505
- extraGuestsAllowed: false, // --- Optional
506
- location: {
507
- name: 'Jakarta',
508
- degreesLatitude: -6.2,
509
- degreesLongitude: 106.8
510
- }
295
+ name: '๐ŸŽถ Meet & Mingle',
296
+ description: 'Gathering seru bareng komunitas!',
297
+ call: 'audio',
298
+ startDate: new Date(Date.now() + 3_600_000),
299
+ endDate: new Date(Date.now() + 28_800_000),
300
+ location: { name: 'Jakarta', degreesLatitude: -6.2, degreesLongitude: 106.8 }
511
301
  }
512
- }, {
513
- quoted: message
514
- })
302
+ }, { quoted: message })
515
303
  ```
516
304
 
517
- #### ๐Ÿ‘ฅ Group Invite
305
+ ### ๐Ÿ“Š Poll
518
306
 
519
307
  ```javascript
520
- const inviteCode = groupUrl
521
- .split('chat.whatsapp.com/')[1]
522
- ?.split('?')[0]
523
-
524
- const groupJid = '1201111111111@g.us'
525
- const groupName = '@kaels/casileys'
526
-
308
+ // Poll biasa
527
309
  sock.sendMessage(jid, {
528
- groupInvite: {
529
- inviteCode,
530
- inviteExpiration: Date.now() + 86400000,
531
- text: '๐Ÿ‘‹๐Ÿป Hello, we invite you to join our group.',
532
- jid: groupJid,
533
- subject: groupName,
534
- }
535
- }, {
536
- quoted: message
537
- })
538
- ```
539
-
540
- #### ๐Ÿ›๏ธ Product
541
-
542
- ```javascript
543
- import { randomUUID } from 'crypto'
544
-
545
- sock.sendMessage(jid, {
546
- image: {
547
- url: './path/to/image.jpg'
548
- },
549
- body: '๐Ÿ‘‹๐Ÿป Check my product here!',
550
- footer: '@kaels/casileys',
551
- product: {
552
- currencyCode: 'IDR',
553
- description: '๐Ÿ›๏ธ Interesting product!',
554
- priceAmount1000: 70_000_000,
555
- productId: randomUUID(),
556
- productImageCount: 1,
557
- salePriceAmount1000: 65_000_000,
558
- signedUrl: 'https://www.npmjs.com/package/@kaels/casileys',
559
- title: '๐Ÿ“ฆ Starseed (Premium)',
560
- url: 'https://www.npmjs.com/package/@kaels/casileys'
561
- },
562
- businessOwnerJid: '0@s.whatsapp.net'
563
- })
564
- ```
565
-
566
- #### ๐Ÿ“Š Poll
567
-
568
- ```javascript
569
- // --- Regular poll message
570
- sock.sendMessage(jid, {
571
- poll: {
572
- name: '๐Ÿ”ฅ Voting time',
573
- values: ['Yes', 'No'],
574
- selectableCount: 1,
575
- toAnnouncementGroup: false,
576
- endDate: new Date(Date.now() + 28800000), // --- Optional
577
- hideVoter: false, // --- Optional
578
- canAddOption: false // --- Optional
579
- }
580
- }, {
581
- quoted: message
582
- })
583
-
584
- // --- Quiz (only for newsletter)
585
- sock.sendMessage('1211111111111@newsletter', {
586
310
  poll: {
587
- name: '๐Ÿ”ฅ Quiz',
588
- values: ['Yes', 'No'],
589
- correctAnswer: 'Yes',
590
- pollType: 1
591
- }
592
- }, {
593
- quoted: message
594
- })
595
-
596
- // --- Poll result
597
- sock.sendMessage(jid, {
598
- pollResult: {
599
- name: '๐Ÿ“ Poll Result',
600
- votes: [{
601
- name: 'Nice',
602
- voteCount: 10
603
- }, {
604
- name: 'Nah',
605
- voteCount: 2
606
- }],
607
- pollType: 0 // Or 1 for quiz
608
- }
609
- }, {
610
- quoted: message
611
- })
612
-
613
- // --- Poll update
614
- sock.sendMessage(jid, {
615
- pollUpdate: {
616
- metadata: {},
617
- key: message.key,
618
- vote: {
619
- enclv: /* <Buffer> */,
620
- encPayload: /* <Buffer> */
621
- }
311
+ name: '๐Ÿ”ฅ Pilih yang terbaik!',
312
+ values: ['Option A', 'Option B'],
313
+ selectableCount: 1
622
314
  }
623
- }, {
624
- quoted: message
625
- })
315
+ }, { quoted: message })
626
316
  ```
627
317
 
628
- #### ๐Ÿ’ญ Button Response
318
+ ### ๐Ÿ’ญ Button Response
629
319
 
630
320
  ```javascript
631
- // --- Using buttonsResponseMessage
321
+ // Plain button reply
632
322
  sock.sendMessage(jid, {
633
323
  type: 'plain',
634
- buttonReply: {
635
- id: '#Menu',
636
- displayText: 'โœจ Interesting Menu'
637
- }
638
- }, {
639
- quoted: message
640
- })
324
+ buttonReply: { id: '#Menu', displayText: 'โœจ Menu' }
325
+ }, { quoted: message })
641
326
 
642
- // --- Using interactiveResponseMessage
327
+ // Interactive flow reply
643
328
  sock.sendMessage(jid, {
644
329
  flowReply: {
645
330
  format: 0,
646
331
  text: '๐Ÿ’ญ Response',
647
332
  name: 'menu_options',
648
- paramsJson: JSON.stringify({
649
- id: '#Menu',
650
- description: 'โœจ Interesting Menu'
651
- })
652
- }
653
- }, {
654
- quoted: message
655
- })
656
-
657
- // --- Using listResponseMessage
658
- sock.sendMessage(jid, {
659
- listReply: {
660
- title: '๐Ÿ“„ See More',
661
- description: 'โœจ Interesting Menu',
662
- id: '#Menu'
333
+ paramsJson: JSON.stringify({ id: '#Menu', description: 'Menu Utama' })
663
334
  }
664
- }, {
665
- quoted: message
666
- })
335
+ }, { quoted: message })
667
336
 
668
- // --- Using templateButtonReplyMessage
337
+ // List reply
669
338
  sock.sendMessage(jid, {
670
- type: 'template',
671
- buttonReply: {
672
- id: '#Menu',
673
- displayText: 'โœจ Interesting Menu',
674
- index: 1
675
- }
676
- }, {
677
- quoted: message
678
- })
339
+ listReply: { title: '๐Ÿ“„ See More', description: 'โœจ Menu', id: '#Menu' }
340
+ }, { quoted: message })
679
341
  ```
680
342
 
681
- #### โœจ Rich Response
682
-
683
- > [!NOTE]
684
- > `richResponse[]` is a representation of [`submessages[]`](https://baileys.wiki/docs/api/namespaces/proto/interfaces/IAIRichResponseSubMessage) inside `richResponseMessage`.
685
-
686
- > [!TIP]
687
- > You can still use the original [`submessages[]`](https://baileys.wiki/docs/api/namespaces/proto/interfaces/IAIRichResponseSubMessage) field directly.
688
- > The code example below is just an implementation using a helper, not a required structure.
343
+ ### โœจ Rich Response
689
344
 
690
345
  ```javascript
691
346
  sock.sendMessage(jid, {
692
- disclaimerText: 'RAW submessages structure example',
693
- richResponse: [{
694
- text: 'Example Usage',
695
- }, {
696
- language: 'javascript',
697
- code: [{
698
- highlightType: 0,
699
- codeContent: 'console.log("Hello, World!")'
700
- }]
701
- }, {
702
- text: 'Pretty simple, right?\n'
703
- }, {
704
- text: 'Comparison between Node.js, Bun, and Deno',
705
- }, {
706
- title: 'Runtime Comparison',
707
- table: [{
708
- isHeading: true,
709
- items: ['', 'Node.js', 'Bun', 'Deno']
710
- }, {
711
- isHeading: false,
712
- items: ['Engine', 'V8 (C++)', 'JavaScriptCore (C++)', 'V8 (C++)']
713
- }, {
714
- isHeading: false,
715
- items: ['Performance', '4/5', '5/5', '4/5']
716
- }]
717
- }, {
718
- text: 'Does this help clarify the differences?'
719
- }]
347
+ disclaimerText: 'Contoh Rich Response',
348
+ richResponse: [
349
+ { text: 'Contoh penggunaan:' },
350
+ { language: 'javascript', code: [{ highlightType: 0, codeContent: 'console.log("Hello!")' }] },
351
+ { text: 'Mudah, kan?' }
352
+ ]
720
353
  })
721
354
  ```
722
355
 
723
356
  > [!TIP]
724
- > You can easily add syntax highlighting by importing `tokenizeCode` directly from Baileys.
725
-
726
- ```javascript
727
- import { tokenizeCode } from '@kaels/casileys'
728
-
729
- const language = 'javascript'
730
- const code = 'console.log("Hello, World!")'
731
-
732
- sock.sendMessage(jid, {
733
- disclaimerText: 'Example of tokenizing Code Block',
734
- richResponse: [{
735
- text: 'Example Usage',
736
- }, {
737
- language,
738
- code: tokenizeCode(code, language)
739
- }, {
740
- text: 'Pretty simple, right?'
741
- }]
742
- })
743
- ```
744
-
745
- #### ๐Ÿงพ Message with Code Block
357
+ > Import `tokenizeCode` untuk syntax highlighting otomatis:
358
+ > ```javascript
359
+ > import { tokenizeCode } from '@kaels/casileys'
360
+ > ```
746
361
 
747
- > [!NOTE]
748
- > This feature already includes a built-in tokenizer.
362
+ ### ๐Ÿงพ Message with Code Block
749
363
 
750
364
  ```javascript
751
365
  sock.sendMessage(jid, {
752
366
  disclaimerText: 'Code Block',
753
- headerText: '## Example Usage',
367
+ headerText: '## Contoh Kode',
754
368
  contentText: '---',
755
369
  code: 'console.log("Hello, World!")',
756
370
  language: 'javascript',
757
- footerText: 'Pretty simple, right?'
371
+ footerText: 'Simpel kan?'
758
372
  })
759
373
  ```
760
374
 
761
- #### ๐ŸŒ Message with Inline Entities
375
+ ### ๐ŸŒ Message with Inline Entities (Links)
762
376
 
763
377
  ```javascript
764
378
  sock.sendMessage(jid, {
765
- disclaimerText: 'Inline Entities',
766
- headerText: '## Check Out!',
379
+ disclaimerText: 'Link List',
380
+ headerText: '## Useful Links',
767
381
  contentText: '---',
768
- links: [{
769
- text: '1. Google',
770
- title: 'Popular Search Engine',
771
- url: 'https://www.google.com/'
772
- }, {
773
- text: '2. YouTube',
774
- title: 'Popular Streaming Platform',
775
- url: 'https://www.youtube.com/'
776
- }, {
777
- text: '3. Modded Baileys',
778
- title: 'Underrated Baileys Fork',
779
- url: 'https://www.npmjs.com/package/@kaels/casileys'
780
- }],
382
+ links: [
383
+ { text: '1. npm', title: 'Package Registry', url: 'https://npmjs.com' },
384
+ { text: '2. GitHub', title: 'Source Code', url: 'https://github.com' }
385
+ ],
781
386
  footerText: '---'
782
387
  })
783
388
  ```
784
389
 
785
- #### ๐Ÿ“‹ Message with Table
390
+ ### ๐Ÿ“‹ Message with Table
786
391
 
787
392
  ```javascript
788
393
  sock.sendMessage(jid, {
789
- disclaimerText: 'Table',
790
- headerText: '## Comparison between Node.js, Bun, and Deno',
394
+ disclaimerText: 'Tabel Perbandingan',
395
+ headerText: '## Node.js vs Bun vs Deno',
791
396
  contentText: '---',
792
397
  title: 'Runtime Comparison',
793
398
  table: [
794
399
  ['', 'Node.js', 'Bun', 'Deno'],
795
- ['Engine', 'V8 (C++)', 'JavaScriptCore (C++)', 'V8 (C++)'],
400
+ ['Engine', 'V8', 'JavaScriptCore', 'V8'],
796
401
  ['Performance', '4/5', '5/5', '4/5']
797
402
  ],
798
- noHeading: false, // --- Optional
799
- footerText: 'Does this help clarify the differences?'
403
+ footerText: 'Pilih yang sesuai kebutuhan!'
800
404
  })
801
405
  ```
802
406
 
803
- #### ๐ŸŽž๏ธ Status Mention
804
-
805
- ```javascript
806
- sock.sendMessage([jidA, jidB, jidC], {
807
- text: 'Hello! ๐Ÿ‘‹๐Ÿป'
808
- })
809
- ```
407
+ ---
810
408
 
811
- ### ๐Ÿ“ Sending Media Messages
409
+ ## ๐Ÿ“ Sending Media Messages
812
410
 
813
411
  > [!NOTE]
814
- > For media messages, you can pass a `Buffer` directly, or an object with either `{ stream: Readable }` or `{ url: string }` (local file path or HTTP/HTTPS URL).
412
+ > Media bisa dikirim sebagai `Buffer`, `{ stream: Readable }`, atau `{ url: string }` (path lokal / URL).
815
413
 
816
- #### ๐Ÿ–ผ๏ธ Image
414
+ ### ๐Ÿ–ผ๏ธ Image
817
415
 
818
416
  ```javascript
819
417
  sock.sendMessage(jid, {
820
- image: {
821
- url: './path/to/image.jpg'
822
- },
823
- caption: '๐Ÿ”ฅ Superb'
824
- }, {
825
- quoted: message
826
- })
418
+ image: { url: './path/to/image.jpg' },
419
+ caption: '๐Ÿ”ฅ Keren!'
420
+ }, { quoted: message })
827
421
  ```
828
422
 
829
- #### ๐ŸŽฅ Video
423
+ ### ๐ŸŽฅ Video
830
424
 
831
425
  ```javascript
832
426
  sock.sendMessage(jid, {
833
- video: {
834
- url: './path/to/video.mp4'
835
- },
836
- gifPlayback: false, // --- Set true if you want to send video as GIF
837
- ptv: false, // --- Set true if you want to send video as PTV
838
- caption: '๐Ÿ”ฅ Superb'
839
- }, {
840
- quoted: message
841
- })
427
+ video: { url: './path/to/video.mp4' },
428
+ gifPlayback: false, // true untuk GIF
429
+ ptv: false, // true untuk PTV
430
+ caption: '๐ŸŽฌ Video keren!'
431
+ }, { quoted: message })
842
432
  ```
843
433
 
844
- #### ๐Ÿ“ƒ Sticker
434
+ ### ๐Ÿ“ƒ Sticker
845
435
 
846
436
  ```javascript
847
437
  sock.sendMessage(jid, {
848
- sticker: {
849
- url: './path/to/sticker.webp'
850
- }
851
- }, {
852
- quoted: message
853
- })
438
+ sticker: { url: './path/to/sticker.webp' }
439
+ }, { quoted: message })
854
440
  ```
855
441
 
856
- #### ๐Ÿ’ฝ Audio
442
+ ### ๐Ÿ’ฝ Audio
857
443
 
858
444
  ```javascript
859
445
  sock.sendMessage(jid, {
860
- audio: {
861
- url: './path/to/audio.mp3'
862
- },
863
- ptt: false // --- Set true if you want to send audio as Voice Note
864
- }, {
865
- quoted: message
866
- })
446
+ audio: { url: './path/to/audio.mp3' },
447
+ ptt: false // true untuk Voice Note
448
+ }, { quoted: message })
867
449
  ```
868
450
 
869
- #### ๐Ÿ—‚๏ธ Document
451
+ ### ๐Ÿ—‚๏ธ Document
870
452
 
871
453
  ```javascript
872
454
  sock.sendMessage(jid, {
873
- document: {
874
- url: './path/to/document.pdf'
875
- },
455
+ document: { url: './path/to/file.pdf' },
876
456
  mimetype: 'application/pdf',
877
- caption: 'โœจ My work!'
878
- }, {
879
- quoted: message
880
- })
457
+ caption: '๐Ÿ“„ Dokumen'
458
+ }, { quoted: message })
881
459
  ```
882
460
 
883
- #### ๐Ÿ–ผ๏ธ Album (Image & Video)
461
+ ### ๐Ÿ–ผ๏ธ Album (Image & Video)
884
462
 
885
463
  ```javascript
886
464
  sock.sendMessage(jid, {
887
- album: [{
888
- image: {
889
- url: './path/to/image.jpg'
890
- },
891
- caption: '1st image'
892
- }, {
893
- video: {
894
- url: './path/to/video.mp4'
895
- },
896
- caption: '1st video'
897
- }, {
898
- image: {
899
- url: './path/to/image.jpg'
900
- },
901
- caption: '2nd image'
902
- }, {
903
- video: {
904
- url: './path/to/video.mp4'
905
- },
906
- caption: '2nd video'
907
- }]
908
- }, {
909
- quoted: message
910
- })
465
+ album: [
466
+ { image: { url: './img1.jpg' }, caption: 'Foto 1' },
467
+ { video: { url: './vid1.mp4' }, caption: 'Video 1' },
468
+ { image: { url: './img2.jpg' }, caption: 'Foto 2' }
469
+ ]
470
+ }, { quoted: message })
911
471
  ```
912
472
 
913
- #### ๐Ÿ“ฆ Sticker Pack
473
+ ### ๐Ÿ“ฆ Sticker Pack
914
474
 
915
475
  > [!IMPORTANT]
916
- > If `sharp` or `@napi-rs/image` is not installed, the `cover` and `stickers` must already be in WebP format.
476
+ > Jika `sharp` atau `@napi-rs/image` tidak terinstall, `cover` dan `stickers` harus sudah dalam format WebP.
917
477
 
918
478
  ```javascript
919
479
  sock.sendMessage(jid, {
920
- cover: {
921
- url: './path/to/image.webp'
922
- },
923
- stickers: [{
924
- data: {
925
- url: './path/to/image.webp'
926
- }
927
- }, {
928
- data: {
929
- url: './path/to/image.webp'
930
- }
931
- }, {
932
- data: {
933
- url: './path/to/image.webp'
934
- }
935
- }],
936
- name: '๐Ÿ“ฆ My Sticker Pack',
937
- publisher: '๐ŸŒŸ kaels',
480
+ cover: { url: './cover.webp' },
481
+ stickers: [
482
+ { data: { url: './sticker1.webp' } },
483
+ { data: { url: './sticker2.webp' } }
484
+ ],
485
+ name: '๐Ÿ“ฆ Sticker Pack Keren',
486
+ publisher: 'Kaelz',
938
487
  description: '@kaels/casileys'
939
- }, {
940
- quoted: message
941
- })
488
+ }, { quoted: message })
942
489
  ```
943
490
 
944
- ### ๐Ÿ‘‰๐Ÿป Sending Interactive Messages
491
+ ---
492
+
493
+ ## ๐Ÿ‘‰๐Ÿป Sending Interactive Messages
945
494
 
946
- #### ๐Ÿ”˜ Buttons
495
+ ### ๐Ÿ”˜ Buttons
947
496
 
948
497
  ```javascript
949
- // --- Regular buttons message
498
+ // Button teks biasa
950
499
  sock.sendMessage(jid, {
951
- text: '๐Ÿ‘†๐Ÿป Buttons!',
500
+ text: '๐Ÿ‘†๐Ÿป Pilih salah satu!',
952
501
  footer: '@kaels/casileys',
953
- buttons: [{
954
- text: '๐Ÿ‘‹๐Ÿป SignUp',
955
- id: '#SignUp'
956
- }]
957
- }, {
958
- quoted: message
959
- })
502
+ buttons: [{ text: '๐Ÿ‘‹๐Ÿป Halo', id: '#Halo' }]
503
+ }, { quoted: message })
960
504
 
961
- // --- Buttons with Media & Native Flow
505
+ // Button dengan media & native flow
962
506
  sock.sendMessage(jid, {
963
- image: {
964
- url: './path/to/image.jpg'
965
- },
966
- caption: '๐Ÿ‘†๐Ÿป Buttons and Native Flow!',
507
+ image: { url: './path/to/image.jpg' },
508
+ caption: '๐Ÿ‘†๐Ÿป Button + List!',
967
509
  footer: '@kaels/casileys',
968
510
  buttons: [{
969
- text: '๐Ÿ‘‹๐Ÿป Rating',
970
- id: '#Rating'
971
- }, {
972
- text: '๐Ÿ“‹ Select',
511
+ text: '๐Ÿ“‹ Pilih',
973
512
  sections: [{
974
513
  title: 'โœจ Section 1',
975
- rows: [{
976
- header: '',
977
- title: '๐Ÿ’ญ Secret Ingredient',
978
- description: '',
979
- id: '#SecretIngredient'
980
- }]
981
- }, {
982
- title: 'โœจ Section 2',
983
- highlight_label: '๐Ÿ”ฅ Popular',
984
- rows: [{
985
- header: '',
986
- title: '๐Ÿท๏ธ Coupon',
987
- description: '',
988
- id: '#CouponCode'
989
- }]
514
+ rows: [{ title: '๐Ÿท๏ธ Opsi A', description: '', id: '#OpsiA' }]
990
515
  }]
991
516
  }]
992
- }, {
993
- quoted: message
994
- })
517
+ }, { quoted: message })
995
518
  ```
996
519
 
997
- #### ๐Ÿ“‹ List
520
+ ### ๐Ÿ“‹ List
998
521
 
999
522
  > [!NOTE]
1000
- > It only works in private chat (`@s.whatsapp.net`).
523
+ > Hanya berfungsi di private chat (`@s.whatsapp.net`).
1001
524
 
1002
525
  ```javascript
1003
526
  sock.sendMessage(jid, {
1004
- text: '๐Ÿ“‹ List!',
527
+ text: '๐Ÿ“‹ Pilih menu!',
1005
528
  footer: '@kaels/casileys',
1006
- buttonText: '๐Ÿ“‹ Select',
1007
- title: '๐Ÿ‘‹๐Ÿป Hello',
529
+ buttonText: '๐Ÿ“‹ Buka Menu',
530
+ title: '๐Ÿ‘‹๐Ÿป Menu Bot',
1008
531
  sections: [{
1009
- title: '๐Ÿš€ Menu 1',
1010
- rows: [{
1011
- title: 'โœจ AI',
1012
- description: '',
1013
- rowId: '#AI'
1014
- }]
1015
- }, {
1016
- title: '๐ŸŒฑ Menu 2',
1017
- rows: [{
1018
- title: '๐Ÿ” Search',
1019
- description: '',
1020
- rowId: '#Search'
1021
- }]
532
+ title: '๐Ÿš€ Kategori 1',
533
+ rows: [{ title: 'โœจ Fitur A', description: 'Deskripsi singkat', rowId: '#FiturA' }]
1022
534
  }]
1023
- }, {
1024
- quoted: message
1025
- })
535
+ }, { quoted: message })
1026
536
  ```
1027
537
 
1028
- #### ๐Ÿ—„๏ธ Interactive
538
+ ### ๐Ÿ—„๏ธ Interactive (Native Flow)
1029
539
 
1030
540
  ```javascript
1031
- // --- Native Flow
541
+ // Native flow dengan berbagai tipe button
1032
542
  sock.sendMessage(jid, {
1033
- image: {
1034
- url: './path/to/image.jpg'
1035
- },
1036
- caption: '๐Ÿ—„๏ธ๏ธ Interactive!',
543
+ image: { url: './path/to/image.jpg' },
544
+ caption: '๐Ÿ—„๏ธ Interactive Menu!',
1037
545
  footer: '@kaels/casileys',
1038
- optionText: '๐Ÿ‘‰๐Ÿป Select Options', // --- Optional, wrap all native flow into a single list
1039
- optionTitle: '๐Ÿ“„ Select Options', // --- Optional
1040
- offerText: '๐Ÿท๏ธ Newest Coupon!', // --- Optional, add an offer into message
1041
- offerCode: '@kaels/casileys', // --- Optional
1042
- offerUrl: 'https://www.npmjs.com/package/@kaels/casileys', // --- Optional
1043
- offerExpiration: Date.now() + 3_600_000, // --- Optional
1044
- nativeFlow: [{
1045
- text: '๐Ÿ‘‹๐Ÿป Greeting',
1046
- id: '#Greeting',
1047
- icon: 'review' // --- Optional
1048
- }, {
1049
- text: '๐Ÿ“ž Call',
1050
- call: '628123456789'
1051
- }, {
1052
- text: '๐Ÿ“‹ Copy',
1053
- copy: '@kaels/casileys'
1054
- }, {
1055
- text: '๐ŸŒ Source',
1056
- url: 'https://www.npmjs.com/package/@kaels/casileys',
1057
- useWebview: true // --- Optional
1058
- }, {
1059
- text: '๐Ÿ“‹ Select',
1060
- sections: [{
1061
- title: 'โœจ Section 1',
1062
- rows: [{
1063
- header: '',
1064
- title: '๐Ÿท๏ธ Coupon',
1065
- description: '',
1066
- id: '#CouponCode'
1067
- }]
1068
- }, {
1069
- title: 'โœจ Section 2',
1070
- highlight_label: '๐Ÿ”ฅ Popular',
1071
- rows: [{
1072
- header: '',
1073
- title: '๐Ÿ’ญ Secret Ingredient',
1074
- description: '',
1075
- id: '#SecretIngredient'
1076
- }]
1077
- }],
1078
- icon: 'default' // --- Optional
1079
- }],
1080
- interactiveAsTemplate: false, // --- Optional, wrap the interactive message into a template
1081
- }, {
1082
- quoted: message
1083
- })
546
+ optionText: '๐Ÿ‘‰๐Ÿป Pilih Opsi', // optional, wrap semua jadi satu list
547
+ optionTitle: '๐Ÿ“„ Opsi Tersedia', // optional
548
+ nativeFlow: [
549
+ { text: '๐Ÿ‘‹๐Ÿป Greeting', id: '#Greeting', icon: 'review' },
550
+ { text: '๐Ÿ“ž Telepon', call: '628123456789' },
551
+ { text: '๐Ÿ“‹ Copy', copy: '@kaels/casileys' },
552
+ { text: '๐ŸŒ Buka Web', url: 'https://www.npmjs.com/package/@kaels/casileys', useWebview: true },
553
+ {
554
+ text: '๐Ÿ“‹ Pilih dari List',
555
+ sections: [{
556
+ title: 'โœจ Pilihan',
557
+ rows: [{ title: '๐Ÿท๏ธ Opsi 1', description: '', id: '#Opsi1' }]
558
+ }],
559
+ icon: 'default'
560
+ }
561
+ ]
562
+ }, { quoted: message })
1084
563
 
1085
- // --- Carousel & Native Flow
564
+ // Carousel
1086
565
  sock.sendMessage(jid, {
1087
- text: '๐Ÿ—‚๏ธ Interactive with Carousel!',
566
+ text: '๐ŸŽ  Carousel!',
1088
567
  footer: '@kaels/casileys',
1089
568
  cards: [{
1090
- image: {
1091
- url: './path/to/image.jpg'
1092
- },
1093
- caption: '๐Ÿ–ผ๏ธ Image 1',
1094
- footer: '๐Ÿท๏ธ๏ธ Pinterest',
1095
- nativeFlow: [{
1096
- text: '๐ŸŒ Source',
1097
- url: 'https://www.npmjs.com/package/@kaels/casileys',
1098
- useWebview: true
1099
- }]
1100
- }, {
1101
- image: {
1102
- url: './path/to/image.jpg'
1103
- },
1104
- caption: '๐Ÿ–ผ๏ธ Image 2',
1105
- footer: '๐Ÿท๏ธ Pinterest',
1106
- offerText: '๐Ÿท๏ธ New Coupon!',
1107
- offerCode: '@kaels/casileys',
1108
- offerUrl: 'https://www.npmjs.com/package/@kaels/casileys',
1109
- offerExpiration: Date.now() + 3_600_000,
1110
- nativeFlow: [{
1111
- text: '๐ŸŒ Source',
1112
- url: 'https://www.npmjs.com/package/@kaels/casileys'
1113
- }]
569
+ image: { url: './img1.jpg' },
570
+ caption: '๐Ÿ–ผ๏ธ Slide 1',
571
+ footer: '๐Ÿ“ธ Caption',
572
+ nativeFlow: [{ text: '๐ŸŒ Detail', url: 'https://npmjs.com', useWebview: true }]
1114
573
  }, {
1115
- image: {
1116
- url: './path/to/image.jpg'
1117
- },
1118
- caption: '๐Ÿ–ผ๏ธ Image 3',
1119
- footer: '๐Ÿท๏ธ Pinterest',
1120
- optionText: '๐Ÿ‘‰๐Ÿป Select Options',
1121
- optionTitle: '๐Ÿ‘‰๐Ÿป Select Options',
1122
- offerText: '๐Ÿท๏ธ New Coupon!',
1123
- offerCode: '@kaels/casileys',
1124
- offerUrl: 'https://www.npmjs.com/package/@kaels/casileys',
1125
- offerExpiration: Date.now() + 3_600_000,
1126
- nativeFlow: [{
1127
- text: '๐Ÿ›’ Product',
1128
- id: '#Product',
1129
- icon: 'default'
1130
- }, {
1131
- text: '๐ŸŒ Source',
1132
- url: 'https://www.npmjs.com/package/@kaels/casileys'
1133
- }]
574
+ image: { url: './img2.jpg' },
575
+ caption: '๐Ÿ–ผ๏ธ Slide 2',
576
+ footer: '๐Ÿ“ธ Caption',
577
+ nativeFlow: [{ text: '๐Ÿ‘ Pilih', id: '#Pilih2' }]
1134
578
  }]
1135
- }, {
1136
- quoted: message
1137
- })
579
+ }, { quoted: message })
1138
580
 
1139
- // --- Native Flow with Audio in the Footer
581
+ // Native Flow dengan audio footer
1140
582
  sock.sendMessage(jid, {
1141
- text: '๐Ÿ”ˆ Music in the footer!',
1142
- audioFooter: {
1143
- url: './path/to/audio.mp3'
1144
- }, // --- Like other media upload methods, buffers and streams are supported
1145
- nativeFlow: [{
1146
- text: '๐Ÿ‘๐Ÿป Good, next',
1147
- id: '#Next',
1148
- icon: 'review'
1149
- }, {
1150
- text: '๐Ÿ‘Ž๐Ÿป Skip',
1151
- id: '#Skip',
1152
- icon: 'default'
1153
- }]
1154
- }, {
1155
- quoted: message
1156
- })
583
+ text: '๐ŸŽต Dengarkan dulu!',
584
+ audioFooter: { url: './audio.mp3' },
585
+ nativeFlow: [
586
+ { text: '๐Ÿ‘๐Ÿป Lanjut', id: '#Next', icon: 'review' },
587
+ { text: '๐Ÿ‘Ž๐Ÿป Skip', id: '#Skip', icon: 'default' }
588
+ ]
589
+ }, { quoted: message })
1157
590
  ```
1158
591
 
1159
- #### ๐Ÿซ™ Hydrated Template
592
+ ### ๐Ÿซ™ Hydrated Template
1160
593
 
1161
594
  ```javascript
1162
595
  sock.sendMessage(jid, {
1163
- title: '๐Ÿ‘‹๐Ÿป Hello',
1164
- image: {
1165
- url: './path/to/image.jpg'
1166
- },
1167
- caption: '๐Ÿซ™ Template!',
596
+ title: '๐Ÿ‘‹๐Ÿป Halo!',
597
+ image: { url: './path/to/image.jpg' },
598
+ caption: '๐Ÿซ™ Template Message',
1168
599
  footer: '@kaels/casileys',
1169
- templateButtons: [{
1170
- text: '๐Ÿ‘‰๐Ÿป Tap Here',
1171
- id: '#Order'
1172
- }, {
1173
- text: '๐ŸŒ Source',
1174
- url: 'https://www.npmjs.com/package/@kaels/casileys'
1175
- }, {
1176
- text: '๐Ÿ“ž Call',
1177
- call: '628123456789'
1178
- }]
1179
- }, {
1180
- quoted: message
1181
- })
600
+ templateButtons: [
601
+ { text: '๐Ÿ‘‰๐Ÿป Klik Sini', id: '#Klik' },
602
+ { text: '๐ŸŒ Website', url: 'https://www.npmjs.com/package/@kaels/casileys' },
603
+ { text: '๐Ÿ“ž Hubungi', call: '628123456789' }
604
+ ]
605
+ }, { quoted: message })
1182
606
  ```
1183
607
 
1184
- ### ๐Ÿ’ณ Sending Payment Messages
608
+ ---
1185
609
 
1186
- #### โž• Invite Payment
610
+ ## ๐Ÿ’ณ Sending Payment Messages
1187
611
 
1188
612
  ```javascript
1189
- sock.sendMessage(jid, {
1190
- paymentInviteServiceType: 3 // 1, 2, or 3
1191
- })
1192
- ```
613
+ // Invite payment
614
+ sock.sendMessage(jid, { paymentInviteServiceType: 3 }) // 1, 2, atau 3
1193
615
 
1194
- #### ๐Ÿงพ Invoice
1195
-
1196
- > [!NOTE]
1197
- > Invoice message are not supported yet.
1198
-
1199
- ```javascript
616
+ // Order
1200
617
  sock.sendMessage(jid, {
1201
- image: {
1202
- url: './path/to/image.jpg'
1203
- },
1204
- invoiceNote: '๐Ÿท๏ธ Invoice'
1205
- })
1206
- ```
1207
-
1208
- #### ๐Ÿ›๏ธ Order
1209
-
1210
- ```javascript
1211
- sock.sendMessage(chat, {
1212
- orderText: '๐Ÿ›๏ธ Order',
1213
- thumbnail: fs.readFileSync('./path/to/image.jpg') // --- Must in buffer format
1214
- }, {
1215
- quoted: message
1216
- })
1217
- ```
618
+ orderText: '๐Ÿ›๏ธ Pesanan Kamu',
619
+ thumbnail: fs.readFileSync('./thumbnail.jpg')
620
+ }, { quoted: message })
1218
621
 
1219
- #### ๐Ÿ’ณ Request Payment
1220
-
1221
- ```javascript
622
+ // Request payment
1222
623
  sock.sendMessage(jid, {
1223
- text: '๐Ÿ’ณ Request Payment',
624
+ text: '๐Ÿ’ณ Minta Pembayaran',
1224
625
  requestPaymentFrom: '0@s.whatsapp.net'
1225
626
  })
1226
627
  ```
1227
628
 
1228
- ### ๐Ÿ‘๏ธ Other Message Options
1229
-
1230
- #### ๐Ÿค– AI Icon
1231
-
1232
- > [!NOTE]
1233
- > It only works in private chat (`@s.whatsapp.net`).
1234
-
1235
- ```javascript
1236
- sock.sendMessage(jid, {
1237
- image: {
1238
- url: './path/to/image.jpg'
1239
- },
1240
- caption: '๐Ÿค– With AI icon!',
1241
- ai: true
1242
- }, {
1243
- quoted: message
1244
- })
1245
- ```
629
+ ---
1246
630
 
1247
- #### ๐Ÿ•’ Ephemeral
631
+ ## ๐Ÿ‘๏ธ Other Message Options
1248
632
 
1249
- > [!NOTE]
1250
- > Wrap message into `ephemeralMessage`
633
+ | Flag | Keterangan |
634
+ |---|---|
635
+ | `ai: true` | Tambah ikon AI (private chat only) |
636
+ | `ephemeral: true` | Wrap ke `ephemeralMessage` |
637
+ | `viewOnce: true` | View once (V1) |
638
+ | `viewOnceV2: true` | View once (V2) |
639
+ | `spoiler: true` | Wrap ke `spoilerMessage` |
640
+ | `groupStatus: true` | Group status (grup only) |
641
+ | `isLottie: true` | Lottie sticker |
642
+ | `mentionAll: true` | Mention semua member grup |
643
+ | `interactiveAsTemplate: true` | Wrap interactive ke template |
644
+ | `raw: true` | Kirim struktur proto manual |
1251
645
 
1252
646
  ```javascript
647
+ // Contoh: view once + spoiler
1253
648
  sock.sendMessage(jid, {
1254
- image: {
1255
- url: './path/to/image.jpg'
1256
- },
1257
- caption: '๐Ÿ‘๏ธ Ephemeral',
1258
- ephemeral: true
1259
- })
1260
- ```
1261
-
1262
- #### ๐Ÿ“ฐ External Ad Reply
1263
-
1264
- > [!NOTE]
1265
- > Add an ad thumbnail to messages (may not be displayed on some WhatsApp versions).
649
+ image: { url: './image.jpg' },
650
+ caption: '๐Ÿ‘๏ธ Lihat sekali aja!',
651
+ viewOnceV2: true
652
+ }, { quoted: message })
1266
653
 
1267
- ```javascript
654
+ // External Ad Reply
1268
655
  sock.sendMessage(jid, {
1269
- text: '๐Ÿ“ฐ External Ad Reply',
656
+ text: '๐Ÿ“ฐ Info Penting!',
1270
657
  externalAdReply: {
1271
- title: '๐Ÿ“ Did you know?',
1272
- body: 'โ“ I dont know',
1273
- thumbnail: fs.readFileSync('./path/to/image.jpg'), // --- Must in buffer format
1274
- largeThumbnail: false, // --- Or true for bigger thumbnail
1275
- url: 'https://www.npmjs.com/package/@kaels/casileys' // --- Optional, used for WhatsApp internal thumbnail caching and direct URL
658
+ title: '๐Ÿ“ Tahukah kamu?',
659
+ body: 'Fakta menarik hari ini',
660
+ thumbnail: fs.readFileSync('./thumbnail.jpg'),
661
+ largeThumbnail: false,
662
+ url: 'https://www.npmjs.com/package/@kaels/casileys'
1276
663
  }
1277
- }, {
1278
- quoted: message
1279
- })
664
+ }, { quoted: message })
1280
665
  ```
1281
666
 
1282
- #### ๐Ÿง‘โ€๐Ÿง‘โ€๐Ÿง’ Group Status
667
+ ---
1283
668
 
1284
- > [!NOTE]
1285
- > It only works in group chat (`@g.us`)
669
+ ## โ™ป๏ธ Modify Messages
1286
670
 
1287
671
  ```javascript
1288
- sock.sendMessage(jid, {
1289
- image: {
1290
- url: './path/to/image.jpg'
1291
- },
1292
- caption: '๐Ÿ‘ฅ Group Status!',
1293
- groupStatus: true
1294
- })
1295
- ```
672
+ // Hapus pesan
673
+ sock.sendMessage(jid, { delete: message.key })
1296
674
 
1297
- #### ๐Ÿฑ Lottie Sticker
675
+ // Edit teks
676
+ sock.sendMessage(jid, { text: 'โœ๏ธ Teks yang sudah diedit', edit: message.key })
1298
677
 
1299
- > [!NOTE]
1300
- > Wrap message into `lottieStickerMessage`
1301
-
1302
- ```javascript
1303
- sock.sendMessage(jid, {
1304
- sticker: {
1305
- url: './path/to/sticker.webp'
1306
- },
1307
- isLottie: true
1308
- })
678
+ // Edit caption media
679
+ sock.sendMessage(jid, { caption: 'โœ๏ธ Caption baru', edit: message.key })
1309
680
  ```
1310
681
 
1311
- #### ๐Ÿงฉ Raw
682
+ ---
1312
683
 
1313
- ```javascript
1314
- sock.sendMessage(jid, {
1315
- extendedTextMessage: {
1316
- text: '๐Ÿ“ƒ Built manually from scratch using the raw WhatsApp proto structure',
1317
- contextInfo: {
1318
- externalAdReply: {
1319
- title: '@kaels/casileys',
1320
- thumbnail: fs.readFileSync('./path/to/image.jpg'),
1321
- sourceApp: 'whatsapp',
1322
- showAdAttribution: true,
1323
- mediaType: 1
1324
- }
1325
- }
1326
- },
1327
- raw: true
1328
- }, {
1329
- quoted: message
1330
- })
1331
- ```
1332
-
1333
- #### ๐Ÿท๏ธ Secure Meta Service Label
1334
-
1335
- ```javascript
1336
- sock.sendMessage(jid, {
1337
- text: '๐Ÿท๏ธ Just a label!',
1338
- secureMetaServiceLabel: true
1339
- })
1340
- ```
684
+ ## ๐Ÿงฐ Additional Contents
1341
685
 
1342
- #### ๐Ÿ“‘ Spoiler
686
+ ### ๐Ÿท๏ธ Find User ID (JID | PN / LID)
1343
687
 
1344
688
  > [!NOTE]
1345
- > Wrap message into `spoilerMessage`
689
+ > ID harus berupa angka saja (tanpa +, (), atau -) dan menyertakan kode negara.
1346
690
 
1347
691
  ```javascript
1348
- sock.sendMessage(jid, {
1349
- image: {
1350
- url: './path/to/image.jpg'
1351
- },
1352
- caption: 'โ” Spoiler',
1353
- spoiler: true
1354
- })
692
+ const ids = await sock.findUserId('6281111111111@s.whatsapp.net')
693
+ console.log(ids)
694
+ // Output: { phoneNumber: '6281111111111@s.whatsapp.net', lid: '43411111111111@lid' }
1355
695
  ```
1356
696
 
1357
- #### ๐Ÿ‘๏ธ View Once
1358
-
1359
- > [!NOTE]
1360
- > Wrap message into `viewOnceMessage`
697
+ ### ๐Ÿ”‘ Request Custom Pairing Code
1361
698
 
1362
699
  ```javascript
1363
- sock.sendMessage(jid, {
1364
- image: {
1365
- url: './path/to/image.jpg'
1366
- },
1367
- caption: '๐Ÿ‘๏ธ View Once',
1368
- viewOnce: true
1369
- })
700
+ const code = await sock.requestPairingCode('6281111111111', 'KAELZBASE')
701
+ console.log('๐Ÿ”— Pairing code:', code)
1370
702
  ```
1371
703
 
1372
- #### ๐Ÿ‘๏ธ View Once V2
704
+ ### ๐Ÿ–ผ๏ธ Image Processing
1373
705
 
1374
706
  > [!NOTE]
1375
- > Wrap message into `viewOnceMessageV2`
1376
-
1377
- ```javascript
1378
- sock.sendMessage(jid, {
1379
- image: {
1380
- url: './path/to/image.jpg'
1381
- },
1382
- caption: '๐Ÿ‘๏ธ View Once V2',
1383
- viewOnceV2: true
1384
- })
1385
- ```
1386
-
1387
- #### ๐Ÿ‘๏ธ View Once V2 Extension
1388
-
1389
- > [!NOTE]
1390
- > Wrap message into `viewOnceMessageV2Extension`
1391
-
1392
- ```javascript
1393
- sock.sendMessage(jid, {
1394
- image: {
1395
- url: './path/to/image.jpg'
1396
- },
1397
- caption: '๐Ÿ‘๏ธ View Once V2 Extension',
1398
- viewOnceV2Extension: true
1399
- })
1400
- ```
1401
-
1402
- ### โ™ป๏ธ Modify Messages
1403
-
1404
- #### ๐Ÿ—‘๏ธ Delete Messages
1405
-
1406
- ```javascript
1407
- sock.sendMessage(jid, {
1408
- delete: message.key
1409
- })
1410
- ```
1411
-
1412
- #### โœ๏ธ Edit Messages
1413
-
1414
- ```javascript
1415
- // --- Edit plain text
1416
- sock.sendMessage(jid, {
1417
- text: 'โœจ I mean, nice!',
1418
- edit: message.key
1419
- })
1420
-
1421
- // --- Edit media messages caption
1422
- sock.sendMessage(jid, {
1423
- caption: 'โœจ I mean, here is the image!',
1424
- edit: message.key
1425
- })
1426
- ```
1427
-
1428
- ### ๐Ÿงฐ Additional Contents
1429
-
1430
- #### ๐Ÿท๏ธ Find User ID (JID|PN/LID)
1431
-
1432
- > [!NOTE]
1433
- > The ID must contain numbers only (no +, (), or -) and must include the country code with WhatsApp ID format.
1434
-
1435
- ```javascript
1436
- // --- PN (Phone Number)
1437
- const phoneNumber = '6281111111111@s.whatsapp.net'
1438
-
1439
- const ids = await sock.findUserId(phoneNumber)
1440
-
1441
- console.log('๐Ÿท๏ธ Got user ID', ':', ids)
1442
-
1443
- // --- LID (Local Identifier)
1444
- const lid = '43411111111111@lid'
1445
-
1446
- const ids = await sock.findUserId(lid)
1447
-
1448
- console.log('๐Ÿท๏ธ Got user ID', ':', ids)
1449
-
1450
- // --- Output
1451
- // {
1452
- // phoneNumber: '6281111111111@s.whatsapp.net',
1453
- // lid: '43411111111111@lid'
1454
- // }
1455
- // --- Output when failed
1456
- // {
1457
- // phoneNumber: '6281111111111@s.whatsapp.net',
1458
- // lid: undefined
1459
- // }
1460
- // --- Same output shape regardless of input type
1461
- ```
1462
-
1463
- #### ๐Ÿ”‘ Request Custom Pairing Code
1464
-
1465
- > [!NOTE]
1466
- > The phone number must contain numbers only (no +, (), or -) and must include the country code.
1467
-
1468
- ```javascript
1469
- const phoneNumber = '6281111111111'
1470
- const customPairingCode = 'STARFALL'
1471
-
1472
- await sock.requestPairingCode(phoneNumber, customPairingCode)
1473
-
1474
- console.log('๐Ÿ”— Pairing code', ':', customPairingCode)
1475
- ```
1476
-
1477
- #### ๐Ÿ–ผ๏ธ Image Processing
1478
-
1479
- > [!NOTE]
1480
- > Automatically use available image processing library: `sharp`, `@napi-rs/image`, or `jimp`
707
+ > Otomatis menggunakan library yang tersedia: `sharp`, `@napi-rs/image`, atau `jimp`.
1481
708
 
1482
709
  ```javascript
1483
710
  import { getImageProcessingLibrary } from '@kaels/casileys'
1484
- import { readFile } from 'fs/promises'
1485
711
 
1486
712
  const lib = await getImageProcessingLibrary()
1487
713
 
1488
- const bufferOrFilePath = './path/to/image.jpg'
1489
- const width = 512
1490
-
1491
- let output
1492
-
1493
- // --- If sharp installed
714
+ // Jika sharp tersedia
1494
715
  if (lib.sharp?.default) {
1495
- const img = lib.sharp.default(bufferOrFilePath)
1496
-
1497
- output = await img.resize(width)
716
+ const output = await lib.sharp.default('./image.jpg')
717
+ .resize(512)
1498
718
  .jpeg({ quality: 80 })
1499
719
  .toBuffer()
1500
720
  }
1501
-
1502
- // --- If @napi-rs/image installed
1503
- else if (lib.image?.Transformer) {
1504
- // --- Must in buffer format
1505
- const inputBuffer = Buffer.isBuffer(bufferOrFilePath)
1506
- ? bufferOrFilePath
1507
- : await readFile(bufferOrFilePath)
1508
-
1509
- const img = new lib.image.Transformer(inputBuffer)
1510
-
1511
- output = await img.resize(width, undefined, 0)
1512
- .jpeg(50)
1513
- }
1514
-
1515
- // --- If jimp installed
1516
- else if (lib.jimp?.Jimp) {
1517
- const img = await lib.jimp.Jimp.read(bufferOrFilePath)
1518
-
1519
- output = await img
1520
- .resize({ w: width, mode: lib.jimp.ResizeStrategy.BILINEAR })
1521
- .getBuffer('image/jpeg', { quality: 50 })
1522
- }
1523
-
1524
- // --- Fallback
1525
- else {
1526
- throw new Error('No image processing available')
1527
- }
1528
-
1529
- console.log('โœ… Process completed!')
1530
- console.dir(output, { depth: null })
1531
- ```
1532
-
1533
- #### ๐Ÿ“ฃ Newsletter Management
1534
-
1535
- ```javascript
1536
- // --- Create a new one
1537
- sock.newsletterCreate('@kaels/casileys', '๐Ÿ“ฃ Fresh updates weekly')
1538
-
1539
- // --- Get info
1540
- const metadata = sock.newsletterMetadata('1231111111111@newsletter')
1541
- console.dir(metadata, { depth: null })
1542
-
1543
- // --- Get subscribers count
1544
- const subscribers = await sock.newsletterSubscribers('1231111111111@newsletter')
1545
- console.dir(subscribers, { depth: null })
1546
-
1547
- // --- Follow and Unfollow
1548
- sock.newsletterFollow('1231111111111@newsletter')
1549
- sock.newsletterUnfollow('1231111111111@newsletter')
1550
-
1551
- // --- Mute and Unmute
1552
- sock.newsletterMute('1231111111111@newsletter')
1553
- sock.newsletterUnmute('1231111111111@newsletter')
1554
-
1555
- // --- Demote admin
1556
- sock.newsletterDemote('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
1557
-
1558
- // --- Change owner
1559
- sock.newsletterChangeOwner('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
1560
-
1561
- // --- Update newsletter
1562
- sock.newsletterUpdate('1231111111111@newsletter', { name: '@kaels/casileys' })
1563
-
1564
- // --- Change name
1565
- sock.newsletterUpdateName('1231111111111@newsletter', '๐Ÿ“ฆ @kaels/casileys')
1566
-
1567
- // --- Change description
1568
- sock.newsletterUpdateDescription('1231111111111@newsletter', '๐Ÿ“ฃ Fresh updates weekly')
1569
-
1570
- // --- Change photo
1571
- sock.newsletterUpdatePicture('1231111111111@newsletter', {
1572
- url: 'path/to/image.jpg'
1573
- })
1574
-
1575
- // --- Remove photo
1576
- sock.newsletterRemovePicture('1231111111111@newsletter')
1577
-
1578
- // --- React to a message
1579
- sock.newsletterReactMessage('1231111111111@newsletter', '100', '๐Ÿ’›')
1580
-
1581
- // --- Get admin count
1582
- const count = await sock.newsletterAdminCount('1231111111111@newsletter')
1583
-
1584
- // --- Get all subscribed newsletters
1585
- const newsletters = await sock.newsletterSubscribed()
1586
- console.dir(newsletters, { depth: null })
1587
-
1588
- // --- Fetch newsletter messages
1589
- const messages = sock.newsletterFetchMessages('jid', '1231111111111@newsletter', 50, 0, 0)
1590
- console.dir(messages, { depth: null })
1591
-
1592
- // --- Delete newsletter
1593
- sock.newsletterDelete('1231111111111@newsletter')
1594
721
  ```
1595
722
 
1596
- #### ๐Ÿ‘ฅ Group Management
723
+ ### ๐Ÿ‘ฅ Group Management
1597
724
 
1598
725
  ```javascript
1599
- // --- Create a new one and add participants using their JIDs
1600
- const group = sock.groupCreate('@kaels/casileys', ['628123456789@s.whatsapp.net'])
1601
- console.dir(group, { depth: null })
726
+ // Buat grup
727
+ const group = await sock.groupCreate('Nama Grup', ['628xxx@s.whatsapp.net'])
1602
728
 
1603
- // --- Get info
729
+ // Metadata
1604
730
  const metadata = await sock.groupMetadata(jid)
1605
- console.dir(metadata, { depth: null })
1606
731
 
1607
- // --- Get group invite code
732
+ // Kelola member
733
+ sock.groupParticipantsUpdate(jid, ['628xxx@s.whatsapp.net'], 'add') // tambah
734
+ sock.groupParticipantsUpdate(jid, ['628xxx@s.whatsapp.net'], 'remove') // kick
735
+ sock.groupParticipantsUpdate(jid, ['628xxx@s.whatsapp.net'], 'promote') // jadikan admin
736
+ sock.groupParticipantsUpdate(jid, ['628xxx@s.whatsapp.net'], 'demote') // copot admin
737
+
738
+ // Setting grup
739
+ sock.groupSettingUpdate(jid, 'announcement') // hanya admin bisa chat
740
+ sock.groupSettingUpdate(jid, 'not_announcement') // semua bisa chat
741
+ sock.groupSettingUpdate(jid, 'locked') // hanya admin edit info
742
+ sock.groupSettingUpdate(jid, 'unlocked') // semua bisa edit info
743
+ sock.groupToggleEphemeral(jid, 86400) // aktifkan pesan sementara
744
+ sock.groupJoinApprovalMode(jid, 'on') // aktifkan persetujuan member
745
+
746
+ // Invite
1608
747
  const inviteCode = await sock.groupInviteCode(jid)
1609
- console.dir(inviteCode, { depth: null })
1610
-
1611
-
1612
- // --- Revoke invite link
1613
748
  sock.groupRevokeInvite(jid)
1614
-
1615
- // --- Accept group invite
1616
749
  sock.groupAcceptInvite(inviteCode)
1617
-
1618
- // --- Leave group
1619
750
  sock.groupLeave(jid)
1620
-
1621
- // --- Add participants
1622
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'add')
1623
-
1624
- // --- Remove participants
1625
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'remove')
1626
-
1627
- // --- Promote to admin
1628
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'promote')
1629
-
1630
- // --- Demote from admin
1631
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'demote')
1632
-
1633
- // --- Accept join requests
1634
- sock.groupRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
1635
-
1636
- // --- Change name
1637
- sock.groupUpdateSubject(jid, '๐Ÿ“ฆ @kaels/casileys')
1638
-
1639
- // --- Change description
1640
- sock.groupUpdateDescription(jid, 'Updated description')
1641
-
1642
- // --- Change photo
1643
- sock.updateProfilePicture(jid, {
1644
- url: 'path/to/image.jpg'
1645
- })
1646
-
1647
- // --- Remove photo
1648
- sock.removeProfilePicture(jid)
1649
-
1650
- // --- Set group as admin only for chatting
1651
- sock.groupSettingUpdate(jid, 'announcement')
1652
-
1653
- // --- Set group as open to all for chatting
1654
- sock.groupSettingUpdate(jid, 'not_announcement')
1655
-
1656
- // --- Set admin only can edit group info
1657
- sock.groupSettingUpdate(jid, 'locked')
1658
-
1659
- // --- Set all participants can edit group info
1660
- sock.groupSettingUpdate(jid, 'unlocked')
1661
-
1662
- // --- Set admin only can add participants
1663
- sock.groupMemberAddMode(jid, 'admin_add')
1664
-
1665
- // --- Set all participants can add participants
1666
- sock.groupMemberAddMode(jid, 'all_member_add')
1667
-
1668
- // --- Enable or disable temporary messages with seconds format
1669
- sock.groupToggleEphemeral(jid, 86400)
1670
-
1671
- // --- Disable temporary messages
1672
- sock.groupToggleEphemeral(jid, 0)
1673
-
1674
- // --- Enable or disable membership approval mode
1675
- sock.groupJoinApprovalMode(jid, 'on')
1676
- sock.groupJoinApprovalMode(jid, 'off')
1677
-
1678
- // --- Get all groups metadata
1679
- const groups = await sock.groupFetchAllParticipating()
1680
- console.dir(groups, { depth: null })
1681
-
1682
- // --- Get pending join requests
1683
- const requests = await sock.groupRequestParticipantsList(jid)
1684
- console.dir(requests, { depth: null })
1685
-
1686
- // --- Get group info from link
1687
- const group = await sock.groupGetInviteInfo('ABC123456789')
1688
- console.log('๐Ÿ‘ฅ Got group info from invite code', ':', group)
1689
-
1690
- // --- Update bot member label
1691
- sock.updateMemberLabel(jid, '@kaels/casileys')
1692
751
  ```
1693
752
 
1694
- #### ๐Ÿ‘ฅ Community Management
753
+ ### ๐Ÿ‘ฅ Community Management
1695
754
 
1696
755
  ```javascript
1697
- // --- Create a new one and add description
1698
- const community = await sock.communityCreate('@kaels/casileys', '๐Ÿ“ฃ Fresh updates weekly')
1699
- console.dir(community, { depth: null })
1700
-
1701
- // --- Create a subgroup for community and add participants using their JIDs
1702
- const group = await sock.communityCreateGroup('๐Ÿ“ข Announcements', ['628123456789@s.whatsapp.net'], communityJid)
756
+ const community = await sock.communityCreate('Nama Komunitas', 'Deskripsi')
757
+ const group = await sock.communityCreateGroup('Announcements', ['628xxx@s.whatsapp.net'], communityJid)
1703
758
 
1704
- // --- Link an existing group
1705
759
  sock.communityLinkGroup(groupJid, communityJid)
1706
-
1707
- // --- Unlink an existing group
1708
760
  sock.communityUnlinkGroup(groupJid, communityJid)
1709
-
1710
- // --- Get info
1711
- const metadata = await sock.communityMetadata(jid)
1712
- console.dir(metadata, { depth: null })
1713
-
1714
- // --- Get community invite code
1715
- const inviteCode = await sock.communityInviteCode(jid)
1716
- console.dir(inviteCode, { depth: null })
1717
-
1718
- // --- Revoke invite link
1719
- sock.communityRevokeInvite(jid)
1720
-
1721
- // --- Accept community invite
1722
- sock.communityAcceptInvite(inviteCode)
1723
-
1724
- // --- Leave community
1725
761
  sock.communityLeave(jid)
1726
-
1727
- // --- Accept join requests
1728
- sock.communityRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
1729
-
1730
- // --- Change name
1731
- sock.communityUpdateSubject(jid, '๐Ÿ“ฆ @kaels/casileys')
1732
-
1733
- // --- Change description
1734
- sock.communityUpdateDescription(jid, 'Updated description')
1735
-
1736
- // --- Set community as admin only for chatting
1737
- sock.communitySettingUpdate(jid, 'announcement')
1738
-
1739
- // --- Set community as open to all for chatting
1740
- sock.communitySettingUpdate(jid, 'not_announcement')
1741
-
1742
- // --- Set admin only can edit community info
1743
- sock.communitySettingUpdate(jid, 'locked')
1744
-
1745
- // --- Set all participants can edit community info
1746
- sock.communitySettingUpdate(jid, 'unlocked')
1747
-
1748
- // --- Set admin only can add participants
1749
- sock.communityMemberAddMode(jid, 'admin_add')
1750
-
1751
- // --- Set all participants can add participants
1752
- sock.communityMemberAddMode(jid, 'all_member_add')
1753
-
1754
- // --- Enable or disable temporary messages with seconds format
1755
- sock.communityToggleEphemeral(jid, 86400)
1756
-
1757
- // --- Disable temporary messages
1758
- sock.communityToggleEphemeral(jid, 0)
1759
-
1760
- // --- Enable or disable membership approval mode
1761
- sock.communityJoinApprovalMode(jid, 'on')
1762
- sock.communityJoinApprovalMode(jid, 'off')
1763
-
1764
- // --- Get all communities metadata
1765
- const communities = await sock.communityFetchAllParticipating()
1766
- console.dir(communities, { depth: null })
1767
-
1768
- // --- Get all community linked groups
1769
- const linked = await sock.communityFetchLinkedGroups(jid)
1770
- console.dir(linked, { depth: null })
1771
-
1772
- // --- Get pending join requests
1773
- const requests = await sock.communityRequestParticipantsList(jid)
1774
- console.dir(requests, { depth: null })
1775
-
1776
- // --- Get community info from link
1777
- const community = await sock.communityGetInviteInfo('ABC123456789')
1778
- console.log('๐Ÿ‘ฅ Got community info from invite code', ':', community)
1779
762
  ```
1780
763
 
1781
- #### ๐Ÿ‘ค Profile Management
764
+ ### ๐Ÿ‘ค Profile Management
1782
765
 
1783
766
  ```javascript
1784
- // --- Get user profile picture
1785
- const url = await sock.profilePictureUrl(jid, 'image')
1786
- console.log('๐Ÿ–ผ๏ธ Got user profile url', url)
1787
-
1788
- // --- Update profile picture
1789
- sock.updateProfilePicture(jid, buffer)
1790
- sock.updateProfilePicture(jid, { url })
1791
-
1792
- // --- Remove profile picture
767
+ sock.updateProfilePicture(jid, { url: './photo.jpg' })
1793
768
  sock.removeProfilePicture(jid)
1794
-
1795
- // --- Update profile name
1796
- sock.updateProfileName('My Name')
1797
-
1798
- // --- Update profile status
1799
- sock.updateProfileStatus('Available')
1800
-
1801
- // --- Presence
769
+ sock.updateProfileName('Nama Baru')
770
+ sock.updateProfileStatus('Status baru')
1802
771
  sock.sendPresenceUpdate('available', jid)
1803
- sock.presenceSubscribe(jid)
1804
-
1805
- // --- Read receipts
1806
772
  sock.readMessages([message.key])
1807
- sock.sendReceipt(jid, participant, [messageId], 'read')
1808
-
1809
- // --- Block user
1810
- sock.updateBlockStatus(jid, 'block')
1811
-
1812
- // --- Unblock user
1813
- sock.updateBlockStatus(jid, 'unblock')
1814
-
1815
- // --- Fetch blocklist
1816
- const blocked = await sock.fetchBlocklist()
1817
- console.dir(blocked, { depth: null })
1818
-
1819
- // --- Modify chats
1820
- sock.chatModify({
1821
- archive: true,
1822
- lastMessageOrig: message,
1823
- lastMessage: message
1824
- }, jid)
1825
-
1826
- // --- Star messages
1827
- sock.star(jid, [{ id: messageId, fromMe: true }], true)
1828
-
1829
- // --- Contact
1830
- sock.addOrEditContact(jid, { displayName: 'Starseed' })
1831
- sock.removeContact(jid)
1832
-
1833
- // --- Label
1834
- sock.addChatLabel(jid, labelId)
1835
- sock.removeChatLabel(jid, labelId)
1836
- sock.addMessageLabel(jid, messageId, labelId)
1837
-
1838
- // --- App state sync
1839
- sock.resyncAppState(['regular', 'critical_block'], true)
1840
-
1841
- // --- Get business profile
1842
- const profile = await sock.getBusinessProfile(jid)
1843
- console.dir(profile, { depth: null })
1844
- ```
1845
-
1846
- #### ๐Ÿ›’ Business Management
1847
-
1848
- ```javascript
1849
- // --- Create a new product
1850
- const product = await sock.productCreate({
1851
- name: '๐Ÿงฉ Starseed (Premium)',
1852
- description: 'Get a full version of Starseed!',
1853
- price: 100000,
1854
- currency: 'IDR',
1855
- originCountryCode: 'ID',
1856
- images: [
1857
- bufferImage,
1858
- {
1859
- url: './path/to/image.jpg'
1860
- }
1861
- ]
1862
- })
1863
- console.dir(product, { depth: null })
1864
-
1865
- // --- Update product
1866
- await sock.productUpdate(productId, {
1867
- name: '๐Ÿงฉ Starseed (Premium)',
1868
- description: 'Get a full version of Starseed with more features!',
1869
- price: 75000,
1870
- currency: 'IDR',
1871
- images: [
1872
- {
1873
- url: './path/to/image.jpg'
1874
- }
1875
- ]
1876
- })
1877
-
1878
- // --- Delete product
1879
- sock.productDelete([productId])
1880
-
1881
- // --- Get catalog info
1882
- const { products, nextPageCursor } = await sock.getCatalog({
1883
- jid: '628123456789@s.whatsapp.net',
1884
- limit: 10
1885
- })
1886
-
1887
- // --- Get collections
1888
- const collections = await sock.getCollections('628123456789@s.whatsapp.net', 10)
1889
- console.dir(collections, { depth: null })
1890
-
1891
- // --- Get order info
1892
- const order = await sock.getOrderDetails(orderId, tokenBase64)
1893
- console.dir(order, { depth: null })
1894
-
1895
- // --- Update business profile
1896
- await sock.updateBusinessProfile({
1897
- address: 'Jakarta, Indonesia',
1898
- description: '๐Ÿ›’ Official Starseed Store',
1899
- websites: ['https://www.npmjs.com/package/@kaels/casileys'],
1900
- email: 'more-more@gmail.com',
1901
- hours: {
1902
- timezone: 'Asia/Jakarta',
1903
- days: [{ day: 'mon', mode: 'open_24h' }]
1904
- }
1905
- })
1906
-
1907
- // --- Update cover
1908
- sock.updateCoverPhoto({
1909
- url: './path/to/image.jpg'
1910
- })
1911
-
1912
- // --- Remove cover
1913
- sock.removeCoverPhoto(coverId)
1914
-
1915
- // --- Update quick replies
1916
- sock.addOrEditQuickReply({
1917
- shortcut: 'hello',
1918
- message: 'Hello from business account',
1919
- })
1920
-
1921
- // --- Remove quick reply
1922
- sock.removeQuickReply(timestamp)
773
+ sock.updateBlockStatus(jid, 'block') // blokir
774
+ sock.updateBlockStatus(jid, 'unblock') // buka blokir
1923
775
  ```
1924
776
 
1925
- #### ๐Ÿ” Privacy Management
777
+ ### ๐Ÿ” Privacy Management
1926
778
 
1927
779
  ```javascript
1928
- // --- Update last seen privacy
1929
- sock.updateLastSeenPrivacy('all')
1930
- sock.updateLastSeenPrivacy('contacts')
1931
- sock.updateLastSeenPrivacy('contact_blacklist')
1932
- sock.updateLastSeenPrivacy('nobody')
1933
-
1934
- // --- Update online privacy
780
+ sock.updateLastSeenPrivacy('all') // semua bisa lihat
781
+ sock.updateLastSeenPrivacy('contacts') // kontak saja
782
+ sock.updateLastSeenPrivacy('nobody') // tidak ada
1935
783
  sock.updateOnlinePrivacy('all')
1936
- sock.updateOnlinePrivacy('match_last_seen')
1937
-
1938
- // --- Update profile picture privacy
1939
784
  sock.updateProfilePicturePrivacy('contacts')
1940
-
1941
- // --- Update status privacy
1942
- sock.updateStatusPrivacy('contacts')
1943
-
1944
- // --- Update read receipts privacy
1945
785
  sock.updateReadReceiptsPrivacy('all')
1946
786
  sock.updateReadReceiptsPrivacy('none')
1947
-
1948
- // --- Update groups add privacy
1949
- sock.updateGroupsAddPrivacy('all')
1950
- sock.updateGroupsAddPrivacy('contacts')
1951
-
1952
- // --- Update messages privacy
1953
- sock.updateMessagesPrivacy('all')
1954
- sock.updateMessagesPrivacy('contacts')
1955
- sock.updateMessagesPrivacy('nobody')
1956
-
1957
- // --- Update call privacy
1958
787
  sock.updateCallPrivacy('everyone')
1959
-
1960
- // --- Update default disappearing mode
1961
788
  sock.updateDefaultDisappearingMode(86400)
789
+ ```
1962
790
 
1963
- // --- Update link previews privacy
1964
- sock.updateDisableLinkPreviewsPrivacy(true)
791
+ ### ๐Ÿ“ฃ Newsletter Management
792
+
793
+ ```javascript
794
+ sock.newsletterCreate('Nama Channel', 'Deskripsi')
795
+ sock.newsletterFollow('jid@newsletter')
796
+ sock.newsletterUnfollow('jid@newsletter')
797
+ sock.newsletterMute('jid@newsletter')
798
+ sock.newsletterUnmute('jid@newsletter')
799
+ sock.newsletterUpdateName('jid@newsletter', 'Nama Baru')
800
+ sock.newsletterUpdateDescription('jid@newsletter', 'Deskripsi baru')
801
+ sock.newsletterReactMessage('jid@newsletter', '100', '๐Ÿ’›')
802
+ sock.newsletterDelete('jid@newsletter')
1965
803
  ```
1966
804
 
1967
- #### ๐Ÿ“ก Events
805
+ ### ๐Ÿ“ก Events
1968
806
 
1969
807
  ```javascript
1970
808
  sock.ev.on('connection.update', (update) => {})
1971
809
  sock.ev.on('creds.update', (update) => {})
1972
- sock.ev.on('messaging-history.set', (update) => {})
1973
- sock.ev.on('messaging-history.status', (update) => {})
1974
- sock.ev.on('chats.upsert', (update) => {})
1975
- sock.ev.on('chats.update', (update) => {})
1976
- sock.ev.on('chats.delete', (update) => {})
1977
- sock.ev.on('chats.lock', (update) => {})
1978
- sock.ev.on('lid-mapping.update', (update) => {})
1979
- sock.ev.on('presence.update', (update) => {})
1980
- sock.ev.on('contacts.upsert', (update) => {})
1981
- sock.ev.on('contacts.update', (update) => {})
1982
- sock.ev.on('messages.delete', (update) => {})
1983
- sock.ev.on('messages.update', (update) => {})
1984
- sock.ev.on('messages.media-update', (update) => {})
1985
810
  sock.ev.on('messages.upsert', (update) => {})
811
+ sock.ev.on('messages.update', (update) => {})
812
+ sock.ev.on('messages.delete', (update) => {})
1986
813
  sock.ev.on('messages.reaction', (update) => {})
1987
- sock.ev.on('message-receipt.update', (update) => {})
1988
814
  sock.ev.on('groups.upsert', (update) => {})
1989
815
  sock.ev.on('groups.update', (update) => {})
1990
816
  sock.ev.on('group-participants.update', (update) => {})
1991
- sock.ev.on('group.join-request', (update) => {})
1992
- sock.ev.on('group.member-tag.update', (update) => {})
817
+ sock.ev.on('contacts.upsert', (update) => {})
818
+ sock.ev.on('contacts.update', (update) => {})
819
+ sock.ev.on('chats.upsert', (update) => {})
820
+ sock.ev.on('chats.update', (update) => {})
821
+ sock.ev.on('presence.update', (update) => {})
1993
822
  sock.ev.on('blocklist.set', (update) => {})
1994
823
  sock.ev.on('blocklist.update', (update) => {})
1995
824
  sock.ev.on('call', (update) => {})
1996
- sock.ev.on('labels.edit', (update) => {})
1997
- sock.ev.on('labels.association', (update) => {})
1998
825
  sock.ev.on('newsletter.reaction', (update) => {})
1999
826
  sock.ev.on('newsletter.view', (update) => {})
2000
- sock.ev.on('newsletter-participants.update', (update) => {})
2001
- sock.ev.on('newsletter-settings.update', (update) => {})
2002
827
  sock.ev.on('settings.update', (update) => {})
2003
828
  ```
2004
829
 
2005
- ### ๐Ÿš€ Try the Bot
830
+ ---
831
+
832
+ ## ๐Ÿ“ฃ Credits
2006
833
 
2007
- A fast, lightweight, and modular WhatsApp bot built with [@kaels/casileys](https://www.npmjs.com/package/@kaels/casileys).
2008
- Perfect for managing groups, moderating chats, and adding fun with quiz games and handy tools.
2009
- ### ๐Ÿ“ฃ Credits
834
+ Kredit penuh diberikan kepada para maintainer dan kontributor asli Baileys:
2010
835
 
2011
- Full credit is attributed to the original maintainers and contributors of Baileys:
2012
836
  - [purpshell](https://github.com/purpshell)
2013
837
  - [jlucaso1](https://github.com/jlucaso1)
2014
838
  - [adiwajshing](https://github.com/adiwajshing)
2015
839
 
2016
- Special thanks to [itsreimau](https://github.com/itsreimau) for the fix to the `updateBlockStatus` implementation.
840
+ Terima kasih khusus kepada:
841
+ - **[itsliaaa](https://github.com/itsliaaa)** โ€” atas fork [`@itsliaaa/baileys`](https://www.npmjs.com/package/@itsliaaa/baileys) yang menjadi fondasi awal package ini. Maaf atas kurangnya atribusi sebelumnya.
842
+ - **[itsreimau](https://github.com/itsreimau)** โ€” atas perbaikan implementasi `updateBlockStatus`.
843
+ - **[WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)** โ€” upstream library yang menjadi dasar dari semuanya.
2017
844
 
2018
845
  > [!CAUTION]
846
+ > โš ๏ธ Modifikasi, penghapusan, atau kesalahan representasi kredit ini dilarang keras. Setiap redistribusi atau fork harus mempertahankan bagian ini dalam bentuk aslinya.