zaileys 1.1.0 → 1.1.2
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 +47 -63
- package/dist/index.cjs +1 -1
- package/dist/{index.d.mts → index.d.cts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +18 -5
package/README.md
CHANGED
|
@@ -20,33 +20,27 @@
|
|
|
20
20
|
|
|
21
21
|
> **Zaileys** is a simplified, high-performance wrapper around the Baileys library for building WhatsApp bots and integrations with TypeScript/JavaScript. Designed for simplicity, speed, and scalability—perfect for beginners and pros alike.
|
|
22
22
|
|
|
23
|
-
---
|
|
24
|
-
|
|
25
23
|
## 📋 Table of Contents
|
|
26
24
|
|
|
27
25
|
1. [🚀 Features](#🚀-features)
|
|
28
26
|
2. [💻 Installation](#💻-installation)
|
|
29
27
|
3. [⚡ Quick Start](#⚡-quick-start)
|
|
28
|
+
- [Simplify Version](#simplify-version)
|
|
30
29
|
4. [🔍 Core Concepts](#🔍-core-concepts)
|
|
31
|
-
- [Client](#client)
|
|
32
30
|
- [Sessions & Authentication](#sessions--authentication)
|
|
33
|
-
- [Messages & Events](#messages--events)
|
|
34
31
|
- [Citation Concept](#citation-concept)
|
|
35
|
-
5. [
|
|
36
|
-
6. [
|
|
37
|
-
7. [
|
|
38
|
-
8. [👾 Worker Actions](#👾-worker-actions)
|
|
32
|
+
5. [📁 Examples](#📁-examples)
|
|
33
|
+
6. [📢 Event Handling](#📢-event-handling)
|
|
34
|
+
7. [👾 Worker Actions](#👾-worker-actions)
|
|
39
35
|
- [Sending Messages](#sending-messages)
|
|
40
36
|
- [Sending Media](#sending-media)
|
|
41
37
|
- [Presence Update](#presence-update)
|
|
42
38
|
- [Get Profile](#get-profile)
|
|
43
39
|
- [Reject Call](#reject-call)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
---
|
|
40
|
+
8. [🐞 Issues & Feedback](#🐞-issues--feedback)
|
|
41
|
+
9. [❤️ Funding & Support](#❤️-funding--support)
|
|
42
|
+
10. [📄 License](#📄-license)
|
|
43
|
+
11. [🙏 Acknowledgements](#🙏-acknowledgements)
|
|
50
44
|
|
|
51
45
|
## 🚀 Features
|
|
52
46
|
|
|
@@ -57,8 +51,6 @@
|
|
|
57
51
|
- 📟 **Live QRs**: Automatically generate and display WhatsApp QR codes in terminal.
|
|
58
52
|
- 🛠️ **TypeScript First**: Full type definitions (`.d.ts`) and zero-config TS support.
|
|
59
53
|
|
|
60
|
-
---
|
|
61
|
-
|
|
62
54
|
## 💻 Installation
|
|
63
55
|
|
|
64
56
|
Install with your preferred package manager:
|
|
@@ -82,18 +74,16 @@ deno add npm:zaileys
|
|
|
82
74
|
|
|
83
75
|
Ensure you are running Node.js **>= 18** as specified in `package.json`.
|
|
84
76
|
|
|
85
|
-
---
|
|
86
|
-
|
|
87
77
|
## ⚡ Quick Start
|
|
88
78
|
|
|
89
79
|
Basic usage of Zaileys based on [`test/example.ts`](https://github.com/zeative/zaileys/blob/main/test/example.ts):
|
|
90
80
|
|
|
91
81
|
```ts
|
|
92
82
|
// cjs
|
|
93
|
-
// const Client = require("zaileys");
|
|
83
|
+
// const { Client } = require("zaileys");
|
|
94
84
|
|
|
95
85
|
// esm
|
|
96
|
-
import Client from "zaileys";
|
|
86
|
+
import { Client } from "zaileys";
|
|
97
87
|
|
|
98
88
|
// the configuration below is the default
|
|
99
89
|
const wa = new Client({
|
|
@@ -146,21 +136,48 @@ wa.on("calls", (ctx) => {
|
|
|
146
136
|
});
|
|
147
137
|
```
|
|
148
138
|
|
|
149
|
-
|
|
139
|
+
### Simplify Version
|
|
150
140
|
|
|
151
|
-
|
|
141
|
+
```js
|
|
142
|
+
// auth with pairing code
|
|
143
|
+
const wa = new Client({
|
|
144
|
+
phoneNumber: 628123456789,
|
|
145
|
+
authType: "pairing",
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// auth with qr
|
|
149
|
+
const wa = new Client({
|
|
150
|
+
authType: "qr",
|
|
151
|
+
});
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
wa.on("messages", (ctx) => {
|
|
154
|
+
wa.reply("hello");
|
|
155
|
+
});
|
|
156
|
+
```
|
|
154
157
|
|
|
155
|
-
|
|
158
|
+
## 📁 Examples
|
|
159
|
+
|
|
160
|
+
Refer to [`test/example.ts`](https://github.com/zeative/zaileys/blob/main/test/example.ts) for complete example usage.
|
|
161
|
+
|
|
162
|
+
## 🔍 Core Concepts
|
|
156
163
|
|
|
157
164
|
### Sessions & Authentication
|
|
158
165
|
|
|
159
|
-
Zaileys persists authentication credentials in
|
|
166
|
+
Zaileys persists authentication credentials and session data in a configurable database (`sqlite`, `postgresql`, or `mysql`), ensuring seamless reconnection without repeated QR scans or pairing codes. This database-driven approach enhances flexibility by:
|
|
167
|
+
|
|
168
|
+
- **Unified Storage**: Store session data and authentication credentials in a single, structured database, enabling easy backup, migration, and scalability.
|
|
169
|
+
- **Flexible Data Management**: Query and manage session data directly via SQL, allowing custom integrations and advanced use cases.
|
|
160
170
|
|
|
161
|
-
|
|
171
|
+
Configure the database in the `Client` options:
|
|
162
172
|
|
|
163
|
-
|
|
173
|
+
```js
|
|
174
|
+
const wa = new Client({
|
|
175
|
+
database: {
|
|
176
|
+
type: "sqlite", // or 'postgresql' | 'mysql'
|
|
177
|
+
connection: { url: "./session/zaileys.db" }, // sqlite file path
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
```
|
|
164
181
|
|
|
165
182
|
#### Citation Concept
|
|
166
183
|
|
|
@@ -193,20 +210,6 @@ wa.on("messages", (ctx) => {
|
|
|
193
210
|
});
|
|
194
211
|
```
|
|
195
212
|
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## ⚙️ Configuration & Options
|
|
199
|
-
|
|
200
|
-
Pass low-level Baileys options via `baileysConfig` in your client options for advanced scenarios.
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## 📁 Examples
|
|
205
|
-
|
|
206
|
-
Refer to [`test/example.ts`](https://github.com/zeative/zaileys/blob/main/test/example.ts) for complete example usage.
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
213
|
## 📢 Event Handling
|
|
211
214
|
|
|
212
215
|
```js
|
|
@@ -220,8 +223,6 @@ wa.on("messages", (ctx) => {});
|
|
|
220
223
|
wa.on("calls", (ctx) => {});
|
|
221
224
|
```
|
|
222
225
|
|
|
223
|
-
---
|
|
224
|
-
|
|
225
226
|
## 👾 Worker Actions
|
|
226
227
|
|
|
227
228
|
### Sending Messages
|
|
@@ -255,11 +256,11 @@ wa.reaction("🐞", { message });
|
|
|
255
256
|
|
|
256
257
|
// editing message
|
|
257
258
|
const msg1 = await wa.text("Test edit", { roomId });
|
|
258
|
-
|
|
259
|
+
wa.edit("Editing success", { message: msg1?.message });
|
|
259
260
|
|
|
260
261
|
// deleting message
|
|
261
262
|
const msg2 = await wa.text("Test delete", { roomId });
|
|
262
|
-
|
|
263
|
+
wa.delete("Deleting success", { message: msg2?.message });
|
|
263
264
|
|
|
264
265
|
// sending location message
|
|
265
266
|
wa.location({ latitude: 24.121231, longitude: 55.1121221, ...other }, { roomId });
|
|
@@ -271,8 +272,6 @@ wa.contact({ fullname: "Kejaa", whatsAppNumber: 628123456789, ...other }, { room
|
|
|
271
272
|
wa.poll({ name: "Are you love me?", answers: ["yes", "maybe", "no"] }, { roomId });
|
|
272
273
|
```
|
|
273
274
|
|
|
274
|
-
---
|
|
275
|
-
|
|
276
275
|
### Sending Media
|
|
277
276
|
|
|
278
277
|
```js
|
|
@@ -302,8 +301,6 @@ wa.text({ audio: "https://qu.ax/oeSCG.ogg" }, { roomId });
|
|
|
302
301
|
wa.text({ audioNote: "https://qu.ax/oeSCG.ogg" }, { roomId });
|
|
303
302
|
```
|
|
304
303
|
|
|
305
|
-
---
|
|
306
|
-
|
|
307
304
|
### Presence Update
|
|
308
305
|
|
|
309
306
|
```js
|
|
@@ -312,8 +309,6 @@ wa.text({ audioNote: "https://qu.ax/oeSCG.ogg" }, { roomId });
|
|
|
312
309
|
wa.presence("typing", { roomId });
|
|
313
310
|
```
|
|
314
311
|
|
|
315
|
-
---
|
|
316
|
-
|
|
317
312
|
### Get Profile
|
|
318
313
|
|
|
319
314
|
```js
|
|
@@ -324,8 +319,6 @@ wa.profile("6281223456789@s.whatsapp.net");
|
|
|
324
319
|
wa.profile("1209999@g.us");
|
|
325
320
|
```
|
|
326
321
|
|
|
327
|
-
---
|
|
328
|
-
|
|
329
322
|
### Reject Call
|
|
330
323
|
|
|
331
324
|
```js
|
|
@@ -337,31 +330,22 @@ wa.on("calls", (ctx) => {
|
|
|
337
330
|
});
|
|
338
331
|
```
|
|
339
332
|
|
|
340
|
-
---
|
|
341
|
-
|
|
342
333
|
## 🐞 Issues & Feedback
|
|
343
334
|
|
|
344
335
|
If you encounter any problems or have feature requests, please open an issue:
|
|
345
336
|
[https://github.com/zeative/zaileys/issues](https://github.com/zeative/zaileys/issues)
|
|
346
337
|
|
|
347
|
-
---
|
|
348
|
-
|
|
349
338
|
## ❤️ Funding & Support
|
|
350
339
|
|
|
351
340
|
If you find Zaileys useful, consider supporting development:
|
|
352
341
|
|
|
353
|
-
- [Buy me a coffee ☕](https://
|
|
342
|
+
- [Buy me a coffee ☕](https://saweria.co/zaadevofc)
|
|
354
343
|
- ⭐ Star the repo on GitHub
|
|
355
|
-
- Spread the word
|
|
356
|
-
|
|
357
|
-
---
|
|
358
344
|
|
|
359
345
|
## 📄 License
|
|
360
346
|
|
|
361
347
|
Distributed under the **MIT License**. See [`LICENSE`](https://github.com/zeative/zaileys/blob/main/LICENSE) for details.
|
|
362
348
|
|
|
363
|
-
---
|
|
364
|
-
|
|
365
349
|
## 🙏 Acknowledgements
|
|
366
350
|
|
|
367
351
|
This project stands on the shoulders of the original [Baileys](https://github.com/WhiskeySockets/Baileys) library by Whiskey Sockets. Thank you for your incredible work and inspiration!"
|