@rakku-kun/baileys 2.0.11 → 2.0.12
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 +41 -618
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,650 +1,73 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<
|
|
2
|
+
<img src="https://raw.githubusercontent.com/rakku-dev/rakkustorage/main/image/waiter-5u.jpg" alt="Banner Rakku Bot" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">🌿 Rakku Baileys</h1>
|
|
6
|
+
|
|
6
7
|
<p align="center">
|
|
7
|
-
<strong>
|
|
8
|
-
|
|
8
|
+
<strong>Library WhatsApp Multi-Device berbasis TypeScript</strong><br>
|
|
9
|
+
Dilengkapi pemetaan otomatis @lid/@jid cerdas serta penanganan pesan tingkat lanjut.
|
|
9
10
|
</p>
|
|
10
11
|
|
|
11
12
|
<p align="center">
|
|
12
13
|
<a href="https://www.npmjs.com/package/@rakku-kun/baileys"><img src="https://img.shields.io/npm/v/@rakku-kun/baileys?style=flat-square&logo=npm" alt="npm Version"/></a>
|
|
13
14
|
<a href="https://www.npmjs.com/package/@rakku-kun/baileys"><img src="https://img.shields.io/npm/dt/@rakku-kun/baileys?style=flat-square&logo=npm" alt="npm Downloads"/></a>
|
|
14
|
-
<img src="https://img.shields.io/badge/
|
|
15
|
+
<img src="https://img.shields.io/badge/Lisensi-MIT-green?style=flat-square" alt="License"/>
|
|
15
16
|
</p>
|
|
16
17
|
|
|
17
18
|
---
|
|
18
19
|
|
|
19
|
-
## ✦
|
|
20
|
-
|
|
21
|
-
### Core Features
|
|
22
|
-
- **▶ Intelligent `@lid` and `@jid` Mapping** - Automatic resolution of LID to phone JID
|
|
23
|
-
- **▶ Multi-Device Support** - Full support for WhatsApp multi-device protocol
|
|
24
|
-
- **▶ End-to-End Encryption** - Complete E2EE support for secure messaging
|
|
25
|
-
- **▶ All Message Types** - Support for text, media, polls, reactions, and more
|
|
26
|
-
- **▶ TypeScript Based** - Type-safe with modern TypeScript
|
|
27
|
-
- **▶ High Performance** - Optimized for speed and efficiency
|
|
28
|
-
|
|
29
|
-
### Advanced Features
|
|
30
|
-
- **▶ Media Handling** - Send/receive images, videos, audio, stickers, documents
|
|
31
|
-
- **▶ Pairing Code Login** - Easy authentication with custom pairing code "RAKKUWTR"
|
|
32
|
-
- **▶ Newsletter/Channel Support** - Full support for WhatsApp channels
|
|
33
|
-
- **▶ Group Management** - Complete group controls and administration
|
|
34
|
-
- **▶ Story/Broadcast** - Send and manage stories and broadcast lists
|
|
35
|
-
- **▶ Business API** - Support for WhatsApp Business features
|
|
36
|
-
- **▶ Poll Messages** - Create and manage poll messages with vote tracking
|
|
37
|
-
- **▶ Reaction Messages** - Send and receive emoji reactions
|
|
38
|
-
- **▶ Pin Messages** - Pin important messages in chats
|
|
39
|
-
- **▶ Disappearing Messages** - Configure ephemeral messages
|
|
40
|
-
- **▶ Contact Messages** - Send vCard contacts
|
|
41
|
-
- **▶ Location Messages** - Share live and static locations
|
|
42
|
-
- **▶ Button Messages** - Interactive button messages (where supported)
|
|
43
|
-
- **▶ List Messages** - Interactive list messages
|
|
44
|
-
- **▶ Template Messages** - Pre-defined message templates
|
|
45
|
-
|
|
46
|
-
### Developer Friendly
|
|
47
|
-
- **▶ Clean API** - Simple and intuitive API design
|
|
48
|
-
- **▶ Event-Driven** - Comprehensive event system for all actions
|
|
49
|
-
- **▶ Auth Storage** - Multi-file and single-file auth state options
|
|
50
|
-
- **▶ In-Memory Store** - Built-in store for chats, contacts, messages
|
|
51
|
-
- **▶ Customizable** - Easy to extend and customize
|
|
52
|
-
- **▶ Well Documented** - Comprehensive documentation and examples
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
## 📦 Installation
|
|
57
|
-
|
|
58
|
-
### npm
|
|
59
|
-
```bash
|
|
60
|
-
npm install @rakku-kun/baileys
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### yarn
|
|
64
|
-
```bash
|
|
65
|
-
yarn add @rakku-kun/baileys
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### pnpm
|
|
69
|
-
```bash
|
|
70
|
-
pnpm add @rakku-kun/baileys
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## 🚀 Quick Start
|
|
76
|
-
|
|
77
|
-
### Basic Example
|
|
78
|
-
```typescript
|
|
79
|
-
import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@rakku-kun/baileys'
|
|
80
|
-
import { Boom } from '@hapi/boom'
|
|
81
|
-
|
|
82
|
-
async function connectToWhatsApp() {
|
|
83
|
-
const { state, saveCreds } = await useMultiFileAuthState('auth_info')
|
|
84
|
-
|
|
85
|
-
const sock = makeWASocket({
|
|
86
|
-
auth: state,
|
|
87
|
-
printQRInTerminal: true
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
sock.ev.on('connection.update', (update) => {
|
|
91
|
-
const { connection, lastDisconnect } = update
|
|
92
|
-
if (connection === 'close') {
|
|
93
|
-
const shouldReconnect = (lastDisconnect?.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
|
|
94
|
-
if (shouldReconnect) {
|
|
95
|
-
connectToWhatsApp()
|
|
96
|
-
}
|
|
97
|
-
} else if (connection === 'open') {
|
|
98
|
-
console.log('✅ Connected to WhatsApp!')
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
103
|
-
for (const m of messages) {
|
|
104
|
-
if (!m.message) continue
|
|
105
|
-
console.log('📱 New message:', m.key.remoteJid)
|
|
106
|
-
|
|
107
|
-
// Reply to message
|
|
108
|
-
await sock.sendMessage(m.key.remoteJid!, {
|
|
109
|
-
text: 'Hello! I am Rakku Bot ▶'
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
sock.ev.on('creds.update', saveCreds)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
connectToWhatsApp()
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## 🔐 Authentication
|
|
123
|
-
|
|
124
|
-
### Pairing Code (Recommended)
|
|
125
|
-
```typescript
|
|
126
|
-
import makeWASocket from '@rakku-kun/baileys'
|
|
127
|
-
|
|
128
|
-
const sock = makeWASocket({
|
|
129
|
-
printQRInTerminal: false
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
// Request pairing code
|
|
133
|
-
if (!sock.authState.creds.registered) {
|
|
134
|
-
const phoneNumber = '6285134816783' // Your phone number with country code
|
|
135
|
-
const code = await sock.requestPairingCode(phoneNumber, "RAKKUWTR")
|
|
136
|
-
console.log('▶ Pairing Code:', code)
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### QR Code
|
|
141
|
-
```typescript
|
|
142
|
-
import makeWASocket, { Browsers } from '@rakku-kun/baileys'
|
|
143
|
-
|
|
144
|
-
const sock = makeWASocket({
|
|
145
|
-
browser: Browsers.ubuntu('My Bot'),
|
|
146
|
-
printQRInTerminal: true
|
|
147
|
-
})
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## 📚 Common Use Cases
|
|
153
|
-
|
|
154
|
-
### Send Text Message
|
|
155
|
-
```typescript
|
|
156
|
-
await sock.sendMessage(jid, { text: 'Hello World! ▶' })
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Send Image
|
|
160
|
-
```typescript
|
|
161
|
-
await sock.sendMessage(jid, {
|
|
162
|
-
image: { url: './image.jpg' },
|
|
163
|
-
caption: 'Check this out!'
|
|
164
|
-
})
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### Send Video
|
|
168
|
-
```typescript
|
|
169
|
-
await sock.sendMessage(jid, {
|
|
170
|
-
video: { url: './video.mp4' },
|
|
171
|
-
caption: 'Amazing video!',
|
|
172
|
-
mimetype: 'video/mp4'
|
|
173
|
-
})
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
### Send Audio
|
|
177
|
-
```typescript
|
|
178
|
-
await sock.sendMessage(jid, {
|
|
179
|
-
audio: { url: './audio.mp3' },
|
|
180
|
-
mimetype: 'audio/mp4'
|
|
181
|
-
})
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Send Sticker
|
|
185
|
-
```typescript
|
|
186
|
-
await sock.sendMessage(jid, {
|
|
187
|
-
sticker: { url: './sticker.webp' }
|
|
188
|
-
})
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Send Document
|
|
192
|
-
```typescript
|
|
193
|
-
await sock.sendMessage(jid, {
|
|
194
|
-
document: { url: './document.pdf' },
|
|
195
|
-
mimetype: 'application/pdf',
|
|
196
|
-
fileName: 'document.pdf'
|
|
197
|
-
})
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### Send Location
|
|
201
|
-
```typescript
|
|
202
|
-
await sock.sendMessage(jid, {
|
|
203
|
-
location: {
|
|
204
|
-
degreesLatitude: -6.2088,
|
|
205
|
-
degreesLongitude: 106.8456
|
|
206
|
-
}
|
|
207
|
-
})
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Send Contact
|
|
211
|
-
```typescript
|
|
212
|
-
const vcard = `BEGIN:VCARD
|
|
213
|
-
VERSION:3.0
|
|
214
|
-
FN:John Doe
|
|
215
|
-
TEL;type=CELL;type=VOICE;waid=6281234567890:+62 812-3456-7890
|
|
216
|
-
END:VCARD`
|
|
217
|
-
|
|
218
|
-
await sock.sendMessage(jid, {
|
|
219
|
-
contacts: {
|
|
220
|
-
displayName: 'John Doe',
|
|
221
|
-
contacts: [{ vcard }]
|
|
222
|
-
}
|
|
223
|
-
})
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### Send Poll
|
|
227
|
-
```typescript
|
|
228
|
-
await sock.sendMessage(jid, {
|
|
229
|
-
poll: {
|
|
230
|
-
name: 'Favorite Color?',
|
|
231
|
-
values: ['Red', 'Blue', 'Green'],
|
|
232
|
-
selectableCount: 1
|
|
233
|
-
}
|
|
234
|
-
})
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Send Reaction
|
|
238
|
-
```typescript
|
|
239
|
-
await sock.sendMessage(jid, {
|
|
240
|
-
react: {
|
|
241
|
-
text: '▶',
|
|
242
|
-
key: message.key
|
|
243
|
-
}
|
|
244
|
-
})
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Reply/Quote Message
|
|
248
|
-
```typescript
|
|
249
|
-
await sock.sendMessage(jid, {
|
|
250
|
-
text: 'This is a reply'
|
|
251
|
-
}, {
|
|
252
|
-
quoted: message
|
|
253
|
-
})
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### Mention Users
|
|
257
|
-
```typescript
|
|
258
|
-
await sock.sendMessage(jid, {
|
|
259
|
-
text: 'Hello @6281234567890!',
|
|
260
|
-
mentions: ['6281234567890@s.whatsapp.net']
|
|
261
|
-
})
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
### Forward Message
|
|
265
|
-
```typescript
|
|
266
|
-
await sock.sendMessage(jid, {
|
|
267
|
-
forward: message
|
|
268
|
-
})
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### Delete Message (For Everyone)
|
|
272
|
-
```typescript
|
|
273
|
-
const msg = await sock.sendMessage(jid, { text: 'test' })
|
|
274
|
-
await sock.sendMessage(jid, { delete: msg.key })
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
### Edit Message
|
|
278
|
-
```typescript
|
|
279
|
-
await sock.sendMessage(jid, {
|
|
280
|
-
text: 'Updated text',
|
|
281
|
-
edit: message.key
|
|
282
|
-
})
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Pin Message
|
|
286
|
-
```typescript
|
|
287
|
-
await sock.sendMessage(jid, {
|
|
288
|
-
pin: {
|
|
289
|
-
type: 1, // 1=24h, 2=7d, 3=30d
|
|
290
|
-
time: 86400,
|
|
291
|
-
key: message.key
|
|
292
|
-
}
|
|
293
|
-
})
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### View Once Message
|
|
297
|
-
```typescript
|
|
298
|
-
await sock.sendMessage(jid, {
|
|
299
|
-
image: { url: './image.jpg' },
|
|
300
|
-
viewOnce: true
|
|
301
|
-
})
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
## 👥 Group Management
|
|
307
|
-
|
|
308
|
-
### Create Group
|
|
309
|
-
```typescript
|
|
310
|
-
const group = await sock.groupCreate('My Group', ['6281234567890@s.whatsapp.net'])
|
|
311
|
-
console.log('Group created:', group.id)
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
### Add Participants
|
|
315
|
-
```typescript
|
|
316
|
-
await sock.groupParticipantsUpdate(groupId, ['6281234567890@s.whatsapp.net'], 'add')
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### Remove Participants
|
|
320
|
-
```typescript
|
|
321
|
-
await sock.groupParticipantsUpdate(groupId, ['6281234567890@s.whatsapp.net'], 'remove')
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### Promote to Admin
|
|
325
|
-
```typescript
|
|
326
|
-
await sock.groupParticipantsUpdate(groupId, ['6281234567890@s.whatsapp.net'], 'promote')
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### Demote Admin
|
|
330
|
-
```typescript
|
|
331
|
-
await sock.groupParticipantsUpdate(groupId, ['6281234567890@s.whatsapp.net'], 'demote')
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
### Update Group Name
|
|
335
|
-
```typescript
|
|
336
|
-
await sock.groupUpdateSubject(groupId, 'New Group Name')
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Update Group Description
|
|
340
|
-
```typescript
|
|
341
|
-
await sock.groupUpdateDescription(groupId, 'New Description')
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
### Get Invite Code
|
|
345
|
-
```typescript
|
|
346
|
-
const code = await sock.groupInviteCode(groupId)
|
|
347
|
-
const inviteLink = 'https://chat.whatsapp.com/' + code
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
### Join Group
|
|
351
|
-
```typescript
|
|
352
|
-
await sock.groupAcceptInvite('inviteCode')
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
### Leave Group
|
|
356
|
-
```typescript
|
|
357
|
-
await sock.groupLeave(groupId)
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## 📞 Call Handling
|
|
363
|
-
|
|
364
|
-
### Reject Call
|
|
365
|
-
```typescript
|
|
366
|
-
sock.ev.on('call', async (calls) => {
|
|
367
|
-
for (const call of calls) {
|
|
368
|
-
await sock.rejectCall(call.id, call.from)
|
|
369
|
-
}
|
|
370
|
-
})
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
---
|
|
374
|
-
|
|
375
|
-
## 👤 User Operations
|
|
376
|
-
|
|
377
|
-
### Check If Number Exists on WhatsApp
|
|
378
|
-
```typescript
|
|
379
|
-
const [result] = await sock.onWhatsApp('6281234567890')
|
|
380
|
-
if (result?.exists) {
|
|
381
|
-
console.log('Number exists:', result.jid)
|
|
382
|
-
}
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
### Get Profile Picture
|
|
386
|
-
```typescript
|
|
387
|
-
// Low resolution
|
|
388
|
-
const ppUrl = await sock.profilePictureUrl(jid)
|
|
389
|
-
|
|
390
|
-
// High resolution
|
|
391
|
-
const ppUrl = await sock.profilePictureUrl(jid, 'image')
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
### Get Status
|
|
395
|
-
```typescript
|
|
396
|
-
const status = await sock.fetchStatus(jid)
|
|
397
|
-
console.log('About:', status?.status)
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
### Get Business Profile
|
|
401
|
-
```typescript
|
|
402
|
-
const profile = await sock.getBusinessProfile(jid)
|
|
403
|
-
console.log('Business:', profile)
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
---
|
|
407
|
-
|
|
408
|
-
## 📝 Chat Operations
|
|
409
|
-
|
|
410
|
-
### Archive Chat
|
|
411
|
-
```typescript
|
|
412
|
-
const lastMsg = await getLastMessage(jid)
|
|
413
|
-
await sock.chatModify({ archive: true, lastMessages: [lastMsg] }, jid)
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
### Mute Chat
|
|
417
|
-
```typescript
|
|
418
|
-
await sock.chatModify({ mute: 8 * 60 * 60 * 1000 }, jid) // 8 hours
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
### Unmute Chat
|
|
422
|
-
```typescript
|
|
423
|
-
await sock.chatModify({ mute: null }, jid)
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
### Mark as Read
|
|
427
|
-
```typescript
|
|
428
|
-
await sock.readMessages([message.key])
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
### Delete Chat
|
|
432
|
-
```typescript
|
|
433
|
-
await sock.chatModify({ delete: true, lastMessages: [lastMsg] }, jid)
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
### Star Message
|
|
437
|
-
```typescript
|
|
438
|
-
await sock.chatModify({
|
|
439
|
-
star: {
|
|
440
|
-
messages: [{ id: 'messageID', fromMe: true }],
|
|
441
|
-
star: true
|
|
442
|
-
}
|
|
443
|
-
}, jid)
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
### Disappearing Messages
|
|
447
|
-
```typescript
|
|
448
|
-
// Enable
|
|
449
|
-
await sock.sendMessage(jid, {
|
|
450
|
-
disappearingMessagesInChat: 7 * 24 * 60 * 60 // 7 days
|
|
451
|
-
})
|
|
452
|
-
|
|
453
|
-
// Disable
|
|
454
|
-
await sock.sendMessage(jid, {
|
|
455
|
-
disappearingMessagesInChat: false
|
|
456
|
-
})
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
---
|
|
460
|
-
|
|
461
|
-
## 🎨 Profile Management
|
|
462
|
-
|
|
463
|
-
### Update Profile Name
|
|
464
|
-
```typescript
|
|
465
|
-
await sock.updateProfileName('New Name')
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
### Update Profile Status
|
|
469
|
-
```typescript
|
|
470
|
-
await sock.updateProfileStatus('New Status ▶')
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
### Update Profile Picture
|
|
474
|
-
```typescript
|
|
475
|
-
await sock.updateProfilePicture(jid, { url: './new-pp.jpg' })
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
### Remove Profile Picture
|
|
479
|
-
```typescript
|
|
480
|
-
await sock.removeProfilePicture(jid)
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
---
|
|
484
|
-
|
|
485
|
-
## 📊 Events
|
|
486
|
-
|
|
487
|
-
### Connection Events
|
|
488
|
-
```typescript
|
|
489
|
-
sock.ev.on('connection.update', (update) => {
|
|
490
|
-
console.log('Connection:', update)
|
|
491
|
-
})
|
|
492
|
-
```
|
|
493
|
-
|
|
494
|
-
### Message Events
|
|
495
|
-
```typescript
|
|
496
|
-
sock.ev.on('messages.upsert', ({ messages }) => {
|
|
497
|
-
console.log('Messages:', messages)
|
|
498
|
-
})
|
|
499
|
-
|
|
500
|
-
sock.ev.on('messages.update', (updates) => {
|
|
501
|
-
console.log('Message updates:', updates)
|
|
502
|
-
})
|
|
503
|
-
|
|
504
|
-
sock.ev.on('messages.delete', (deletes) => {
|
|
505
|
-
console.log('Messages deleted:', deletes)
|
|
506
|
-
})
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
### Chat Events
|
|
510
|
-
```typescript
|
|
511
|
-
sock.ev.on('chats.upsert', (chats) => {
|
|
512
|
-
console.log('New chats:', chats)
|
|
513
|
-
})
|
|
514
|
-
|
|
515
|
-
sock.ev.on('chats.update', (updates) => {
|
|
516
|
-
console.log('Chat updates:', updates)
|
|
517
|
-
})
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
### Contact Events
|
|
521
|
-
```typescript
|
|
522
|
-
sock.ev.on('contacts.upsert', (contacts) => {
|
|
523
|
-
console.log('New contacts:', contacts)
|
|
524
|
-
})
|
|
525
|
-
|
|
526
|
-
sock.ev.on('contacts.update', (updates) => {
|
|
527
|
-
console.log('Contact updates:', updates)
|
|
528
|
-
})
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
### Group Events
|
|
532
|
-
```typescript
|
|
533
|
-
sock.ev.on('groups.upsert', (groups) => {
|
|
534
|
-
console.log('New groups:', groups)
|
|
535
|
-
})
|
|
536
|
-
|
|
537
|
-
sock.ev.on('groups.update', (updates) => {
|
|
538
|
-
console.log('Group updates:', updates)
|
|
539
|
-
})
|
|
540
|
-
|
|
541
|
-
sock.ev.on('group-participants.update', (update) => {
|
|
542
|
-
console.log('Participants update:', update)
|
|
543
|
-
})
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
### Presence Events
|
|
547
|
-
```typescript
|
|
548
|
-
sock.ev.on('presence.update', (presence) => {
|
|
549
|
-
console.log('Presence:', presence)
|
|
550
|
-
})
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
---
|
|
554
|
-
|
|
555
|
-
## 🗄️ Data Store
|
|
556
|
-
|
|
557
|
-
### In-Memory Store
|
|
558
|
-
```typescript
|
|
559
|
-
import makeWASocket, { makeInMemoryStore } from '@rakku-kun/baileys'
|
|
560
|
-
|
|
561
|
-
const store = makeInMemoryStore()
|
|
562
|
-
store.readFromFile('./baileys_store.json')
|
|
563
|
-
|
|
564
|
-
setInterval(() => {
|
|
565
|
-
store.writeToFile('./baileys_store.json')
|
|
566
|
-
}, 10000)
|
|
567
|
-
|
|
568
|
-
const sock = makeWASocket()
|
|
569
|
-
store.bind(sock.ev)
|
|
570
|
-
|
|
571
|
-
// Access stored data
|
|
572
|
-
console.log('Chats:', store.chats.all())
|
|
573
|
-
console.log('Contacts:', store.contacts)
|
|
574
|
-
console.log('Messages:', store.messages)
|
|
575
|
-
```
|
|
576
|
-
|
|
577
|
-
---
|
|
20
|
+
## ✦ Fitur Utama
|
|
578
21
|
|
|
579
|
-
|
|
22
|
+
### Fitur Inti
|
|
580
23
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
24
|
+
* ▶ **Pemetaan `@lid` dan `@jid` Cerdas** - Resolusi konversi otomatis dari LID ke JID nomor telepon secara seamless
|
|
25
|
+
* ▶ **Dukungan Multi-Device** - Kompatibel penuh dengan arsitektur protokol WhatsApp multi-device
|
|
26
|
+
* ▶ **Enkripsi End-to-End** - Keamanan E2E bawaan untuk menjaga privasi komunikasi
|
|
27
|
+
* ▶ **Dukungan Semua Jenis Pesan** - Mendukung teks, media, polling, reaksi, hingga payload khusus
|
|
28
|
+
* ▶ **Berbasis TypeScript** - Dikembangkan dengan keamanan tipe (*type-safe*) standar modern
|
|
29
|
+
* ▶ **Performa Tinggi** - Ringan, efisien, dan dioptimalkan untuk penggunaan memori yang minim
|
|
584
30
|
|
|
585
|
-
|
|
586
|
-
const jid = jidEncode('6281234567890', 's.whatsapp.net')
|
|
31
|
+
### Fitur Lanjutan
|
|
587
32
|
|
|
588
|
-
|
|
589
|
-
|
|
33
|
+
* ▶ **Pengolahan Media** - Kirim dan terima gambar, video, pesan suara, stiker, hingga dokumen
|
|
34
|
+
* ▶ **Login Kode Pairing** - Autentikasi praktis menggunakan kode pairing khusus `"RAKKUWTR"`
|
|
35
|
+
* ▶ **Dukungan Saluran/Newsletter** - Pengelolaan dan interaksi langsung dengan Saluran WhatsApp
|
|
36
|
+
* ▶ **Manajemen Grup** - Kontrol penuh untuk administrasi grup dan izin anggota
|
|
37
|
+
* ▶ **Status/Siaran** - Buat status cerita (story) dan kelola daftar siaran (broadcast)
|
|
38
|
+
* ▶ **WhatsApp Business** - Integrasi fitur khusus akun bisnis WhatsApp
|
|
39
|
+
* ▶ **Pesan Polling** - Buat polling interaktif dengan pemrosesan hasil pemungutan suara otomatis
|
|
40
|
+
* ▶ **Pesan Reaksi** - Kirim dan deteksi reaksi emoji pada pesan
|
|
41
|
+
* ▶ **Pesan Semat (Pin)** - Fitur untuk menyematkan pesan penting di obrolan
|
|
42
|
+
* ▶ **Pesan Sementara** - Atur durasi pesan otomatis terhapus (ephemeral)
|
|
43
|
+
* ▶ **Pesan Kontak** - Bagikan data kontak kartu vCard
|
|
44
|
+
* ▶ **Pesan Lokasi** - Kirim lokasi terkini maupun titik lokasi statis
|
|
45
|
+
* ▶ **Pesan Tombol & List** - Pengiriman menu dan tombol interaktif (pada platform yang mendukung)
|
|
590
46
|
|
|
591
|
-
|
|
592
|
-
const isGroup = isJidGroup(jid)
|
|
593
|
-
const isBroadcast = isJidBroadcast(jid)
|
|
594
|
-
```
|
|
47
|
+
### Kemudahan Developer
|
|
595
48
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
const type = getContentType(message)
|
|
602
|
-
|
|
603
|
-
// Get device
|
|
604
|
-
const device = getDevice(message)
|
|
605
|
-
|
|
606
|
-
// Download media
|
|
607
|
-
const buffer = await downloadMediaMessage(message, 'buffer')
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
---
|
|
611
|
-
|
|
612
|
-
## 💝 Credits & Inspiration
|
|
613
|
-
|
|
614
|
-
This project is built upon the amazing work of:
|
|
615
|
-
|
|
616
|
-
- **[@WhiskeySockets](https://github.com/WhiskeySockets/Baileys)** - Base Baileys library
|
|
617
|
-
|
|
618
|
-
Special thanks to all contributors and the WhatsApp community!
|
|
49
|
+
* ▶ **API yang Bersih** - Struktur perintah yang mudah dipahami dan intuitif
|
|
50
|
+
* ▶ **Sistem Berbasis Event** - Pemantauan event lengkap untuk setiap aktivitas socket
|
|
51
|
+
* ▶ **Penyimpanan Sesi Fleksibel** - Pilihan sesi file tunggal maupun multi-file
|
|
52
|
+
* ▶ **Penyimpanan Memori Internal** - Fitur *caching* bawaan untuk riwayat pesan, kontak, dan chat
|
|
53
|
+
* ▶ **Mudah Disesuaikan** - Arsitektur modular yang gampang dikembangkan sesuai kebutuhan
|
|
619
54
|
|
|
620
55
|
---
|
|
621
56
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries. The official WhatsApp website can be found at [whatsapp.com](https://whatsapp.com).
|
|
57
|
+
### ✦ Komunitas & Dukungan
|
|
625
58
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
**
|
|
59
|
+
* ▶ **Saluran WhatsApp** : [Klik Disini untuk Bergabung](https://whatsapp.com/channel/0029Vb6fyiS7z4kcAZUBWx43)
|
|
60
|
+
* ▶ **Grup WhatsApp** : [Klik Disini untuk Masuk Grup](https://chat.whatsapp.com/FAtRFbXfZxeJISrDQ9kJaj?s=cl&p=a&ilr=0&amv=2)
|
|
61
|
+
* ▶ **Website Resmi** : [https://rakkulabs.biz.id](https://rakkulabs.biz.id)
|
|
629
62
|
|
|
630
63
|
---
|
|
631
64
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
MIT License - see [LICENSE](LICENSE) for details.
|
|
65
|
+
### ✦ Disclaimer
|
|
635
66
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
<p align="center">Made with ▶ by <a href="https://github.com/rakku-kundev">@rakku-kundev</a></p>
|
|
639
|
-
<p align="center">
|
|
640
|
-
<a href="https://github.com/rakku-kundev/rakku-baileys">GitHub</a> •
|
|
641
|
-
<a href="https://www.npmjs.com/package/@rakku-kun/baileys">npm</a> •
|
|
642
|
-
<a href="https://github.com/rakku-kundev/rakku-baileys/issues">Issues</a>
|
|
643
|
-
</p>
|
|
67
|
+
Library ini dikembangkan oleh komunitas Rakku Waiter bot . Gunakan dengan bijak dan selalu patuhi Syarat & Ketentuan Layanan WhatsApp.
|
|
644
68
|
|
|
645
69
|
---
|
|
646
70
|
|
|
647
|
-
### ✦
|
|
71
|
+
### ✦ Lisensi
|
|
648
72
|
|
|
649
|
-
|
|
650
|
-
* ▶ **NPM Package** : [@rakku-kun/baileys](https://www.npmjs.com/package/@rakku-kun/baileys)
|
|
73
|
+
Dilisensikan di bawah **MIT License**.
|
package/package.json
CHANGED