@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.
- package/README.md +411 -1583
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
[](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
|
-
|
|
26
|
+
---
|
|
29
27
|
|
|
30
|
-
|
|
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
|
-
|
|
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
|
-
|
|
93
|
+
### ๐งฉ Import
|
|
55
94
|
|
|
56
95
|
```javascript
|
|
57
|
-
//
|
|
96
|
+
// ESM
|
|
58
97
|
import { makeWASocket } from '@kaels/casileys'
|
|
59
98
|
|
|
60
|
-
//
|
|
99
|
+
// CJS
|
|
61
100
|
const { makeWASocket } = require('@kaels/casileys')
|
|
62
101
|
```
|
|
63
102
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
This fork designed for production use with a focus on clarity and safety:
|
|
103
|
+
---
|
|
67
104
|
|
|
68
|
-
|
|
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
|
|
130
|
+
console.log('๐ Pairing code:', code)
|
|
212
131
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
-
|
|
221
|
-
|
|
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
|
-
|
|
154
|
+
### ๐ Auth State
|
|
241
155
|
|
|
242
156
|
> [!NOTE]
|
|
243
|
-
>
|
|
157
|
+
> Bisa gunakan `useSingleFileAuthState` sebagai alternatif `useMultiFileAuthState`. `useSingleFileAuthState` sudah memiliki mekanisme caching internal, sehingga tidak perlu wrap `state.keys` dengan `makeCacheableSignalKeyStore`.
|
|
244
158
|
|
|
245
|
-
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## ๐๏ธ Implementing Data Store
|
|
246
162
|
|
|
247
163
|
> [!CAUTION]
|
|
248
|
-
>
|
|
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
|
|
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
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
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
|
-
|
|
331
|
-
> You can get the `jid` from `message.key.remoteJid` in the first example.
|
|
195
|
+
## ๐ชช WhatsApp IDs Explain
|
|
332
196
|
|
|
333
|
-
|
|
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
|
-
|
|
336
|
-
// --- Send a regular text message
|
|
337
|
-
sock.sendMessage(jid, {
|
|
338
|
-
text: '๐๐ป Hello'
|
|
339
|
-
}, {
|
|
340
|
-
quoted: message
|
|
341
|
-
})
|
|
206
|
+
---
|
|
342
207
|
|
|
343
|
-
|
|
344
|
-
const urlA = 'https://www.npmjs.com/package/@kaels/casileys'
|
|
208
|
+
## โ๏ธ Sending Messages
|
|
345
209
|
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
|
|
363
|
-
image: {
|
|
364
|
-
url: './path/to/image.jpg'
|
|
365
|
-
}
|
|
366
|
-
}, {
|
|
367
|
-
upload: sock.waUploadToServer,
|
|
368
|
-
mediaTypeOverride: 'thumbnail-link'
|
|
369
|
-
})
|
|
213
|
+
### ๐ Text
|
|
370
214
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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:
|
|
221
|
+
text: 'https://www.npmjs.com/package/@kaels/casileys ๐๐ป Check it out!',
|
|
377
222
|
linkPreview: {
|
|
378
|
-
'matched-text':
|
|
379
|
-
title: '
|
|
380
|
-
description: '
|
|
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
|
-
|
|
232
|
+
### ๐ Mention
|
|
396
233
|
|
|
397
234
|
```javascript
|
|
398
|
-
//
|
|
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
|
-
//
|
|
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
|
-
|
|
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
|
-
|
|
256
|
+
### ๐ Pin Message
|
|
427
257
|
|
|
428
258
|
```javascript
|
|
429
259
|
sock.sendMessage(jid, {
|
|
430
260
|
pin: message.key,
|
|
431
|
-
time: 86400, //
|
|
432
|
-
type: 1
|
|
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
|
-
|
|
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
|
-
|
|
272
|
+
### ๐ค Contact
|
|
458
273
|
|
|
459
274
|
```javascript
|
|
460
|
-
const vcard = 'BEGIN:VCARD\
|
|
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
|
-
|
|
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
|
-
|
|
282
|
+
### ๐ Location
|
|
480
283
|
|
|
481
284
|
```javascript
|
|
482
285
|
sock.sendMessage(jid, {
|
|
483
|
-
location: {
|
|
484
|
-
|
|
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
|
-
|
|
290
|
+
### ๐๏ธ Event
|
|
494
291
|
|
|
495
292
|
```javascript
|
|
496
293
|
sock.sendMessage(jid, {
|
|
497
294
|
event: {
|
|
498
|
-
name: '๐ถ Meet & Mingle
|
|
499
|
-
description: '
|
|
500
|
-
call: 'audio',
|
|
501
|
-
startDate: new Date(Date.now() +
|
|
502
|
-
endDate: new Date(Date.now() +
|
|
503
|
-
|
|
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
|
-
|
|
305
|
+
### ๐ Poll
|
|
518
306
|
|
|
519
307
|
```javascript
|
|
520
|
-
|
|
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: '๐ฅ
|
|
588
|
-
values: ['
|
|
589
|
-
|
|
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
|
-
|
|
318
|
+
### ๐ญ Button Response
|
|
629
319
|
|
|
630
320
|
```javascript
|
|
631
|
-
//
|
|
321
|
+
// Plain button reply
|
|
632
322
|
sock.sendMessage(jid, {
|
|
633
323
|
type: 'plain',
|
|
634
|
-
buttonReply: {
|
|
635
|
-
|
|
636
|
-
displayText: 'โจ Interesting Menu'
|
|
637
|
-
}
|
|
638
|
-
}, {
|
|
639
|
-
quoted: message
|
|
640
|
-
})
|
|
324
|
+
buttonReply: { id: '#Menu', displayText: 'โจ Menu' }
|
|
325
|
+
}, { quoted: message })
|
|
641
326
|
|
|
642
|
-
//
|
|
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
|
-
//
|
|
337
|
+
// List reply
|
|
669
338
|
sock.sendMessage(jid, {
|
|
670
|
-
|
|
671
|
-
|
|
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
|
-
|
|
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: '
|
|
693
|
-
richResponse: [
|
|
694
|
-
text: '
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
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
|
-
>
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
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
|
-
|
|
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: '##
|
|
367
|
+
headerText: '## Contoh Kode',
|
|
754
368
|
contentText: '---',
|
|
755
369
|
code: 'console.log("Hello, World!")',
|
|
756
370
|
language: 'javascript',
|
|
757
|
-
footerText: '
|
|
371
|
+
footerText: 'Simpel kan?'
|
|
758
372
|
})
|
|
759
373
|
```
|
|
760
374
|
|
|
761
|
-
|
|
375
|
+
### ๐ Message with Inline Entities (Links)
|
|
762
376
|
|
|
763
377
|
```javascript
|
|
764
378
|
sock.sendMessage(jid, {
|
|
765
|
-
disclaimerText: '
|
|
766
|
-
headerText: '##
|
|
379
|
+
disclaimerText: 'Link List',
|
|
380
|
+
headerText: '## Useful Links',
|
|
767
381
|
contentText: '---',
|
|
768
|
-
links: [
|
|
769
|
-
text: '1.
|
|
770
|
-
title: '
|
|
771
|
-
|
|
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
|
-
|
|
390
|
+
### ๐ Message with Table
|
|
786
391
|
|
|
787
392
|
```javascript
|
|
788
393
|
sock.sendMessage(jid, {
|
|
789
|
-
disclaimerText: '
|
|
790
|
-
headerText: '##
|
|
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
|
|
400
|
+
['Engine', 'V8', 'JavaScriptCore', 'V8'],
|
|
796
401
|
['Performance', '4/5', '5/5', '4/5']
|
|
797
402
|
],
|
|
798
|
-
|
|
799
|
-
footerText: 'Does this help clarify the differences?'
|
|
403
|
+
footerText: 'Pilih yang sesuai kebutuhan!'
|
|
800
404
|
})
|
|
801
405
|
```
|
|
802
406
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
```javascript
|
|
806
|
-
sock.sendMessage([jidA, jidB, jidC], {
|
|
807
|
-
text: 'Hello! ๐๐ป'
|
|
808
|
-
})
|
|
809
|
-
```
|
|
407
|
+
---
|
|
810
408
|
|
|
811
|
-
|
|
409
|
+
## ๐ Sending Media Messages
|
|
812
410
|
|
|
813
411
|
> [!NOTE]
|
|
814
|
-
>
|
|
412
|
+
> Media bisa dikirim sebagai `Buffer`, `{ stream: Readable }`, atau `{ url: string }` (path lokal / URL).
|
|
815
413
|
|
|
816
|
-
|
|
414
|
+
### ๐ผ๏ธ Image
|
|
817
415
|
|
|
818
416
|
```javascript
|
|
819
417
|
sock.sendMessage(jid, {
|
|
820
|
-
image: {
|
|
821
|
-
|
|
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
|
-
|
|
423
|
+
### ๐ฅ Video
|
|
830
424
|
|
|
831
425
|
```javascript
|
|
832
426
|
sock.sendMessage(jid, {
|
|
833
|
-
video: {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
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
|
-
|
|
434
|
+
### ๐ Sticker
|
|
845
435
|
|
|
846
436
|
```javascript
|
|
847
437
|
sock.sendMessage(jid, {
|
|
848
|
-
sticker: {
|
|
849
|
-
|
|
850
|
-
}
|
|
851
|
-
}, {
|
|
852
|
-
quoted: message
|
|
853
|
-
})
|
|
438
|
+
sticker: { url: './path/to/sticker.webp' }
|
|
439
|
+
}, { quoted: message })
|
|
854
440
|
```
|
|
855
441
|
|
|
856
|
-
|
|
442
|
+
### ๐ฝ Audio
|
|
857
443
|
|
|
858
444
|
```javascript
|
|
859
445
|
sock.sendMessage(jid, {
|
|
860
|
-
audio: {
|
|
861
|
-
|
|
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
|
-
|
|
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: '
|
|
878
|
-
}, {
|
|
879
|
-
quoted: message
|
|
880
|
-
})
|
|
457
|
+
caption: '๐ Dokumen'
|
|
458
|
+
}, { quoted: message })
|
|
881
459
|
```
|
|
882
460
|
|
|
883
|
-
|
|
461
|
+
### ๐ผ๏ธ Album (Image & Video)
|
|
884
462
|
|
|
885
463
|
```javascript
|
|
886
464
|
sock.sendMessage(jid, {
|
|
887
|
-
album: [
|
|
888
|
-
image: {
|
|
889
|
-
|
|
890
|
-
},
|
|
891
|
-
|
|
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
|
-
|
|
473
|
+
### ๐ฆ Sticker Pack
|
|
914
474
|
|
|
915
475
|
> [!IMPORTANT]
|
|
916
|
-
>
|
|
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
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
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
|
-
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## ๐๐ป Sending Interactive Messages
|
|
945
494
|
|
|
946
|
-
|
|
495
|
+
### ๐ Buttons
|
|
947
496
|
|
|
948
497
|
```javascript
|
|
949
|
-
//
|
|
498
|
+
// Button teks biasa
|
|
950
499
|
sock.sendMessage(jid, {
|
|
951
|
-
text: '๐๐ป
|
|
500
|
+
text: '๐๐ป Pilih salah satu!',
|
|
952
501
|
footer: '@kaels/casileys',
|
|
953
|
-
buttons: [{
|
|
954
|
-
|
|
955
|
-
id: '#SignUp'
|
|
956
|
-
}]
|
|
957
|
-
}, {
|
|
958
|
-
quoted: message
|
|
959
|
-
})
|
|
502
|
+
buttons: [{ text: '๐๐ป Halo', id: '#Halo' }]
|
|
503
|
+
}, { quoted: message })
|
|
960
504
|
|
|
961
|
-
//
|
|
505
|
+
// Button dengan media & native flow
|
|
962
506
|
sock.sendMessage(jid, {
|
|
963
|
-
image: {
|
|
964
|
-
|
|
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: '
|
|
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
|
-
|
|
520
|
+
### ๐ List
|
|
998
521
|
|
|
999
522
|
> [!NOTE]
|
|
1000
|
-
>
|
|
523
|
+
> Hanya berfungsi di private chat (`@s.whatsapp.net`).
|
|
1001
524
|
|
|
1002
525
|
```javascript
|
|
1003
526
|
sock.sendMessage(jid, {
|
|
1004
|
-
text: '๐
|
|
527
|
+
text: '๐ Pilih menu!',
|
|
1005
528
|
footer: '@kaels/casileys',
|
|
1006
|
-
buttonText: '๐
|
|
1007
|
-
title: '๐๐ป
|
|
529
|
+
buttonText: '๐ Buka Menu',
|
|
530
|
+
title: '๐๐ป Menu Bot',
|
|
1008
531
|
sections: [{
|
|
1009
|
-
title: '๐
|
|
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
|
-
|
|
538
|
+
### ๐๏ธ Interactive (Native Flow)
|
|
1029
539
|
|
|
1030
540
|
```javascript
|
|
1031
|
-
//
|
|
541
|
+
// Native flow dengan berbagai tipe button
|
|
1032
542
|
sock.sendMessage(jid, {
|
|
1033
|
-
image: {
|
|
1034
|
-
|
|
1035
|
-
},
|
|
1036
|
-
caption: '๐๏ธ๏ธ Interactive!',
|
|
543
|
+
image: { url: './path/to/image.jpg' },
|
|
544
|
+
caption: '๐๏ธ Interactive Menu!',
|
|
1037
545
|
footer: '@kaels/casileys',
|
|
1038
|
-
optionText: '๐๐ป
|
|
1039
|
-
optionTitle: '๐
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
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
|
-
//
|
|
564
|
+
// Carousel
|
|
1086
565
|
sock.sendMessage(jid, {
|
|
1087
|
-
text: '
|
|
566
|
+
text: '๐ Carousel!',
|
|
1088
567
|
footer: '@kaels/casileys',
|
|
1089
568
|
cards: [{
|
|
1090
|
-
image: {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
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
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
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
|
-
//
|
|
581
|
+
// Native Flow dengan audio footer
|
|
1140
582
|
sock.sendMessage(jid, {
|
|
1141
|
-
text: '
|
|
1142
|
-
audioFooter: {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
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
|
-
|
|
592
|
+
### ๐ซ Hydrated Template
|
|
1160
593
|
|
|
1161
594
|
```javascript
|
|
1162
595
|
sock.sendMessage(jid, {
|
|
1163
|
-
title: '๐๐ป
|
|
1164
|
-
image: {
|
|
1165
|
-
|
|
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: '๐๐ป
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
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
|
-
|
|
608
|
+
---
|
|
1185
609
|
|
|
1186
|
-
|
|
610
|
+
## ๐ณ Sending Payment Messages
|
|
1187
611
|
|
|
1188
612
|
```javascript
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
})
|
|
1192
|
-
```
|
|
613
|
+
// Invite payment
|
|
614
|
+
sock.sendMessage(jid, { paymentInviteServiceType: 3 }) // 1, 2, atau 3
|
|
1193
615
|
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
> [!NOTE]
|
|
1197
|
-
> Invoice message are not supported yet.
|
|
1198
|
-
|
|
1199
|
-
```javascript
|
|
616
|
+
// Order
|
|
1200
617
|
sock.sendMessage(jid, {
|
|
1201
|
-
|
|
1202
|
-
|
|
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
|
-
|
|
1220
|
-
|
|
1221
|
-
```javascript
|
|
622
|
+
// Request payment
|
|
1222
623
|
sock.sendMessage(jid, {
|
|
1223
|
-
text: '๐ณ
|
|
624
|
+
text: '๐ณ Minta Pembayaran',
|
|
1224
625
|
requestPaymentFrom: '0@s.whatsapp.net'
|
|
1225
626
|
})
|
|
1226
627
|
```
|
|
1227
628
|
|
|
1228
|
-
|
|
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
|
-
|
|
631
|
+
## ๐๏ธ Other Message Options
|
|
1248
632
|
|
|
1249
|
-
|
|
1250
|
-
|
|
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
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
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
|
-
|
|
654
|
+
// External Ad Reply
|
|
1268
655
|
sock.sendMessage(jid, {
|
|
1269
|
-
text: '๐ฐ
|
|
656
|
+
text: '๐ฐ Info Penting!',
|
|
1270
657
|
externalAdReply: {
|
|
1271
|
-
title: '๐
|
|
1272
|
-
body: '
|
|
1273
|
-
thumbnail: fs.readFileSync('./
|
|
1274
|
-
largeThumbnail: false,
|
|
1275
|
-
url: 'https://www.npmjs.com/package/@kaels/casileys'
|
|
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
|
-
|
|
667
|
+
---
|
|
1283
668
|
|
|
1284
|
-
|
|
1285
|
-
> It only works in group chat (`@g.us`)
|
|
669
|
+
## โป๏ธ Modify Messages
|
|
1286
670
|
|
|
1287
671
|
```javascript
|
|
1288
|
-
|
|
1289
|
-
|
|
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
|
-
|
|
675
|
+
// Edit teks
|
|
676
|
+
sock.sendMessage(jid, { text: 'โ๏ธ Teks yang sudah diedit', edit: message.key })
|
|
1298
677
|
|
|
1299
|
-
|
|
1300
|
-
|
|
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
|
-
|
|
682
|
+
---
|
|
1312
683
|
|
|
1313
|
-
|
|
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
|
-
|
|
686
|
+
### ๐ท๏ธ Find User ID (JID | PN / LID)
|
|
1343
687
|
|
|
1344
688
|
> [!NOTE]
|
|
1345
|
-
>
|
|
689
|
+
> ID harus berupa angka saja (tanpa +, (), atau -) dan menyertakan kode negara.
|
|
1346
690
|
|
|
1347
691
|
```javascript
|
|
1348
|
-
sock.
|
|
1349
|
-
|
|
1350
|
-
|
|
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
|
-
|
|
1358
|
-
|
|
1359
|
-
> [!NOTE]
|
|
1360
|
-
> Wrap message into `viewOnceMessage`
|
|
697
|
+
### ๐ Request Custom Pairing Code
|
|
1361
698
|
|
|
1362
699
|
```javascript
|
|
1363
|
-
sock.
|
|
1364
|
-
|
|
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
|
-
|
|
704
|
+
### ๐ผ๏ธ Image Processing
|
|
1373
705
|
|
|
1374
706
|
> [!NOTE]
|
|
1375
|
-
>
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
723
|
+
### ๐ฅ Group Management
|
|
1597
724
|
|
|
1598
725
|
```javascript
|
|
1599
|
-
//
|
|
1600
|
-
const group = sock.groupCreate('
|
|
1601
|
-
console.dir(group, { depth: null })
|
|
726
|
+
// Buat grup
|
|
727
|
+
const group = await sock.groupCreate('Nama Grup', ['628xxx@s.whatsapp.net'])
|
|
1602
728
|
|
|
1603
|
-
//
|
|
729
|
+
// Metadata
|
|
1604
730
|
const metadata = await sock.groupMetadata(jid)
|
|
1605
|
-
console.dir(metadata, { depth: null })
|
|
1606
731
|
|
|
1607
|
-
//
|
|
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
|
-
|
|
753
|
+
### ๐ฅ Community Management
|
|
1695
754
|
|
|
1696
755
|
```javascript
|
|
1697
|
-
|
|
1698
|
-
const
|
|
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
|
-
|
|
764
|
+
### ๐ค Profile Management
|
|
1782
765
|
|
|
1783
766
|
```javascript
|
|
1784
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
777
|
+
### ๐ Privacy Management
|
|
1926
778
|
|
|
1927
779
|
```javascript
|
|
1928
|
-
//
|
|
1929
|
-
sock.updateLastSeenPrivacy('
|
|
1930
|
-
sock.updateLastSeenPrivacy('
|
|
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
|
-
|
|
1964
|
-
|
|
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
|
-
|
|
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('
|
|
1992
|
-
sock.ev.on('
|
|
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
|
-
|
|
830
|
+
---
|
|
831
|
+
|
|
832
|
+
## ๐ฃ Credits
|
|
2006
833
|
|
|
2007
|
-
|
|
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
|
-
|
|
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.
|