zaileys 2.0.15 â 2.1.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 +103 -24
- package/dist/index.d.mts +96 -79
- package/dist/index.d.ts +96 -79
- package/dist/index.js +15 -15
- package/dist/index.mjs +15 -15
- package/package.json +77 -63
- package/tsconfig.json +1 -1
- package/.github/workflows/gsearch.yml +0 -56
package/README.MD
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
3
|
<img alt="Zaileys - Simplified WhatsApp Node.js TypeScript/JavaScript API" src="https://github.com/zeative/zeative/blob/main/libraries/zaileys/zaileys-clean.png?raw=true" width="140">
|
|
4
4
|
|
|
5
|
-
<h1 align="center">Zaileys - Simplified WhatsApp Node.js TypeScript/JavaScript API</h1>
|
|
5
|
+
<h1 align="center">Zaileys - Simplified WhatsApp Node.js <br /> TypeScript/JavaScript API</h1>
|
|
6
6
|
|
|
7
7
|
<br>
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<div align="center">
|
|
18
18
|
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/license/zeative/zaileys" alt="GitHub License"></a>
|
|
19
|
-
<a href="https://discord.gg/
|
|
19
|
+
<a href="https://discord.gg/KBHhTTVUc5"><img alt="Discord" src="https://img.shields.io/discord/1105833273415962654?logo=discord&label=discord&link=https%3A%2F%2Fgithub.com%2Fzeative%2Fzaileys"></a>
|
|
20
20
|
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/stars/zeative/zaileys" alt="GitHub Stars"></a>
|
|
21
21
|
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/forks/zeative/zaileys" alt="GitHub Forks"></a>
|
|
22
22
|
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/watchers/zeative/zaileys" alt="GitHub Watchers"></a>
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
|
|
26
26
|
<br>
|
|
27
27
|
|
|
28
|
-
<
|
|
29
|
-
<
|
|
28
|
+
<div align="center">
|
|
29
|
+
<p>
|
|
30
30
|
<b>Zaileys</b> is a powerful, type-safe wrapper around <a href="https://github.com/WhiskeySockets/Baileys">Baileys</a>, designed to simplify the development of WhatsApp bots. It provides a robust architecture with built-in state management, middleware support, and easy-to-use event handlers, making it perfect for building scalable and maintainable WhatsApp applications.
|
|
31
|
-
</
|
|
32
|
-
</
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
33
33
|
|
|
34
|
-
<
|
|
34
|
+
<div align="center">
|
|
35
35
|
|
|
36
36
|
[ð Overview](#-overview) âĒ
|
|
37
37
|
[ðŠķ Features](#-features) âĒ
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
|
|
51
51
|
<a href="https://discord.gg/SfnWWYUe"><img alt="Discord" src="https://discord.com/api/guilds/1105833273415962654/widget.png?style=banner2"></a>
|
|
52
52
|
|
|
53
|
-
</
|
|
53
|
+
</div>
|
|
54
54
|
|
|
55
|
-
</
|
|
55
|
+
</div>
|
|
56
56
|
|
|
57
57
|
<br>
|
|
58
58
|
|
|
@@ -66,16 +66,16 @@ Targeting **Node.js** and **TypeScript** developers, Zaileys integrates essentia
|
|
|
66
66
|
|
|
67
67
|
## ðŠķ Features
|
|
68
68
|
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
69
|
+
- â
**Type-Safe** - Full TypeScript + Zod validation with autocomplete
|
|
70
|
+
- â
**Middleware** - Intercept and process events globally
|
|
71
|
+
- â
**Plugin System** - Drop-in file-based plugins
|
|
72
|
+
- â
**State Management** - Built-in `JetDB` for data persistence with **auto chunking**
|
|
73
|
+
- â
**Event-Driven** - Clean listeners for `connection`, `messages`, `calls`
|
|
74
|
+
- â
**Rate Limiting** - Anti-spam protection out of the box
|
|
75
|
+
- â
**Auto-Everything** - Auto-read, auto-reject calls, auto-mentions
|
|
76
|
+
- â
**Multi-Device** - QR code or Pairing Code authentication
|
|
77
|
+
- â
**Built-in FFmpeg** - No external dependencies for media processing
|
|
78
|
+
- â
**Interactive Buttons** - Simple buttons, URL, copy code, call buttons, and lists
|
|
79
79
|
|
|
80
80
|
## ðĻ Concepts & Architecture
|
|
81
81
|
|
|
@@ -87,7 +87,7 @@ Targeting **Node.js** and **TypeScript** developers, Zaileys integrates essentia
|
|
|
87
87
|
|
|
88
88
|
**Plugins** - Drop files in `plugins/` directory. Auto-loaded, zero config.
|
|
89
89
|
|
|
90
|
-
**Store** - JSON database (`
|
|
90
|
+
**Store** - JSON database (`JetDB`) that auto-syncs chats, contacts, and messages.
|
|
91
91
|
|
|
92
92
|
## ðĶ Installation
|
|
93
93
|
|
|
@@ -103,7 +103,7 @@ yarn add zaileys
|
|
|
103
103
|
|
|
104
104
|
> **Note**: Requires Node.js v20+ and TypeScript for best experience.
|
|
105
105
|
|
|
106
|
-
> **FFmpeg**: No need to install FFmpeg separately! It's already bundled with Zaileys for seamless media processing (audio, video, stickers).
|
|
106
|
+
> **FFmpeg**: No need to install FFmpeg separately! It's already bundled with Zaileys for seamless media processing (audio, video, stickers). You can disabled it if you want at `Client Configuration`.
|
|
107
107
|
|
|
108
108
|
## ð Starter Kit
|
|
109
109
|
|
|
@@ -133,6 +133,13 @@ const wa = new Client({
|
|
|
133
133
|
|
|
134
134
|
// if you want to disable built-in ffmpeg
|
|
135
135
|
// disableFFmpeg: true,
|
|
136
|
+
|
|
137
|
+
sticker: {
|
|
138
|
+
authorName: 'your name',
|
|
139
|
+
packageName: 'package name',
|
|
140
|
+
quality: 80,
|
|
141
|
+
shape: 'circle', // output sticker must be circle
|
|
142
|
+
},
|
|
136
143
|
});
|
|
137
144
|
|
|
138
145
|
wa.on('messages', async (ctx) => {
|
|
@@ -142,6 +149,77 @@ wa.on('messages', async (ctx) => {
|
|
|
142
149
|
});
|
|
143
150
|
```
|
|
144
151
|
|
|
152
|
+
<details>
|
|
153
|
+
<summary>âĻ Structure of <b>ctx</b> on event listener <code>messages</code></summary>
|
|
154
|
+
|
|
155
|
+
```jsonc
|
|
156
|
+
{
|
|
157
|
+
"uniqueId": "Z4D3FCXXXXXXXXXXXXX",
|
|
158
|
+
"channelId": "Z4D3FCXXXXXXXXXXXXX",
|
|
159
|
+
|
|
160
|
+
"chatId": "ACAE07XXXXXXXXXXXXX",
|
|
161
|
+
"chatType": "text",
|
|
162
|
+
|
|
163
|
+
"receiverId": "628xxxxxxxx@s.whatsapp.net",
|
|
164
|
+
"receiverName": "Zaileys",
|
|
165
|
+
|
|
166
|
+
"roomId": "120xxxxxxxx@g.us",
|
|
167
|
+
"roomName": "Group Test",
|
|
168
|
+
"senderLid": "272xxxxxxxx@lid",
|
|
169
|
+
|
|
170
|
+
"senderId": "628xxxxxxxx@s.whatsapp.net",
|
|
171
|
+
"senderName": "hajel",
|
|
172
|
+
"senderDevice": "android",
|
|
173
|
+
|
|
174
|
+
"timestamp": 1766045633000,
|
|
175
|
+
"text": "World Hello! https://github.com/zeative/zaileys",
|
|
176
|
+
|
|
177
|
+
"mentions": ["@628xxxxxxxx", "@123xxxxxxxx"],
|
|
178
|
+
"links": ["https://github.com/zeative/zaileys"],
|
|
179
|
+
|
|
180
|
+
"isBot": false,
|
|
181
|
+
"isFromMe": false,
|
|
182
|
+
"isPrefix": false,
|
|
183
|
+
"isTagMe": false,
|
|
184
|
+
|
|
185
|
+
"isStatusMention": false,
|
|
186
|
+
"isGroupStatusMention": false,
|
|
187
|
+
"isHideTags": true,
|
|
188
|
+
|
|
189
|
+
"isSpam": false,
|
|
190
|
+
"isGroup": true,
|
|
191
|
+
"isNewsletter": false,
|
|
192
|
+
"isQuestion": false,
|
|
193
|
+
"isStory": false,
|
|
194
|
+
|
|
195
|
+
"isViewOnce": false,
|
|
196
|
+
"isEdited": false,
|
|
197
|
+
"isDeleted": false,
|
|
198
|
+
"isPinned": false,
|
|
199
|
+
"isUnPinned": false,
|
|
200
|
+
|
|
201
|
+
"isBroadcast": false,
|
|
202
|
+
"isEphemeral": false,
|
|
203
|
+
"isForwarded": false,
|
|
204
|
+
|
|
205
|
+
"citation": {
|
|
206
|
+
"authors": [AsyncFunction (anonymous)],
|
|
207
|
+
"banned": [AsyncFunction (anonymous)]
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
"media": {
|
|
211
|
+
// ...
|
|
212
|
+
// buffer promise
|
|
213
|
+
// stream promise
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
"message": [Function (anonymous)],
|
|
217
|
+
"replied": {} // MessagesContext
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
````
|
|
221
|
+
</details>
|
|
222
|
+
|
|
145
223
|
## ð ïļ Configuration
|
|
146
224
|
|
|
147
225
|
The `Client` constructor accepts a configuration object. Below are the valid options based on the library's type definitions.
|
|
@@ -174,7 +252,7 @@ These options apply to both authentication methods:
|
|
|
174
252
|
| :---------- | :------- | :------------------------------------------------------------------------------ |
|
|
175
253
|
| `limiter` | `object` | Rate limiting configuration. Default: `maxMessages: 20, durationMs: 10_000`. |
|
|
176
254
|
| `fakeReply` | `object` | Configuration for fake reply provider. |
|
|
177
|
-
| `sticker` | `object` | Default metadata for sticker creation (`packageName`, `authorName`, `quality`). |
|
|
255
|
+
| `sticker` | `object` | Default metadata for sticker creation (`packageName`, `authorName`, `quality`, `shape`). |
|
|
178
256
|
| `citation` | `object` | Custom citation sources. |
|
|
179
257
|
|
|
180
258
|
## ðĄ Advanced Usage
|
|
@@ -192,7 +270,7 @@ wa.use(async (ctx, next) => {
|
|
|
192
270
|
|
|
193
271
|
await next();
|
|
194
272
|
});
|
|
195
|
-
|
|
273
|
+
````
|
|
196
274
|
|
|
197
275
|
### ð§Đ Plugins
|
|
198
276
|
|
|
@@ -367,6 +445,7 @@ await wa.send(ctx.roomId, {
|
|
|
367
445
|
// support gif and video
|
|
368
446
|
await wa.send(ctx.roomId, {
|
|
369
447
|
sticker: 'https://example.com/sticker.mp4',
|
|
448
|
+
shape: 'circle', // default: 'default' | 'circle' | 'rounded' | 'oval'
|
|
370
449
|
});
|
|
371
450
|
```
|
|
372
451
|
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,8 @@ import * as baileys from 'baileys';
|
|
|
2
2
|
import baileys__default, { AuthenticationState, WAMessage, proto, ParticipantAction, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue } from 'baileys';
|
|
3
3
|
import * as Stream from 'stream';
|
|
4
4
|
import Stream__default from 'stream';
|
|
5
|
+
import { JetDB } from 'jetdb';
|
|
6
|
+
export { JetDB, JetDBOptions, createJetDB } from 'jetdb';
|
|
5
7
|
import z, { z as z$1 } from 'zod';
|
|
6
8
|
import _ from 'lodash';
|
|
7
9
|
|
|
@@ -31,6 +33,12 @@ declare const SignalOptionsType: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.Zo
|
|
|
31
33
|
ptv: z.ZodOptional<z.ZodBoolean>;
|
|
32
34
|
}, z.core.$loose>, z.ZodObject<{
|
|
33
35
|
sticker: z.ZodUnion<[z.ZodUnion<[z.ZodURL, z.ZodBase64]>, z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>;
|
|
36
|
+
shape: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
37
|
+
default: "default";
|
|
38
|
+
rounded: "rounded";
|
|
39
|
+
circle: "circle";
|
|
40
|
+
oval: "oval";
|
|
41
|
+
}>>>;
|
|
34
42
|
caption: z.ZodOptional<z.ZodString>;
|
|
35
43
|
}, z.core.$loose>, z.ZodObject<{
|
|
36
44
|
document: z.ZodUnion<[z.ZodUnion<[z.ZodURL, z.ZodBase64]>, z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>;
|
|
@@ -295,6 +303,7 @@ declare const DEVICE_ENUM_TYPES: z.ZodEnum<{
|
|
|
295
303
|
}>;
|
|
296
304
|
declare const MESSAGE_ENUM_TYPES: z.ZodEnum<{
|
|
297
305
|
text: "text";
|
|
306
|
+
album: "album";
|
|
298
307
|
image: "image";
|
|
299
308
|
contact: "contact";
|
|
300
309
|
location: "location";
|
|
@@ -306,6 +315,8 @@ declare const MESSAGE_ENUM_TYPES: z.ZodEnum<{
|
|
|
306
315
|
highlyStructured: "highlyStructured";
|
|
307
316
|
sendPayment: "sendPayment";
|
|
308
317
|
requestPayment: "requestPayment";
|
|
318
|
+
groupStatusMention: "groupStatusMention";
|
|
319
|
+
statusMention: "statusMention";
|
|
309
320
|
declinePaymentRequest: "declinePaymentRequest";
|
|
310
321
|
cancelPaymentRequest: "cancelPaymentRequest";
|
|
311
322
|
template: "template";
|
|
@@ -348,6 +359,7 @@ declare const BaseMessagesType: z.ZodObject<{
|
|
|
348
359
|
chatId: z.ZodString;
|
|
349
360
|
chatType: z.ZodEnum<{
|
|
350
361
|
text: "text";
|
|
362
|
+
album: "album";
|
|
351
363
|
image: "image";
|
|
352
364
|
contact: "contact";
|
|
353
365
|
location: "location";
|
|
@@ -359,6 +371,8 @@ declare const BaseMessagesType: z.ZodObject<{
|
|
|
359
371
|
highlyStructured: "highlyStructured";
|
|
360
372
|
sendPayment: "sendPayment";
|
|
361
373
|
requestPayment: "requestPayment";
|
|
374
|
+
groupStatusMention: "groupStatusMention";
|
|
375
|
+
statusMention: "statusMention";
|
|
362
376
|
declinePaymentRequest: "declinePaymentRequest";
|
|
363
377
|
cancelPaymentRequest: "cancelPaymentRequest";
|
|
364
378
|
template: "template";
|
|
@@ -418,6 +432,9 @@ declare const BaseMessagesType: z.ZodObject<{
|
|
|
418
432
|
isPrefix: z.ZodBoolean;
|
|
419
433
|
isSpam: z.ZodBoolean;
|
|
420
434
|
isTagMe: z.ZodBoolean;
|
|
435
|
+
isStatusMention: z.ZodBoolean;
|
|
436
|
+
isGroupStatusMention: z.ZodBoolean;
|
|
437
|
+
isHideTags: z.ZodBoolean;
|
|
421
438
|
isGroup: z.ZodBoolean;
|
|
422
439
|
isNewsletter: z.ZodBoolean;
|
|
423
440
|
isQuestion: z.ZodBoolean;
|
|
@@ -443,6 +460,7 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
443
460
|
chatId: z.ZodString;
|
|
444
461
|
chatType: z.ZodEnum<{
|
|
445
462
|
text: "text";
|
|
463
|
+
album: "album";
|
|
446
464
|
image: "image";
|
|
447
465
|
contact: "contact";
|
|
448
466
|
location: "location";
|
|
@@ -454,6 +472,8 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
454
472
|
highlyStructured: "highlyStructured";
|
|
455
473
|
sendPayment: "sendPayment";
|
|
456
474
|
requestPayment: "requestPayment";
|
|
475
|
+
groupStatusMention: "groupStatusMention";
|
|
476
|
+
statusMention: "statusMention";
|
|
457
477
|
declinePaymentRequest: "declinePaymentRequest";
|
|
458
478
|
cancelPaymentRequest: "cancelPaymentRequest";
|
|
459
479
|
template: "template";
|
|
@@ -513,6 +533,9 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
513
533
|
isPrefix: z.ZodBoolean;
|
|
514
534
|
isSpam: z.ZodBoolean;
|
|
515
535
|
isTagMe: z.ZodBoolean;
|
|
536
|
+
isStatusMention: z.ZodBoolean;
|
|
537
|
+
isGroupStatusMention: z.ZodBoolean;
|
|
538
|
+
isHideTags: z.ZodBoolean;
|
|
516
539
|
isGroup: z.ZodBoolean;
|
|
517
540
|
isNewsletter: z.ZodBoolean;
|
|
518
541
|
isQuestion: z.ZodBoolean;
|
|
@@ -537,6 +560,7 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
537
560
|
chatId: z.ZodString;
|
|
538
561
|
chatType: z.ZodEnum<{
|
|
539
562
|
text: "text";
|
|
563
|
+
album: "album";
|
|
540
564
|
image: "image";
|
|
541
565
|
contact: "contact";
|
|
542
566
|
location: "location";
|
|
@@ -548,6 +572,8 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
548
572
|
highlyStructured: "highlyStructured";
|
|
549
573
|
sendPayment: "sendPayment";
|
|
550
574
|
requestPayment: "requestPayment";
|
|
575
|
+
groupStatusMention: "groupStatusMention";
|
|
576
|
+
statusMention: "statusMention";
|
|
551
577
|
declinePaymentRequest: "declinePaymentRequest";
|
|
552
578
|
cancelPaymentRequest: "cancelPaymentRequest";
|
|
553
579
|
template: "template";
|
|
@@ -607,6 +633,9 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
607
633
|
isPrefix: z.ZodBoolean;
|
|
608
634
|
isSpam: z.ZodBoolean;
|
|
609
635
|
isTagMe: z.ZodBoolean;
|
|
636
|
+
isStatusMention: z.ZodBoolean;
|
|
637
|
+
isGroupStatusMention: z.ZodBoolean;
|
|
638
|
+
isHideTags: z.ZodBoolean;
|
|
610
639
|
isGroup: z.ZodBoolean;
|
|
611
640
|
isNewsletter: z.ZodBoolean;
|
|
612
641
|
isQuestion: z.ZodBoolean;
|
|
@@ -644,10 +673,22 @@ declare const FakeReplyType: z$1.ZodOptional<z$1.ZodObject<{
|
|
|
644
673
|
tiktok: "tiktok";
|
|
645
674
|
}>, z$1.ZodNumber]>;
|
|
646
675
|
}, z$1.core.$strip>>;
|
|
676
|
+
declare const StickerShapeType: z$1.ZodDefault<z$1.ZodEnum<{
|
|
677
|
+
default: "default";
|
|
678
|
+
rounded: "rounded";
|
|
679
|
+
circle: "circle";
|
|
680
|
+
oval: "oval";
|
|
681
|
+
}>>;
|
|
647
682
|
declare const StickerMetadataType: z$1.ZodOptional<z$1.ZodObject<{
|
|
648
683
|
packageName: z$1.ZodString;
|
|
649
684
|
authorName: z$1.ZodString;
|
|
650
685
|
quality: z$1.ZodNumber;
|
|
686
|
+
shape: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodEnum<{
|
|
687
|
+
default: "default";
|
|
688
|
+
rounded: "rounded";
|
|
689
|
+
circle: "circle";
|
|
690
|
+
oval: "oval";
|
|
691
|
+
}>>>;
|
|
651
692
|
}, z$1.core.$strip>>;
|
|
652
693
|
declare const ClientBaseType: z$1.ZodObject<{
|
|
653
694
|
session: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
|
|
@@ -681,6 +722,12 @@ declare const ClientBaseType: z$1.ZodObject<{
|
|
|
681
722
|
packageName: z$1.ZodString;
|
|
682
723
|
authorName: z$1.ZodString;
|
|
683
724
|
quality: z$1.ZodNumber;
|
|
725
|
+
shape: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodEnum<{
|
|
726
|
+
default: "default";
|
|
727
|
+
rounded: "rounded";
|
|
728
|
+
circle: "circle";
|
|
729
|
+
oval: "oval";
|
|
730
|
+
}>>>;
|
|
684
731
|
}, z$1.core.$strip>>;
|
|
685
732
|
}, z$1.core.$strip>;
|
|
686
733
|
declare const ClientAuthPairingType: z$1.ZodObject<{
|
|
@@ -724,6 +771,12 @@ declare const ClientOptionsType: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
|
724
771
|
packageName: z$1.ZodString;
|
|
725
772
|
authorName: z$1.ZodString;
|
|
726
773
|
quality: z$1.ZodNumber;
|
|
774
|
+
shape: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodEnum<{
|
|
775
|
+
default: "default";
|
|
776
|
+
rounded: "rounded";
|
|
777
|
+
circle: "circle";
|
|
778
|
+
oval: "oval";
|
|
779
|
+
}>>>;
|
|
727
780
|
}, z$1.core.$strip>>;
|
|
728
781
|
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
729
782
|
authType: z$1.ZodLiteral<"qr">;
|
|
@@ -758,6 +811,12 @@ declare const ClientOptionsType: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
|
758
811
|
packageName: z$1.ZodString;
|
|
759
812
|
authorName: z$1.ZodString;
|
|
760
813
|
quality: z$1.ZodNumber;
|
|
814
|
+
shape: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodEnum<{
|
|
815
|
+
default: "default";
|
|
816
|
+
rounded: "rounded";
|
|
817
|
+
circle: "circle";
|
|
818
|
+
oval: "oval";
|
|
819
|
+
}>>>;
|
|
761
820
|
}, z$1.core.$strip>>;
|
|
762
821
|
}, z$1.core.$strip>]>;
|
|
763
822
|
declare const EventEnumType: z$1.ZodEnum<{
|
|
@@ -901,6 +960,30 @@ declare class MessageCollector {
|
|
|
901
960
|
cancel(channelId: string): ParsedMessage[];
|
|
902
961
|
}
|
|
903
962
|
|
|
963
|
+
interface HealthOptions {
|
|
964
|
+
checkIntervalMs?: number;
|
|
965
|
+
staleThresholdMs?: number;
|
|
966
|
+
cooldownMs?: number;
|
|
967
|
+
maxRetries?: number;
|
|
968
|
+
}
|
|
969
|
+
declare class HealthManager {
|
|
970
|
+
private client;
|
|
971
|
+
private lastActivityTime;
|
|
972
|
+
private lastRecoveryTime;
|
|
973
|
+
private checkInterval;
|
|
974
|
+
private isRecovering;
|
|
975
|
+
private retryCount;
|
|
976
|
+
private options;
|
|
977
|
+
constructor(client: Client, options?: HealthOptions);
|
|
978
|
+
start(): void;
|
|
979
|
+
stop(): void;
|
|
980
|
+
touch(): void;
|
|
981
|
+
private setupActivityListeners;
|
|
982
|
+
private check;
|
|
983
|
+
private isInCooldown;
|
|
984
|
+
recover(): Promise<void>;
|
|
985
|
+
}
|
|
986
|
+
|
|
904
987
|
declare class Logs {
|
|
905
988
|
private client;
|
|
906
989
|
private logsInitialized;
|
|
@@ -961,25 +1044,23 @@ declare class Client {
|
|
|
961
1044
|
options: z.infer<typeof ClientOptionsType>;
|
|
962
1045
|
private listener;
|
|
963
1046
|
private _ready;
|
|
964
|
-
|
|
1047
|
+
health: HealthManager;
|
|
965
1048
|
logs: Logs;
|
|
966
1049
|
collector: MessageCollector;
|
|
967
1050
|
middleware: Middleware<any>;
|
|
968
1051
|
plugins: Plugins;
|
|
969
1052
|
constructor(options: z.infer<typeof ClientOptionsType>);
|
|
970
1053
|
initialize(client?: Client): Promise<void>;
|
|
971
|
-
private prekeyDetected;
|
|
972
|
-
private setupPrekeyErrorDetection;
|
|
973
1054
|
ready(): Promise<void>;
|
|
974
|
-
db(path: string):
|
|
1055
|
+
db(path: string): JetDB;
|
|
975
1056
|
on<T extends z.infer<typeof EventEnumType>>(event: T, handler: EventCallbackType[T]): void;
|
|
976
1057
|
use<T>(handler: MiddlewareHandler<T>): this;
|
|
977
1058
|
get socket(): ReturnType<typeof baileys__default>;
|
|
978
|
-
getMessageByChatId(chatId: string): Promise<Partial<{
|
|
1059
|
+
getMessageByChatId(chatId: string, media?: proto.IMessage): Promise<Partial<{
|
|
979
1060
|
channelId: string;
|
|
980
1061
|
uniqueId: string;
|
|
981
1062
|
chatId: string;
|
|
982
|
-
chatType: "text" | "image" | "contact" | "location" | "document" | "audio" | "video" | "protocol" | "contacts" | "highlyStructured" | "sendPayment" | "requestPayment" | "declinePaymentRequest" | "cancelPaymentRequest" | "template" | "sticker" | "groupInvite" | "product" | "deviceSent" | "lists" | "viewOnce" | "order" | "ephemeral" | "invoice" | "buttons" | "paymentInvite" | "interactive" | "reaction" | "interactiveResponse" | "pollCreation" | "pollUpdate" | "keepInChat" | "requestPhoneNumber" | "scheduledCallCreation" | "groupMentioned" | "pinInChat" | "scheduledCallEdit" | "ptv" | "botInvoke" | "callLog" | "encComment" | "bcall" | "lottieSticker" | "event" | "comment" | "placeholder" | "encEventUpdate";
|
|
1063
|
+
chatType: "text" | "album" | "image" | "contact" | "location" | "document" | "audio" | "video" | "protocol" | "contacts" | "highlyStructured" | "sendPayment" | "requestPayment" | "groupStatusMention" | "statusMention" | "declinePaymentRequest" | "cancelPaymentRequest" | "template" | "sticker" | "groupInvite" | "product" | "deviceSent" | "lists" | "viewOnce" | "order" | "ephemeral" | "invoice" | "buttons" | "paymentInvite" | "interactive" | "reaction" | "interactiveResponse" | "pollCreation" | "pollUpdate" | "keepInChat" | "requestPhoneNumber" | "scheduledCallCreation" | "groupMentioned" | "pinInChat" | "scheduledCallEdit" | "ptv" | "botInvoke" | "callLog" | "encComment" | "bcall" | "lottieSticker" | "event" | "comment" | "placeholder" | "encEventUpdate";
|
|
983
1064
|
receiverId: string;
|
|
984
1065
|
receiverName: string;
|
|
985
1066
|
roomId: string;
|
|
@@ -996,6 +1077,9 @@ declare class Client {
|
|
|
996
1077
|
isPrefix: boolean;
|
|
997
1078
|
isSpam: boolean;
|
|
998
1079
|
isTagMe: boolean;
|
|
1080
|
+
isStatusMention: boolean;
|
|
1081
|
+
isGroupStatusMention: boolean;
|
|
1082
|
+
isHideTags: boolean;
|
|
999
1083
|
isGroup: boolean;
|
|
1000
1084
|
isNewsletter: boolean;
|
|
1001
1085
|
isQuestion: boolean;
|
|
@@ -1020,7 +1104,7 @@ declare class Client {
|
|
|
1020
1104
|
channelId: string;
|
|
1021
1105
|
uniqueId: string;
|
|
1022
1106
|
chatId: string;
|
|
1023
|
-
chatType: "text" | "image" | "contact" | "location" | "document" | "audio" | "video" | "protocol" | "contacts" | "highlyStructured" | "sendPayment" | "requestPayment" | "declinePaymentRequest" | "cancelPaymentRequest" | "template" | "sticker" | "groupInvite" | "product" | "deviceSent" | "lists" | "viewOnce" | "order" | "ephemeral" | "invoice" | "buttons" | "paymentInvite" | "interactive" | "reaction" | "interactiveResponse" | "pollCreation" | "pollUpdate" | "keepInChat" | "requestPhoneNumber" | "scheduledCallCreation" | "groupMentioned" | "pinInChat" | "scheduledCallEdit" | "ptv" | "botInvoke" | "callLog" | "encComment" | "bcall" | "lottieSticker" | "event" | "comment" | "placeholder" | "encEventUpdate";
|
|
1107
|
+
chatType: "text" | "album" | "image" | "contact" | "location" | "document" | "audio" | "video" | "protocol" | "contacts" | "highlyStructured" | "sendPayment" | "requestPayment" | "groupStatusMention" | "statusMention" | "declinePaymentRequest" | "cancelPaymentRequest" | "template" | "sticker" | "groupInvite" | "product" | "deviceSent" | "lists" | "viewOnce" | "order" | "ephemeral" | "invoice" | "buttons" | "paymentInvite" | "interactive" | "reaction" | "interactiveResponse" | "pollCreation" | "pollUpdate" | "keepInChat" | "requestPhoneNumber" | "scheduledCallCreation" | "groupMentioned" | "pinInChat" | "scheduledCallEdit" | "ptv" | "botInvoke" | "callLog" | "encComment" | "bcall" | "lottieSticker" | "event" | "comment" | "placeholder" | "encEventUpdate";
|
|
1024
1108
|
receiverId: string;
|
|
1025
1109
|
receiverName: string;
|
|
1026
1110
|
roomId: string;
|
|
@@ -1037,6 +1121,9 @@ declare class Client {
|
|
|
1037
1121
|
isPrefix: boolean;
|
|
1038
1122
|
isSpam: boolean;
|
|
1039
1123
|
isTagMe: boolean;
|
|
1124
|
+
isStatusMention: boolean;
|
|
1125
|
+
isGroupStatusMention: boolean;
|
|
1126
|
+
isHideTags: boolean;
|
|
1040
1127
|
isGroup: boolean;
|
|
1041
1128
|
isNewsletter: boolean;
|
|
1042
1129
|
isQuestion: boolean;
|
|
@@ -1065,48 +1152,6 @@ declare class Client {
|
|
|
1065
1152
|
|
|
1066
1153
|
declare const registerAuthCreds: (client: Client) => Promise<void>;
|
|
1067
1154
|
|
|
1068
|
-
type FlushMode = 'manual' | 'sync' | 'debounce';
|
|
1069
|
-
declare class Lowdb {
|
|
1070
|
-
private data;
|
|
1071
|
-
private path;
|
|
1072
|
-
private pool;
|
|
1073
|
-
private size;
|
|
1074
|
-
private chunkDir;
|
|
1075
|
-
private replacer;
|
|
1076
|
-
private reviver;
|
|
1077
|
-
private loaded;
|
|
1078
|
-
private flushMode;
|
|
1079
|
-
private debounceMs;
|
|
1080
|
-
private flushTimer;
|
|
1081
|
-
private dirty;
|
|
1082
|
-
constructor(path: string, bufferJSON?: any, size?: number, flushMode?: FlushMode, debounceMs?: number);
|
|
1083
|
-
private ensureLoaded;
|
|
1084
|
-
private scheduleFlush;
|
|
1085
|
-
read(): Promise<Map<string, any>>;
|
|
1086
|
-
write(): Promise<void>;
|
|
1087
|
-
set<T>(key: string, value: T): Promise<void>;
|
|
1088
|
-
push<T>(key: string, value: T): Promise<void>;
|
|
1089
|
-
upsert<T extends {
|
|
1090
|
-
key?: {
|
|
1091
|
-
id?: string;
|
|
1092
|
-
};
|
|
1093
|
-
id?: string;
|
|
1094
|
-
}>(key: string, value: T, idKey?: string): Promise<void>;
|
|
1095
|
-
get(key?: string | object): Promise<any>;
|
|
1096
|
-
all(): Promise<any>;
|
|
1097
|
-
delete(key: string): Promise<boolean>;
|
|
1098
|
-
private saveChunk;
|
|
1099
|
-
private loadChunk;
|
|
1100
|
-
private delChunk;
|
|
1101
|
-
private isMeta;
|
|
1102
|
-
}
|
|
1103
|
-
declare const createLowdb: (path: string, options?: {
|
|
1104
|
-
BufferJSON?: any;
|
|
1105
|
-
size?: number;
|
|
1106
|
-
flushMode?: FlushMode;
|
|
1107
|
-
debounceMs?: number;
|
|
1108
|
-
}) => Lowdb;
|
|
1109
|
-
|
|
1110
1155
|
declare const ignoreLint: (data: any) => any;
|
|
1111
1156
|
declare const getLatestLibVersion: () => Promise<any>;
|
|
1112
1157
|
declare const removeAuthCreds: (session: string) => Promise<void>;
|
|
@@ -1146,7 +1191,7 @@ declare class VideoProcessor {
|
|
|
1146
1191
|
}
|
|
1147
1192
|
declare class ImageProcessor {
|
|
1148
1193
|
static getThumbnail(buffer: Buffer): Promise<string>;
|
|
1149
|
-
static resizeForSticker(buffer: Buffer, quality: number): Promise<Buffer>;
|
|
1194
|
+
static resizeForSticker(buffer: Buffer, quality: number, shape?: string): Promise<Buffer>;
|
|
1150
1195
|
}
|
|
1151
1196
|
declare class MediaProcessor {
|
|
1152
1197
|
static getThumbnail(input: MediaInput): Promise<string>;
|
|
@@ -1183,32 +1228,4 @@ declare const cleanupSocket: (socket: WASocket) => void;
|
|
|
1183
1228
|
declare const repairSessionKeys: (session: string) => Promise<void>;
|
|
1184
1229
|
declare const getExistingSocket: () => WASocket | null;
|
|
1185
1230
|
|
|
1186
|
-
type
|
|
1187
|
-
session: string;
|
|
1188
|
-
checkIntervalMs?: number;
|
|
1189
|
-
staleThresholdMs?: number;
|
|
1190
|
-
cooldownMs?: number;
|
|
1191
|
-
maxRetries?: number;
|
|
1192
|
-
onRecovery?: () => Promise<void>;
|
|
1193
|
-
};
|
|
1194
|
-
declare class SessionWatchdog {
|
|
1195
|
-
private lastActivityTime;
|
|
1196
|
-
private lastRecoveryTime;
|
|
1197
|
-
private checkInterval;
|
|
1198
|
-
private isRecovering;
|
|
1199
|
-
private retryCount;
|
|
1200
|
-
private options;
|
|
1201
|
-
constructor(options: WatchdogOptions);
|
|
1202
|
-
start(): void;
|
|
1203
|
-
stop(): void;
|
|
1204
|
-
touch(): void;
|
|
1205
|
-
private setupActivityListeners;
|
|
1206
|
-
private check;
|
|
1207
|
-
private isInCooldown;
|
|
1208
|
-
private recover;
|
|
1209
|
-
forceRecovery(): Promise<void>;
|
|
1210
|
-
}
|
|
1211
|
-
declare const createWatchdog: (options: WatchdogOptions) => SessionWatchdog;
|
|
1212
|
-
declare const getWatchdog: () => SessionWatchdog | null;
|
|
1213
|
-
|
|
1214
|
-
export { AudioProcessor, type AudioType, BaseMessagesType, ButtonInteractiveCallType, ButtonInteractiveCopyType, ButtonInteractiveReplyType, ButtonInteractiveSingleSelectType, ButtonInteractiveType, ButtonInteractiveUrlType, ButtonSimpleType, ButtonType, type CallsContext, CitationType, Client, ClientAuthPairingType, ClientAuthQRType, ClientBaseType, ClientOptionsType, type ConnectionContext, DEVICE_ENUM_TYPES, DocumentProcessor, type EventCallbackType, EventEnumType, FakeReplyType, ImageProcessor, LimiterType, ListenerCallsType, ListenerConnectionType, ListenerMessagesType, Lowdb, MESSAGE_ENUM_TYPES, MediaProcessor, type MessagesContext, type PluginDefinition, Plugins, type PluginsConfigType, type PluginsHandlerType, SessionWatchdog, StickerMetadataType, StickerProcessor, VideoProcessor, cleanJid, cleanMediaObject, cleanupSocket, configureFFmpeg, createLowdb, createWatchdog, definePlugins, extractJids, extractUrls, findGlobalWord, findNestedByKeys, generateId, getDeepContent, getExistingSocket, getLatestLibVersion, getMediaThumbnail, getUsersMentions, getVideoDuration, getVideoThumbnail, getWaAudio, getWaDocument, getWaSticker, getWatchdog, ignoreLint, logColor, modifyFn, normalizeText, numbersToJids, pickKeysFromArray, randomize, registerAuthCreds, removeAuthCreds, repairSessionKeys, shuffleString, toBuffer, toJson, toString, useAuthState };
|
|
1231
|
+
export { AudioProcessor, type AudioType, BaseMessagesType, ButtonInteractiveCallType, ButtonInteractiveCopyType, ButtonInteractiveReplyType, ButtonInteractiveSingleSelectType, ButtonInteractiveType, ButtonInteractiveUrlType, ButtonSimpleType, ButtonType, type CallsContext, CitationType, Client, ClientAuthPairingType, ClientAuthQRType, ClientBaseType, ClientOptionsType, type ConnectionContext, DEVICE_ENUM_TYPES, DocumentProcessor, type EventCallbackType, EventEnumType, FakeReplyType, ImageProcessor, LimiterType, ListenerCallsType, ListenerConnectionType, ListenerMessagesType, MESSAGE_ENUM_TYPES, MediaProcessor, type MessagesContext, type PluginDefinition, Plugins, type PluginsConfigType, type PluginsHandlerType, StickerMetadataType, StickerProcessor, StickerShapeType, VideoProcessor, cleanJid, cleanMediaObject, cleanupSocket, configureFFmpeg, definePlugins, extractJids, extractUrls, findGlobalWord, findNestedByKeys, generateId, getDeepContent, getExistingSocket, getLatestLibVersion, getMediaThumbnail, getUsersMentions, getVideoDuration, getVideoThumbnail, getWaAudio, getWaDocument, getWaSticker, ignoreLint, logColor, modifyFn, normalizeText, numbersToJids, pickKeysFromArray, randomize, registerAuthCreds, removeAuthCreds, repairSessionKeys, shuffleString, toBuffer, toJson, toString, useAuthState };
|