@izi-coder/baileys 0.0.0-stage → 6.0.9
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/LICENSE +49 -0
- package/README.md +519 -2
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +6902 -0
- package/WAProto/fix-imports.js +85 -0
- package/WAProto/index.d.ts +79257 -0
- package/WAProto/index.js +242946 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.js +130 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-message-key.js +26 -0
- package/lib/Signal/libsignal.js +431 -0
- package/lib/Signal/lid-mapping.js +277 -0
- package/lib/Socket/Client/index.js +3 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/websocket.js +86 -0
- package/lib/Socket/business.js +379 -0
- package/lib/Socket/chats.js +1193 -0
- package/lib/Socket/communities.js +432 -0
- package/lib/Socket/groups.js +374 -0
- package/lib/Socket/index.js +46 -0
- package/lib/Socket/luxu.js +386 -0
- package/lib/Socket/messages-recv.js +1916 -0
- package/lib/Socket/messages-send.js +648 -0
- package/lib/Socket/mex.js +41 -0
- package/lib/Socket/newsletter.js +494 -0
- package/lib/Socket/socket.js +1016 -0
- package/lib/Socket/username.js +234 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/keyed-db.js +108 -0
- package/lib/Store/make-cache-manager-store.js +85 -0
- package/lib/Store/make-in-memory-store.js +198 -0
- package/lib/Store/make-ordered-dictionary.js +75 -0
- package/lib/Store/object-repository.js +32 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.js +25 -0
- package/lib/Types/LabelAssociation.js +7 -0
- package/lib/Types/Message.js +11 -0
- package/lib/Types/Mex.js +37 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.js +3 -0
- package/lib/Types/State.js +56 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.js +26 -0
- package/lib/Utils/auth-utils.js +302 -0
- package/lib/Utils/ban-sentinel.js +128 -0
- package/lib/Utils/browser-utils.js +49 -0
- package/lib/Utils/business.js +231 -0
- package/lib/Utils/chat-utils.js +872 -0
- package/lib/Utils/companion-reg-client-utils.js +35 -0
- package/lib/Utils/crypto.js +118 -0
- package/lib/Utils/decode-wa-message.js +350 -0
- package/lib/Utils/event-buffer.js +622 -0
- package/lib/Utils/generics.js +403 -0
- package/lib/Utils/history.js +134 -0
- package/lib/Utils/identity-change-handler.js +50 -0
- package/lib/Utils/index.js +23 -0
- package/lib/Utils/link-preview.js +85 -0
- package/lib/Utils/logger.js +3 -0
- package/lib/Utils/lt-hash.js +8 -0
- package/lib/Utils/make-mutex.js +33 -0
- package/lib/Utils/message-composer.js +273 -0
- package/lib/Utils/message-retry-manager.js +265 -0
- package/lib/Utils/messages-media.js +788 -0
- package/lib/Utils/messages.js +1260 -0
- package/lib/Utils/noise-handler.js +201 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/process-message.js +630 -0
- package/lib/Utils/reporting-utils.js +258 -0
- package/lib/Utils/signal.js +201 -0
- package/lib/Utils/stanza-ack.js +38 -0
- package/lib/Utils/sync-action-utils.js +49 -0
- package/lib/Utils/tc-token-utils.js +163 -0
- package/lib/Utils/use-multi-file-auth-state.js +121 -0
- package/lib/Utils/validate-connection.js +203 -0
- package/lib/WABinary/constants.js +1301 -0
- package/lib/WABinary/decode.js +262 -0
- package/lib/WABinary/encode.js +220 -0
- package/lib/WABinary/generic-utils.js +204 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/jid-utils.js +98 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.js +10 -0
- package/lib/WAM/constants.js +22853 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/index.js +4 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/index.js +6 -0
- package/lib/WAUSync/USyncQuery.js +98 -0
- package/lib/WAUSync/USyncUser.js +31 -0
- package/lib/WAUSync/index.js +4 -0
- package/lib/index.js +41 -0
- package/package.json +145 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 @iziBrothers
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
ATTRIBUTION AND PROVENANCE
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This project is a derivative work of Baileys
|
|
10
|
+
(https://github.com/WhiskeySockets/Baileys), released under the MIT
|
|
11
|
+
License. All modifications, extensions, and ongoing maintenance in this
|
|
12
|
+
repository are authored by @iziBrothers.
|
|
13
|
+
|
|
14
|
+
The following upstream copyright notices are preserved in full, as
|
|
15
|
+
required by the terms of the MIT License:
|
|
16
|
+
|
|
17
|
+
Copyright (c) 2021 Adhiraj Singh
|
|
18
|
+
Copyright (c) 2022-2026 WhiskeySockets and Baileys contributors
|
|
19
|
+
|
|
20
|
+
LICENSE TERMS
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
24
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
25
|
+
in the Software without restriction, including without limitation the rights
|
|
26
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
27
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
28
|
+
furnished to do so, subject to the following conditions:
|
|
29
|
+
|
|
30
|
+
The above copyright notice and this permission notice shall be included in all
|
|
31
|
+
copies or substantial portions of the Software.
|
|
32
|
+
|
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
34
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
35
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
36
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
37
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
38
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
|
+
SOFTWARE.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
DISCLAIMER OF AFFILIATION
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
This project is an independent, unofficial work. It is not affiliated
|
|
46
|
+
with, authorized, maintained, sponsored, or endorsed by WhatsApp LLC,
|
|
47
|
+
Meta Platforms, Inc., or any of their affiliates. All product names,
|
|
48
|
+
trademarks, and registered trademarks are the property of their
|
|
49
|
+
respective owners.
|
package/README.md
CHANGED
|
@@ -1,3 +1,520 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="https://ziperrimg2.lovable.app/f/kedfkhvk9d.jpg" width="480" alt="XkyuurBails Banner">
|
|
4
|
+
|
|
5
|
+
<h1>XkyuurBails</h1>
|
|
6
|
+
|
|
7
|
+
<p><b>WhatsApp Web library ringan berbasis Baileys</b><br>
|
|
8
|
+
Fokus pada pengelolaan pesan, raw message relay, dan utilitas tambahan untuk kebutuhan otomasi.</p>
|
|
9
|
+
|
|
10
|
+
<p>
|
|
11
|
+
<a href="https://nodejs.org/">
|
|
12
|
+
<img src="https://img.shields.io/badge/Node.js-%3E%3D20-7C3AED?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://github.com/whiskeysockets/Baileys">
|
|
15
|
+
<img src="https://img.shields.io/badge/Baileys-Based-A78BFA?style=for-the-badge" alt="Baileys">
|
|
16
|
+
</a>
|
|
17
|
+
<a href="LICENSE">
|
|
18
|
+
<img src="https://img.shields.io/badge/License-MIT-9333EA?style=for-the-badge" alt="License">
|
|
19
|
+
</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p>
|
|
23
|
+
<a href="#-fitur">Fitur</a> •
|
|
24
|
+
<a href="#-instalasi">Instalasi</a> •
|
|
25
|
+
<a href="#-quick-start">Quick Start</a> •
|
|
26
|
+
<a href="#-messaging">Messaging</a> •
|
|
27
|
+
<a href="#-raw-message-relay">Raw Relay</a> •
|
|
28
|
+
<a href="#-events">Events</a> •
|
|
29
|
+
<a href="#-authentication">Auth</a>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
> [!WARNING]
|
|
37
|
+
> **Tidak berafiliasi dengan WhatsApp LLC atau Meta Platforms.**
|
|
38
|
+
> Gunakan library ini secara bertanggung jawab dan patuhi [WhatsApp Terms of Service](https://www.whatsapp.com/legal/terms-of-service). Segala bentuk penyalahgunaan sepenuhnya menjadi tanggung jawab pengguna.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Daftar Isi
|
|
43
|
+
|
|
44
|
+
- [Fitur](#-fitur)
|
|
45
|
+
- [Persyaratan](#-persyaratan)
|
|
46
|
+
- [Instalasi](#-instalasi)
|
|
47
|
+
- [Quick Start](#-quick-start)
|
|
48
|
+
- [Messaging](#-messaging)
|
|
49
|
+
- [Raw Message Relay](#-raw-message-relay)
|
|
50
|
+
- [Events](#-events)
|
|
51
|
+
- [Authentication](#-authentication)
|
|
52
|
+
- [Contoh Lengkap](#-contoh-lengkap)
|
|
53
|
+
- [Thanks To](#-thanks-to)
|
|
54
|
+
- [Disclaimer](#-disclaimer)
|
|
55
|
+
- [License](#-license)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## </> Fitur
|
|
60
|
+
|
|
61
|
+
| Kategori | Kemampuan |
|
|
62
|
+
|----------|-----------|
|
|
63
|
+
| **Connection** | WhatsApp Web connection, QR authentication, Pairing code, Multi-device authentication |
|
|
64
|
+
| **Messaging** | `sendMessage`, `relayMessage`, `XyuSelf`, raw message support, custom message structure |
|
|
65
|
+
| **Events** | Event handling lengkap melalui `sock.ev` |
|
|
66
|
+
| **Utilities** | Utilitas tambahan untuk mempercepat development |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## </> Persyaratan
|
|
71
|
+
|
|
72
|
+
- **Node.js** `>= 20.0.0`
|
|
73
|
+
- **npm** `>= 9` (atau pnpm/yarn)
|
|
74
|
+
- Akun WhatsApp aktif (disarankan gunakan nomor sekunder untuk testing)
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## </> Instalasi
|
|
79
|
+
|
|
80
|
+
Tambahkan dependency ke `package.json`:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"dependencies": {
|
|
85
|
+
"izi-coder/baileys": latest",
|
|
86
|
+
"jimp": "^1.6.1"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Lalu install:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm install
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Atau langsung melalui CLI:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npm install izi-coder/baileys@latest
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Kemudian import di project kamu:
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
const { useMultiFileAuthState } = require('izi-coder/baileys')
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## </> Quick Start
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
const makeWASocket = require('izi-coder/baileys').default
|
|
115
|
+
const { useMultiFileAuthState } = require('izi-coder/baileys')
|
|
116
|
+
|
|
117
|
+
async function start() {
|
|
118
|
+
const { state, saveCreds } = await useMultiFileAuthState('./session')
|
|
119
|
+
|
|
120
|
+
const sock = makeWASocket({ auth: state })
|
|
121
|
+
|
|
122
|
+
sock.ev.on('creds.update', saveCreds)
|
|
123
|
+
|
|
124
|
+
sock.ev.on('connection.update', ({ connection }) => {
|
|
125
|
+
console.log('[ CONNECTION ]', connection)
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
start()
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## </> Messaging
|
|
135
|
+
|
|
136
|
+
### Text Message
|
|
137
|
+
|
|
138
|
+
```js
|
|
139
|
+
await sock.sendMessage('628xxxxxxxxxx@s.whatsapp.net', {
|
|
140
|
+
text: 'Hello'
|
|
141
|
+
})
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Image Message
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
await sock.sendMessage('628xxxxxxxxxx@s.whatsapp.net', {
|
|
148
|
+
image: { url: './image.jpg' },
|
|
149
|
+
caption: 'Hello'
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Video Message
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
await sock.sendMessage('628xxxxxxxxxx@s.whatsapp.net', {
|
|
157
|
+
video: { url: './video.mp4' },
|
|
158
|
+
caption: 'Hello'
|
|
159
|
+
})
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Order Message
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
const fs = require('fs')
|
|
166
|
+
const thumbnail = fs.readFileSync('./pouthumb.jpg')
|
|
167
|
+
|
|
168
|
+
await sock.sendMessage(m.chat, {
|
|
169
|
+
thumbnail,
|
|
170
|
+
message: 'Order summary',
|
|
171
|
+
orderTitle: 'My Store',
|
|
172
|
+
totalAmount1000: 72502,
|
|
173
|
+
totalCurrencyCode: 'IDR'
|
|
174
|
+
}, { quoted: m })
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Poll Result Snapshot
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
await sock.sendMessage(m.chat, {
|
|
181
|
+
pollResultMessage: {
|
|
182
|
+
name: 'My Poll',
|
|
183
|
+
options: [
|
|
184
|
+
{ optionName: 'Option 1' },
|
|
185
|
+
{ optionName: 'Option 2' }
|
|
186
|
+
],
|
|
187
|
+
newsletter: {
|
|
188
|
+
newsletterName: '0X8 - Society',
|
|
189
|
+
newsletterJid: '120363424944937940@newsletter'
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Product Message
|
|
196
|
+
|
|
197
|
+
```js
|
|
198
|
+
await sock.relayMessage(m.chat, {
|
|
199
|
+
productMessage: {
|
|
200
|
+
title: 'Product.pdf',
|
|
201
|
+
description: 'Product description',
|
|
202
|
+
thumbnail: { url: './pouthumb.jpg' },
|
|
203
|
+
productId: 'EXAMPLE_TOKEN',
|
|
204
|
+
retailerId: 'EXAMPLE_RETAILER_ID',
|
|
205
|
+
url: 'https://example.com',
|
|
206
|
+
body: 'Body text',
|
|
207
|
+
footer: 'Footer',
|
|
208
|
+
buttons: [
|
|
209
|
+
{
|
|
210
|
+
name: 'cta_url',
|
|
211
|
+
buttonParamsJson: '{"display_text":"Visit","url":"https://example.com"}'
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
priceAmount1000: 72502,
|
|
215
|
+
currencyCode: 'IDR'
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Interactive Message
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
await sock.sendMessage(m.chat, {
|
|
224
|
+
image: { url: './ximg.jpg' },
|
|
225
|
+
text: 'body',
|
|
226
|
+
title: 'title',
|
|
227
|
+
footer: 'footer',
|
|
228
|
+
interactiveButtons: [
|
|
229
|
+
{
|
|
230
|
+
name: 'single_select',
|
|
231
|
+
buttonParamsJson: JSON.stringify({ title: '\0' })
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
messageParams: JSON.stringify({
|
|
235
|
+
bottom_sheet: {
|
|
236
|
+
/* other params */
|
|
237
|
+
}
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Member Label
|
|
243
|
+
|
|
244
|
+
```js
|
|
245
|
+
await sock.sendMessage(m.chat, {
|
|
246
|
+
groupLabel: {
|
|
247
|
+
labelText: 'Tagged members appear here'
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Broadcast ke Member Grup
|
|
253
|
+
|
|
254
|
+
```js
|
|
255
|
+
await sock.sendMessageMembers(m.chat, {
|
|
256
|
+
extendedTextMessage: {
|
|
257
|
+
text: 'Hello members'
|
|
258
|
+
}
|
|
259
|
+
}, {})
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## </> Raw Message Relay
|
|
265
|
+
|
|
266
|
+
`relayMessage()` digunakan untuk mengirim raw message object secara langsung tanpa harus melalui helper tambahan. Cocok untuk mengirim struktur pesan kustom atau pesan yang tidak tersedia di `sendMessage`.
|
|
267
|
+
|
|
268
|
+
```js
|
|
269
|
+
await sock.relayMessage(target, message, {
|
|
270
|
+
messageId: message.key.id
|
|
271
|
+
})
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Opsi `XyuSelf`
|
|
275
|
+
|
|
276
|
+
`XyuSelf` adalah opsi khusus `relayMessage` untuk chat **private / 1-on-1** yang mengatur apakah pesan ikut disinkronkan ke perangkat lain milik akun sendiri.
|
|
277
|
+
|
|
278
|
+
| Nilai | Perilaku |
|
|
279
|
+
|-------|----------|
|
|
280
|
+
| `XyuSelf: true` | Pesan **tidak** disinkronkan ke perangkat lain milik pengirim |
|
|
281
|
+
| `XyuSelf: false` | Menggunakan perilaku sinkronisasi normal |
|
|
282
|
+
|
|
283
|
+
> Opsi ini **tidak** mengubah target penerima pesan.
|
|
284
|
+
|
|
285
|
+
```js
|
|
286
|
+
await sock.relayMessage(target, message, {
|
|
287
|
+
messageId: message.key.id,
|
|
288
|
+
XyuSelf: true
|
|
289
|
+
})
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
> [!NOTE]
|
|
293
|
+
> Perilaku sinkronisasi bergantung pada implementasi protokol WhatsApp dan sebaiknya diuji terlebih dahulu pada perangkat tertaut.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## </> Contoh Relay
|
|
298
|
+
|
|
299
|
+
### Conversation
|
|
300
|
+
|
|
301
|
+
```js
|
|
302
|
+
await sock.relayMessage(jid, {
|
|
303
|
+
conversation: 'Hello'
|
|
304
|
+
}, { XyuSelf: true })
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Extended Text
|
|
308
|
+
|
|
309
|
+
```js
|
|
310
|
+
await sock.relayMessage(jid, {
|
|
311
|
+
extendedTextMessage: {
|
|
312
|
+
text: 'Hello'
|
|
313
|
+
}
|
|
314
|
+
}, { XyuSelf: true })
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Image Message
|
|
318
|
+
|
|
319
|
+
```js
|
|
320
|
+
await sock.relayMessage(jid, {
|
|
321
|
+
imageMessage: {
|
|
322
|
+
url: './image.jpg',
|
|
323
|
+
caption: 'Hello'
|
|
324
|
+
}
|
|
325
|
+
}, { XyuSelf: true })
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Video Message
|
|
329
|
+
|
|
330
|
+
```js
|
|
331
|
+
await sock.relayMessage(jid, {
|
|
332
|
+
videoMessage: {
|
|
333
|
+
url: './video.mp4',
|
|
334
|
+
caption: 'Hello'
|
|
335
|
+
}
|
|
336
|
+
}, { XyuSelf: true })
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Custom Message
|
|
340
|
+
|
|
341
|
+
```js
|
|
342
|
+
await sock.relayMessage(jid, {
|
|
343
|
+
extendedTextMessage: {
|
|
344
|
+
text: 'Custom message',
|
|
345
|
+
contextInfo: {
|
|
346
|
+
mentionedJid: []
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}, { XyuSelf: true })
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## </> Events
|
|
355
|
+
|
|
356
|
+
Semua event tersedia melalui `sock.ev`.
|
|
357
|
+
|
|
358
|
+
### Connection Update
|
|
359
|
+
|
|
360
|
+
```js
|
|
361
|
+
sock.ev.on('connection.update', ({ connection }) => {
|
|
362
|
+
console.log('[ CONNECTION ]', connection)
|
|
363
|
+
})
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Incoming Message
|
|
367
|
+
|
|
368
|
+
```js
|
|
369
|
+
sock.ev.on('messages.upsert', ({ messages }) => {
|
|
370
|
+
for (const message of messages) {
|
|
371
|
+
console.log('[ INCOMING ]', message.message)
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Credentials
|
|
377
|
+
|
|
378
|
+
```js
|
|
379
|
+
sock.ev.on('creds.update', saveCreds)
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## </> Authentication
|
|
385
|
+
|
|
386
|
+
Session disimpan secara lokal pada folder yang ditentukan:
|
|
387
|
+
|
|
388
|
+
```text
|
|
389
|
+
session/
|
|
390
|
+
├── creds.json
|
|
391
|
+
├── app-state-sync-key-*.json
|
|
392
|
+
└── ...
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
> [!CAUTION]
|
|
396
|
+
> **Jangan pernah** meng-upload folder `session` ke repository publik. File tersebut berisi kredensial autentikasi akun kamu.
|
|
397
|
+
|
|
398
|
+
Tambahkan ke `.gitignore`:
|
|
399
|
+
|
|
400
|
+
```gitignore
|
|
401
|
+
session/
|
|
402
|
+
node_modules/
|
|
403
|
+
.env
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## </> Contoh Lengkap
|
|
409
|
+
|
|
410
|
+
```js
|
|
411
|
+
const makeWASocket = require('izi-coder/baileys').default
|
|
412
|
+
const { useMultiFileAuthState } = require('izi-coder/baileys')
|
|
413
|
+
|
|
414
|
+
async function start() {
|
|
415
|
+
const { state, saveCreds } = await useMultiFileAuthState('./session')
|
|
416
|
+
|
|
417
|
+
const sock = makeWASocket({ auth: state })
|
|
418
|
+
|
|
419
|
+
sock.ev.on('creds.update', saveCreds)
|
|
420
|
+
sock.ev.on('connection.update', ({ connection }) => {
|
|
421
|
+
console.log('[ CONNECTION ]', connection)
|
|
422
|
+
})
|
|
423
|
+
|
|
424
|
+
async function relay(jid, message) {
|
|
425
|
+
return sock.relayMessage(jid, message, {
|
|
426
|
+
messageId: message.key?.id,
|
|
427
|
+
XyuSelf: true
|
|
428
|
+
})
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return { sock, relay }
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
start().catch(console.error)
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## </> Thanks To
|
|
440
|
+
|
|
441
|
+
<div align="center">
|
|
442
|
+
|
|
443
|
+
<table>
|
|
444
|
+
<tr>
|
|
445
|
+
<td align="center" width="33%">
|
|
446
|
+
<a href="https://t.me/iziBrothers">
|
|
447
|
+
<img src="https://ziperrimg2.lovable.app/f/znsg5jjuvr.jpg" width="100" height="100" alt="íᴢìCódérs">
|
|
448
|
+
</a>
|
|
449
|
+
<br>
|
|
450
|
+
<b>íᴢìCódérs</b>
|
|
451
|
+
<br>
|
|
452
|
+
<sub>Developer</sub>
|
|
453
|
+
<br>
|
|
454
|
+
<a href="https://t.me/iziBrothers">@iziBrothers</a>
|
|
455
|
+
</td>
|
|
456
|
+
<td align="center" width="33%">
|
|
457
|
+
<a href="https://t.me/XzRzSynxC">
|
|
458
|
+
<img src="https://e.top4top.io/p_3967y77nb1.jpg" width="100" height="100" alt="println Rz">
|
|
459
|
+
</a>
|
|
460
|
+
<br>
|
|
461
|
+
<b>println!("Rz");</b>
|
|
462
|
+
<br>
|
|
463
|
+
<sub>Support</sub>
|
|
464
|
+
<br>
|
|
465
|
+
<a href="https://t.me/XzRzSynxC">@XzRzSynxC</a>
|
|
466
|
+
</td>
|
|
467
|
+
<td align="center" width="33%">
|
|
468
|
+
<a href="https://t.me/pouskibudi">
|
|
469
|
+
<img src="https://l.top4top.io/p_3967g0nxi1.jpg" width="100" height="100" alt="PouCode">
|
|
470
|
+
</a>
|
|
471
|
+
<br>
|
|
472
|
+
<b>PouCode</b>
|
|
473
|
+
<br>
|
|
474
|
+
<sub>Support</sub>
|
|
475
|
+
<br>
|
|
476
|
+
<a href="https://t.me/pouskibudi">@pouskibudi</a>
|
|
477
|
+
</td>
|
|
478
|
+
</tr>
|
|
479
|
+
</table>
|
|
480
|
+
|
|
481
|
+
</div>
|
|
482
|
+
|
|
483
|
+
### Credits
|
|
484
|
+
|
|
485
|
+
<div align="center">
|
|
486
|
+
|
|
487
|
+
**@iziBrothers** — Main Developer & Maintainer
|
|
488
|
+
<br>
|
|
489
|
+
Based on **[Baileys](https://github.com/whiskeysockets/Baileys)**
|
|
490
|
+
|
|
491
|
+
</div>
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
## </> Disclaimer
|
|
496
|
+
|
|
497
|
+
Project ini dibuat untuk keperluan **development** dan **educational**.
|
|
498
|
+
|
|
499
|
+
Developer tidak bertanggung jawab atas penyalahgunaan library, pembatasan akun, atau pelanggaran Terms of Service WhatsApp. Segala risiko penggunaan sepenuhnya menjadi tanggung jawab pengguna.
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
## </> License
|
|
504
|
+
|
|
505
|
+
Project ini dirilis di bawah **MIT License**.
|
|
506
|
+
Lihat file [`LICENSE`](LICENSE) untuk informasi lebih lanjut.
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
<div align="center">
|
|
511
|
+
|
|
512
|
+
<img src="https://img.shields.io/badge/XzBails-7C3AED?style=for-the-badge">
|
|
513
|
+
|
|
514
|
+
<br><br>
|
|
515
|
+
|
|
516
|
+
**XzBails**
|
|
517
|
+
|
|
518
|
+
<sub>Built with Baileys · Maintained by <a href="https://t.me/iziBrothers">@iziBrothers</a></sub>
|
|
519
|
+
|
|
520
|
+
</div>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify --no-comments -o ./index.js ./WAProto.proto;
|
|
2
|
+
yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify ./WAProto.proto | yarn pbts --no-comments -o ./index.d.ts -;
|
|
3
|
+
node ./fix-imports.js
|