zaileys 1.1.40-tx.8 → 1.1.40-tx.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 +21 -0
- package/README.MD +713 -0
- package/dist/index.d.mts +413 -17
- package/dist/index.d.ts +413 -17
- package/dist/index.js +24 -5
- package/dist/index.mjs +24 -5
- package/package.json +15 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,169 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as baileys from 'baileys';
|
|
2
|
+
import { AuthenticationState, WAMessage, proto, ParticipantAction } from 'baileys';
|
|
2
3
|
import z, { z as z$1 } from 'zod';
|
|
4
|
+
import _ from 'lodash';
|
|
3
5
|
|
|
4
6
|
declare const useAuthState: (folder: string) => Promise<{
|
|
5
7
|
state: AuthenticationState;
|
|
6
8
|
saveCreds: () => Promise<void>;
|
|
7
9
|
}>;
|
|
8
10
|
|
|
11
|
+
declare const SignalType: z.ZodEnum<{
|
|
12
|
+
delete: "delete";
|
|
13
|
+
forward: "forward";
|
|
14
|
+
button: "button";
|
|
15
|
+
edit: "edit";
|
|
16
|
+
}>;
|
|
17
|
+
declare const SignalOptionsType: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodUnion<readonly [z.ZodObject<{
|
|
18
|
+
text: z.ZodString;
|
|
19
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
20
|
+
image: z.ZodUnion<[z.ZodUnion<[z.ZodURL, z.ZodBase64]>, z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>;
|
|
21
|
+
caption: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
23
|
+
audio: z.ZodUnion<[z.ZodUnion<[z.ZodURL, z.ZodBase64]>, z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>;
|
|
24
|
+
caption: z.ZodOptional<z.ZodString>;
|
|
25
|
+
ptt: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
27
|
+
video: z.ZodUnion<[z.ZodUnion<[z.ZodURL, z.ZodBase64]>, z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>;
|
|
28
|
+
caption: z.ZodOptional<z.ZodString>;
|
|
29
|
+
ptv: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
31
|
+
sticker: z.ZodUnion<[z.ZodUnion<[z.ZodURL, z.ZodBase64]>, z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>;
|
|
32
|
+
caption: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
34
|
+
document: z.ZodUnion<[z.ZodUnion<[z.ZodURL, z.ZodBase64]>, z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>;
|
|
35
|
+
caption: z.ZodOptional<z.ZodString>;
|
|
36
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
38
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
latitude: z.ZodNumber;
|
|
40
|
+
longitude: z.ZodNumber;
|
|
41
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
42
|
+
title: z.ZodOptional<z.ZodString>;
|
|
43
|
+
footer: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
46
|
+
title: z.ZodOptional<z.ZodString>;
|
|
47
|
+
contacts: z.ZodArray<z.ZodObject<{
|
|
48
|
+
fullname: z.ZodString;
|
|
49
|
+
phoneNumber: z.ZodNumber;
|
|
50
|
+
organization: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
poll: z.ZodObject<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
answers: z.ZodArray<z.ZodString>;
|
|
56
|
+
isMultiple: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
}, z.core.$strip>]>, z.ZodObject<{
|
|
59
|
+
isViewOnce: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
replied: z.ZodOptional<z.ZodCustom<WAMessage, WAMessage>>;
|
|
61
|
+
isForwardedMany: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
banner: z.ZodOptional<z.ZodCustom<proto.ContextInfo.IExternalAdReplyInfo, proto.ContextInfo.IExternalAdReplyInfo>>;
|
|
63
|
+
}, z.core.$strip>>]>;
|
|
64
|
+
declare const ButtonOptionsType: z.ZodIntersection<z.ZodObject<{
|
|
65
|
+
text: z.ZodString;
|
|
66
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
67
|
+
buttons: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"simple">;
|
|
69
|
+
footer: z.ZodOptional<z.ZodString>;
|
|
70
|
+
data: z.ZodArray<z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
text: z.ZodString;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"interactive">;
|
|
76
|
+
footer: z.ZodOptional<z.ZodString>;
|
|
77
|
+
data: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
78
|
+
type: z.ZodLiteral<"quick_reply">;
|
|
79
|
+
text: z.ZodString;
|
|
80
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
+
type: z.ZodLiteral<"cta_url">;
|
|
82
|
+
url: z.ZodURL;
|
|
83
|
+
text: z.ZodString;
|
|
84
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
85
|
+
type: z.ZodLiteral<"cta_copy">;
|
|
86
|
+
copy: z.ZodString;
|
|
87
|
+
text: z.ZodString;
|
|
88
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"cta_call">;
|
|
90
|
+
text: z.ZodString;
|
|
91
|
+
phoneNumber: z.ZodString;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
type: z.ZodLiteral<"single_select">;
|
|
94
|
+
text: z.ZodString;
|
|
95
|
+
section: z.ZodArray<z.ZodObject<{
|
|
96
|
+
title: z.ZodString;
|
|
97
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
98
|
+
id: z.ZodString;
|
|
99
|
+
title: z.ZodString;
|
|
100
|
+
header: z.ZodOptional<z.ZodString>;
|
|
101
|
+
description: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
}, z.core.$strip>]>>;
|
|
105
|
+
}, z.core.$strip>]>>;
|
|
106
|
+
isViewOnce: z.ZodOptional<z.ZodBoolean>;
|
|
107
|
+
replied: z.ZodOptional<z.ZodCustom<WAMessage, WAMessage>>;
|
|
108
|
+
isForwardedMany: z.ZodOptional<z.ZodBoolean>;
|
|
109
|
+
}, z.core.$strip>>;
|
|
110
|
+
|
|
111
|
+
declare class Signal {
|
|
112
|
+
protected client: Client;
|
|
113
|
+
constructor(client: Client);
|
|
114
|
+
protected signal(roomId: string, options: z.infer<typeof SignalOptionsType>, type?: z.infer<typeof SignalType>, message?: WAMessage): Promise<WAMessage>;
|
|
115
|
+
send(roomId: string, options: z.infer<typeof SignalOptionsType>): Promise<WAMessage>;
|
|
116
|
+
forward(roomId: string, options: z.infer<typeof SignalOptionsType>): Promise<WAMessage>;
|
|
117
|
+
button(roomId: string, options: z.infer<typeof ButtonOptionsType>): Promise<WAMessage>;
|
|
118
|
+
edit(message: WAMessage, options: z.infer<typeof SignalOptionsType>): Promise<WAMessage>;
|
|
119
|
+
delete(message: WAMessage | WAMessage[]): Promise<WAMessage | (baileys.proto.IWebMessageInfo & {
|
|
120
|
+
key: baileys.WAMessageKey;
|
|
121
|
+
messageStubParameters?: any;
|
|
122
|
+
category?: string;
|
|
123
|
+
retryCount?: number;
|
|
124
|
+
})[]>;
|
|
125
|
+
presence(roomId: string, type: 'typing' | 'recording' | 'online' | 'offline' | 'paused'): Promise<void>;
|
|
126
|
+
reaction(message: WAMessage, reaction: string): Promise<WAMessage>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare class Group {
|
|
130
|
+
protected client: Client;
|
|
131
|
+
constructor(client: Client);
|
|
132
|
+
create(name: string, participants: number[]): Promise<baileys.GroupMetadata>;
|
|
133
|
+
participant(roomId: string, participants: number[], action: ParticipantAction): Promise<{
|
|
134
|
+
status: string;
|
|
135
|
+
jid: string | undefined;
|
|
136
|
+
content: baileys.BinaryNode;
|
|
137
|
+
}[]>;
|
|
138
|
+
profile(roomId: string, update: string | Buffer, type: 'subject' | 'description' | 'avatar'): Promise<void>;
|
|
139
|
+
setting(roomId: string, type: 'open' | 'close' | 'locked' | 'unlocked' | 'all_member_add' | 'admin_add'): Promise<void>;
|
|
140
|
+
leave(roomId: string): Promise<void>;
|
|
141
|
+
inviteCode(roomId: string, type: 'code' | 'revoke' | 'accept' | 'info'): Promise<string | baileys.GroupMetadata>;
|
|
142
|
+
metadata(roomId: string): Promise<baileys.GroupMetadata>;
|
|
143
|
+
requestJoin(roomId: string, participants: number[], type: 'approve' | 'reject'): Promise<{
|
|
144
|
+
status: string;
|
|
145
|
+
jid: string | undefined;
|
|
146
|
+
}[]>;
|
|
147
|
+
requestJoinList(roomId: string): Promise<{
|
|
148
|
+
[key: string]: string;
|
|
149
|
+
}[]>;
|
|
150
|
+
fetchAllGroups(): Promise<{
|
|
151
|
+
[_: string]: baileys.GroupMetadata;
|
|
152
|
+
}>;
|
|
153
|
+
ephemeral(roomId: string, type: 'off' | '24h' | '7d' | '90d'): Promise<void>;
|
|
154
|
+
}
|
|
155
|
+
declare class SignalGroup {
|
|
156
|
+
protected glient: Client;
|
|
157
|
+
group: Group;
|
|
158
|
+
constructor(glient: Client);
|
|
159
|
+
}
|
|
160
|
+
|
|
9
161
|
declare const ListenerCallsType: z.ZodObject<{
|
|
10
162
|
callId: z.ZodString;
|
|
11
|
-
roomId: z.ZodString;
|
|
12
163
|
callerId: z.ZodString;
|
|
164
|
+
callerName: z.ZodString;
|
|
165
|
+
roomId: z.ZodString;
|
|
166
|
+
roomName: z.ZodString;
|
|
13
167
|
date: z.ZodDate;
|
|
14
168
|
offline: z.ZodBoolean;
|
|
15
169
|
status: z.ZodEnum<{
|
|
@@ -47,10 +201,6 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
47
201
|
channelId: z.ZodString;
|
|
48
202
|
uniqueId: z.ZodString;
|
|
49
203
|
chatId: z.ZodString;
|
|
50
|
-
chatAddress: z.ZodEnum<{
|
|
51
|
-
pn: "pn";
|
|
52
|
-
lid: "lid";
|
|
53
|
-
}>;
|
|
54
204
|
chatType: z.ZodEnum<{
|
|
55
205
|
text: "text";
|
|
56
206
|
image: "image";
|
|
@@ -71,7 +221,7 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
71
221
|
groupInvite: "groupInvite";
|
|
72
222
|
product: "product";
|
|
73
223
|
deviceSent: "deviceSent";
|
|
74
|
-
|
|
224
|
+
lists: "lists";
|
|
75
225
|
viewOnce: "viewOnce";
|
|
76
226
|
order: "order";
|
|
77
227
|
ephemeral: "ephemeral";
|
|
@@ -118,12 +268,14 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
118
268
|
text: z.ZodNullable<z.ZodString>;
|
|
119
269
|
mentions: z.ZodArray<z.ZodString>;
|
|
120
270
|
links: z.ZodArray<z.ZodString>;
|
|
271
|
+
isBot: z.ZodBoolean;
|
|
272
|
+
isFromMe: z.ZodBoolean;
|
|
121
273
|
isPrefix: z.ZodBoolean;
|
|
122
274
|
isSpam: z.ZodBoolean;
|
|
123
|
-
isFromMe: z.ZodBoolean;
|
|
124
275
|
isTagMe: z.ZodBoolean;
|
|
125
276
|
isGroup: z.ZodBoolean;
|
|
126
277
|
isNewsletter: z.ZodBoolean;
|
|
278
|
+
isQuestion: z.ZodBoolean;
|
|
127
279
|
isStory: z.ZodBoolean;
|
|
128
280
|
isViewOnce: z.ZodBoolean;
|
|
129
281
|
isEdited: z.ZodBoolean;
|
|
@@ -133,15 +285,20 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
133
285
|
isBroadcast: z.ZodBoolean;
|
|
134
286
|
isEphemeral: z.ZodBoolean;
|
|
135
287
|
isForwarded: z.ZodBoolean;
|
|
136
|
-
citation: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodBoolean
|
|
288
|
+
citation: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>>;
|
|
137
289
|
media: z.ZodNullable<z.ZodObject<{
|
|
138
290
|
buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
139
291
|
stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
140
292
|
}, z.core.$loose>>;
|
|
141
|
-
message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.
|
|
293
|
+
message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
|
|
142
294
|
replied: z.ZodNullable<z.ZodObject</*elided*/ any, z.core.$strip>>;
|
|
143
295
|
}, z.core.$strip>;
|
|
144
296
|
|
|
297
|
+
declare const StickerMetadataType: z$1.ZodOptional<z$1.ZodObject<{
|
|
298
|
+
packageName: z$1.ZodString;
|
|
299
|
+
authorName: z$1.ZodString;
|
|
300
|
+
quality: z$1.ZodNumber;
|
|
301
|
+
}, z$1.core.$strip>>;
|
|
145
302
|
declare const ClientOptionsType: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
146
303
|
authType: z$1.ZodLiteral<"pairing">;
|
|
147
304
|
phoneNumber: z$1.ZodNumber;
|
|
@@ -150,11 +307,32 @@ declare const ClientOptionsType: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
|
150
307
|
ignoreMe: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
151
308
|
showLogs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
152
309
|
syncFullHistory: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
310
|
+
autoMarkAI: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
153
311
|
autoMentions: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
154
312
|
autoOnline: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
155
313
|
autoRead: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
156
314
|
autoPresence: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
157
315
|
autoRejectCall: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
316
|
+
limiter: z$1.ZodOptional<z$1.ZodObject<{
|
|
317
|
+
maxMessages: z$1.ZodDefault<z$1.ZodNumber>;
|
|
318
|
+
durationMs: z$1.ZodDefault<z$1.ZodNumber>;
|
|
319
|
+
}, z$1.core.$strip>>;
|
|
320
|
+
citation: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodFunction<z$1.core.$ZodFunctionArgs, z$1.ZodPromise<z$1.ZodArray<z$1.ZodNumber>>>>>;
|
|
321
|
+
fakeReply: z$1.ZodOptional<z$1.ZodObject<{
|
|
322
|
+
provider: z$1.ZodUnion<[z$1.ZodEnum<{
|
|
323
|
+
whatsapp: "whatsapp";
|
|
324
|
+
meta: "meta";
|
|
325
|
+
chatgpt: "chatgpt";
|
|
326
|
+
copilot: "copilot";
|
|
327
|
+
instagram: "instagram";
|
|
328
|
+
tiktok: "tiktok";
|
|
329
|
+
}>, z$1.ZodNumber]>;
|
|
330
|
+
}, z$1.core.$strip>>;
|
|
331
|
+
sticker: z$1.ZodOptional<z$1.ZodObject<{
|
|
332
|
+
packageName: z$1.ZodString;
|
|
333
|
+
authorName: z$1.ZodString;
|
|
334
|
+
quality: z$1.ZodNumber;
|
|
335
|
+
}, z$1.core.$strip>>;
|
|
158
336
|
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
159
337
|
authType: z$1.ZodLiteral<"qr">;
|
|
160
338
|
session: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
|
|
@@ -162,11 +340,32 @@ declare const ClientOptionsType: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
|
162
340
|
ignoreMe: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
163
341
|
showLogs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
164
342
|
syncFullHistory: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
343
|
+
autoMarkAI: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
165
344
|
autoMentions: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
166
345
|
autoOnline: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
167
346
|
autoRead: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
168
347
|
autoPresence: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
169
348
|
autoRejectCall: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
|
|
349
|
+
limiter: z$1.ZodOptional<z$1.ZodObject<{
|
|
350
|
+
maxMessages: z$1.ZodDefault<z$1.ZodNumber>;
|
|
351
|
+
durationMs: z$1.ZodDefault<z$1.ZodNumber>;
|
|
352
|
+
}, z$1.core.$strip>>;
|
|
353
|
+
citation: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodFunction<z$1.core.$ZodFunctionArgs, z$1.ZodPromise<z$1.ZodArray<z$1.ZodNumber>>>>>;
|
|
354
|
+
fakeReply: z$1.ZodOptional<z$1.ZodObject<{
|
|
355
|
+
provider: z$1.ZodUnion<[z$1.ZodEnum<{
|
|
356
|
+
whatsapp: "whatsapp";
|
|
357
|
+
meta: "meta";
|
|
358
|
+
chatgpt: "chatgpt";
|
|
359
|
+
copilot: "copilot";
|
|
360
|
+
instagram: "instagram";
|
|
361
|
+
tiktok: "tiktok";
|
|
362
|
+
}>, z$1.ZodNumber]>;
|
|
363
|
+
}, z$1.core.$strip>>;
|
|
364
|
+
sticker: z$1.ZodOptional<z$1.ZodObject<{
|
|
365
|
+
packageName: z$1.ZodString;
|
|
366
|
+
authorName: z$1.ZodString;
|
|
367
|
+
quality: z$1.ZodNumber;
|
|
368
|
+
}, z$1.core.$strip>>;
|
|
170
369
|
}, z$1.core.$strip>]>;
|
|
171
370
|
declare const EventEnumType: z$1.ZodEnum<{
|
|
172
371
|
connection: "connection";
|
|
@@ -179,6 +378,31 @@ type EventCallbackType = {
|
|
|
179
378
|
calls: (ctx: z$1.infer<typeof ListenerCallsType>) => void;
|
|
180
379
|
};
|
|
181
380
|
|
|
381
|
+
type ParsedMessage = Partial<z.infer<typeof ListenerMessagesType>>;
|
|
382
|
+
type CollectorFilter = (msg: ParsedMessage) => boolean;
|
|
383
|
+
type CollectorCallback = (messages: ParsedMessage[]) => void;
|
|
384
|
+
interface CollectorOptions {
|
|
385
|
+
filter?: CollectorFilter;
|
|
386
|
+
timeout: number;
|
|
387
|
+
max?: number;
|
|
388
|
+
}
|
|
389
|
+
declare class MessageCollector {
|
|
390
|
+
collect(channelId: string, options: CollectorOptions, callback: CollectorCallback): void;
|
|
391
|
+
push(msg: ParsedMessage): boolean;
|
|
392
|
+
has(channelId: string): boolean;
|
|
393
|
+
cancel(channelId: string): ParsedMessage[];
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
declare class Logs {
|
|
397
|
+
private client;
|
|
398
|
+
private ready;
|
|
399
|
+
constructor(client: Client);
|
|
400
|
+
getRoomColor(validator: any): "lime" | "orange" | "#383838ff" | "blue";
|
|
401
|
+
initialize(): void;
|
|
402
|
+
message(message: Partial<z.infer<typeof ListenerMessagesType>>): void;
|
|
403
|
+
call(call: Partial<z.infer<typeof ListenerCallsType>>): void;
|
|
404
|
+
}
|
|
405
|
+
|
|
182
406
|
type MiddlewareContextType = {
|
|
183
407
|
messages?: Partial<z.infer<typeof ListenerMessagesType>>;
|
|
184
408
|
calls?: Partial<z.infer<typeof ListenerCallsType>>;
|
|
@@ -192,14 +416,133 @@ declare class Middleware<T> {
|
|
|
192
416
|
run(ctx: MiddlewareContextType): Promise<void>;
|
|
193
417
|
}
|
|
194
418
|
|
|
419
|
+
type PluginsHandlerType = (wa: Client, ctx: MiddlewareContextType) => Promise<void> | void;
|
|
420
|
+
type PluginsConfigType = {
|
|
421
|
+
matcher: string[];
|
|
422
|
+
metadata?: Record<string, any>;
|
|
423
|
+
};
|
|
424
|
+
type PluginDefinition = {
|
|
425
|
+
handler: PluginsHandlerType;
|
|
426
|
+
config: PluginsConfigType;
|
|
427
|
+
};
|
|
428
|
+
declare class Plugins {
|
|
429
|
+
private plugins;
|
|
430
|
+
private pluginsDir;
|
|
431
|
+
constructor(pluginsDir?: string);
|
|
432
|
+
load(): Promise<void>;
|
|
433
|
+
execute(wa: Client, ctx: MiddlewareContextType): Promise<void>;
|
|
434
|
+
private match;
|
|
435
|
+
getLoadedPlugins(): PluginDefinition[];
|
|
436
|
+
getPluginsInfo(): {
|
|
437
|
+
matcher: string[];
|
|
438
|
+
metadata?: Record<string, any>;
|
|
439
|
+
}[];
|
|
440
|
+
reload(): Promise<void>;
|
|
441
|
+
}
|
|
442
|
+
declare const definePlugins: (handler: PluginsHandlerType, config: PluginsConfigType) => PluginDefinition;
|
|
443
|
+
|
|
444
|
+
interface Client extends Signal, SignalGroup {
|
|
445
|
+
}
|
|
195
446
|
declare class Client {
|
|
196
447
|
options: z.infer<typeof ClientOptionsType>;
|
|
448
|
+
private listener;
|
|
449
|
+
private _ready;
|
|
450
|
+
logs: Logs;
|
|
451
|
+
collector: MessageCollector;
|
|
197
452
|
middleware: Middleware<any>;
|
|
453
|
+
plugins: Plugins;
|
|
198
454
|
constructor(options: z.infer<typeof ClientOptionsType>);
|
|
199
455
|
initialize(): Promise<void>;
|
|
456
|
+
ready(): Promise<void>;
|
|
200
457
|
db(path: string): Lowdb;
|
|
201
458
|
on<T extends z.infer<typeof EventEnumType>>(event: T, handler: EventCallbackType[T]): void;
|
|
202
459
|
use<T>(handler: MiddlewareHandler<T>): this;
|
|
460
|
+
getMessageByChatId(chatId: string): Promise<Partial<{
|
|
461
|
+
channelId: string;
|
|
462
|
+
uniqueId: string;
|
|
463
|
+
chatId: string;
|
|
464
|
+
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";
|
|
465
|
+
receiverId: string;
|
|
466
|
+
receiverName: string;
|
|
467
|
+
roomId: string;
|
|
468
|
+
roomName: string;
|
|
469
|
+
senderLid: string;
|
|
470
|
+
senderId: string;
|
|
471
|
+
senderName: string;
|
|
472
|
+
senderDevice: "unknown" | "android" | "ios" | "desktop" | "web";
|
|
473
|
+
timestamp: number;
|
|
474
|
+
mentions: string[];
|
|
475
|
+
links: string[];
|
|
476
|
+
isBot: boolean;
|
|
477
|
+
isFromMe: boolean;
|
|
478
|
+
isPrefix: boolean;
|
|
479
|
+
isSpam: boolean;
|
|
480
|
+
isTagMe: boolean;
|
|
481
|
+
isGroup: boolean;
|
|
482
|
+
isNewsletter: boolean;
|
|
483
|
+
isQuestion: boolean;
|
|
484
|
+
isStory: boolean;
|
|
485
|
+
isViewOnce: boolean;
|
|
486
|
+
isEdited: boolean;
|
|
487
|
+
isDeleted: boolean;
|
|
488
|
+
isPinned: boolean;
|
|
489
|
+
isUnPinned: boolean;
|
|
490
|
+
isBroadcast: boolean;
|
|
491
|
+
isEphemeral: boolean;
|
|
492
|
+
isForwarded: boolean;
|
|
493
|
+
message: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodCustom<baileys.WAMessage, baileys.WAMessage>>;
|
|
494
|
+
text?: string;
|
|
495
|
+
citation?: Record<string, z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>;
|
|
496
|
+
media?: {
|
|
497
|
+
[x: string]: unknown;
|
|
498
|
+
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
499
|
+
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
500
|
+
};
|
|
501
|
+
replied?: {
|
|
502
|
+
channelId: string;
|
|
503
|
+
uniqueId: string;
|
|
504
|
+
chatId: string;
|
|
505
|
+
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";
|
|
506
|
+
receiverId: string;
|
|
507
|
+
receiverName: string;
|
|
508
|
+
roomId: string;
|
|
509
|
+
roomName: string;
|
|
510
|
+
senderLid: string;
|
|
511
|
+
senderId: string;
|
|
512
|
+
senderName: string;
|
|
513
|
+
senderDevice: "unknown" | "android" | "ios" | "desktop" | "web";
|
|
514
|
+
timestamp: number;
|
|
515
|
+
mentions: string[];
|
|
516
|
+
links: string[];
|
|
517
|
+
isBot: boolean;
|
|
518
|
+
isFromMe: boolean;
|
|
519
|
+
isPrefix: boolean;
|
|
520
|
+
isSpam: boolean;
|
|
521
|
+
isTagMe: boolean;
|
|
522
|
+
isGroup: boolean;
|
|
523
|
+
isNewsletter: boolean;
|
|
524
|
+
isQuestion: boolean;
|
|
525
|
+
isStory: boolean;
|
|
526
|
+
isViewOnce: boolean;
|
|
527
|
+
isEdited: boolean;
|
|
528
|
+
isDeleted: boolean;
|
|
529
|
+
isPinned: boolean;
|
|
530
|
+
isUnPinned: boolean;
|
|
531
|
+
isBroadcast: boolean;
|
|
532
|
+
isEphemeral: boolean;
|
|
533
|
+
isForwarded: boolean;
|
|
534
|
+
message: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodCustom<baileys.WAMessage, baileys.WAMessage>>;
|
|
535
|
+
text?: string;
|
|
536
|
+
citation?: Record<string, z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>;
|
|
537
|
+
media?: {
|
|
538
|
+
[x: string]: unknown;
|
|
539
|
+
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
540
|
+
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
541
|
+
};
|
|
542
|
+
replied?: /*elided*/ any;
|
|
543
|
+
};
|
|
544
|
+
}>>;
|
|
545
|
+
getRoomName(roomId: string): Promise<string>;
|
|
203
546
|
}
|
|
204
547
|
|
|
205
548
|
declare const registerAuthCreds: (client: Client) => Promise<void>;
|
|
@@ -225,7 +568,8 @@ declare class Lowdb {
|
|
|
225
568
|
write(): Promise<void>;
|
|
226
569
|
set<T>(key: string, value: T): Promise<void>;
|
|
227
570
|
push<T>(key: string, value: T): Promise<void>;
|
|
228
|
-
get
|
|
571
|
+
get(key?: string | object): Promise<any>;
|
|
572
|
+
all(): Promise<any>;
|
|
229
573
|
delete(key: string): Promise<boolean>;
|
|
230
574
|
private saveChunk;
|
|
231
575
|
private loadChunk;
|
|
@@ -239,17 +583,69 @@ declare const createLowdb: (path: string, options?: {
|
|
|
239
583
|
debounceMs?: number;
|
|
240
584
|
}) => Lowdb;
|
|
241
585
|
|
|
586
|
+
declare const ignoreLint: (data: any) => any;
|
|
242
587
|
declare const getLatestLibVersion: () => Promise<any>;
|
|
243
588
|
declare const removeAuthCreds: (session: string) => Promise<void>;
|
|
244
589
|
declare const normalizeText: (text?: string) => string;
|
|
245
590
|
|
|
246
|
-
declare const
|
|
591
|
+
declare const logColor: (text: string, color?: string[] | string) => string;
|
|
247
592
|
declare const toJson: (object: unknown) => any;
|
|
248
|
-
declare const toString: (object: unknown) =>
|
|
249
|
-
declare const shuffleString: (str?: string) =>
|
|
250
|
-
declare const findGlobalWord: (text?: string, word?: string) =>
|
|
251
|
-
declare const extractUrls: (text?: string) =>
|
|
593
|
+
declare const toString: (object: unknown) => string;
|
|
594
|
+
declare const shuffleString: (str?: string) => string;
|
|
595
|
+
declare const findGlobalWord: (text?: string, word?: string) => boolean;
|
|
596
|
+
declare const extractUrls: (text?: string) => string[];
|
|
252
597
|
declare const randomize: (arr: string[]) => string;
|
|
253
598
|
declare const pickKeysFromArray: (arr: any[], keys: string[]) => any;
|
|
599
|
+
declare const findNestedByKeys: (data: unknown, target: Record<string, any> | Record<string, any>[]) => any;
|
|
600
|
+
declare const modifyFn: <T extends (...args: any[]) => any>(fn: T, before?: (args: any[]) => void | any, after?: (result: any, args: any[]) => any) => T;
|
|
601
|
+
|
|
602
|
+
declare const generateId: (input: string | string[]) => string;
|
|
603
|
+
declare const getUsersMentions: (text?: string) => string[];
|
|
604
|
+
declare const extractJids: (text?: string) => string[];
|
|
605
|
+
declare const numbersToJids: (numbers: number[]) => string[];
|
|
606
|
+
declare const cleanMediaObject: (object: any) => _.Omit<any, "url" | "contextInfo" | "fileSha256" | "fileEncSha256" | "mediaKey" | "directPath" | "waveform" | "thumbnail" | "jpegThumbnail" | "thumbnailEncSha256" | "thumbnailSha256" | "thumbnailDirectPath" | "firstFrameSidecar" | "streamingSidecar" | "scansSidecar" | "callKey" | "message" | "key" | "midQualityFileSha256" | "historySyncNotification" | "appStateSyncKeyShare" | "appStateSyncKeyRequest" | "initialSecurityNotificationSettingSync" | "appStateFatalExceptionNotification" | "disappearingMode" | "peerDataOperationRequestMessage" | "peerDataOperationRequestResponseMessage" | "botFeedbackMessage">;
|
|
607
|
+
declare const getDeepContent: (raw?: proto.IMessage | null) => {
|
|
608
|
+
leaf: any;
|
|
609
|
+
chain: string[];
|
|
610
|
+
};
|
|
611
|
+
declare const cleanJid: (jid: string) => number;
|
|
612
|
+
|
|
613
|
+
type MediaInput = string | ArrayBuffer | Buffer;
|
|
614
|
+
type AudioType = 'opus' | 'mp3';
|
|
615
|
+
declare class AudioProcessor {
|
|
616
|
+
static getWaAudio(input: MediaInput, type?: AudioType): Promise<Buffer>;
|
|
617
|
+
}
|
|
618
|
+
declare class VideoProcessor {
|
|
619
|
+
static getThumbnail(input: MediaInput): Promise<string>;
|
|
620
|
+
static getDuration(filePath: string): Promise<number>;
|
|
621
|
+
}
|
|
622
|
+
declare class ImageProcessor {
|
|
623
|
+
static getThumbnail(buffer: Buffer): Promise<string>;
|
|
624
|
+
static resizeForSticker(buffer: Buffer, quality: number): Promise<Buffer>;
|
|
625
|
+
}
|
|
626
|
+
declare class MediaProcessor {
|
|
627
|
+
static getThumbnail(input: MediaInput): Promise<string>;
|
|
628
|
+
}
|
|
629
|
+
declare class StickerProcessor {
|
|
630
|
+
private static createExifMetadata;
|
|
631
|
+
private static processAnimated;
|
|
632
|
+
private static getExtension;
|
|
633
|
+
static create(input: MediaInput, metadata?: z.infer<typeof StickerMetadataType>): Promise<Buffer>;
|
|
634
|
+
}
|
|
635
|
+
declare class DocumentProcessor {
|
|
636
|
+
static create(input: MediaInput): Promise<{
|
|
637
|
+
document: any;
|
|
638
|
+
mimetype: string;
|
|
639
|
+
fileName: string;
|
|
640
|
+
jpegThumbnail: string;
|
|
641
|
+
}>;
|
|
642
|
+
}
|
|
643
|
+
declare const toBuffer: any;
|
|
644
|
+
declare const getWaAudio: any;
|
|
645
|
+
declare const getVideoThumbnail: any;
|
|
646
|
+
declare const getVideoDuration: any;
|
|
647
|
+
declare const getMediaThumbnail: any;
|
|
648
|
+
declare const getWaSticker: any;
|
|
649
|
+
declare const getWaDocument: any;
|
|
254
650
|
|
|
255
|
-
export { Client, Lowdb, createLowdb, extractUrls, findGlobalWord, getLatestLibVersion, ignoreLint, normalizeText, pickKeysFromArray, randomize, registerAuthCreds, removeAuthCreds, shuffleString, toJson, toString, useAuthState };
|
|
651
|
+
export { AudioProcessor, type AudioType, Client, DocumentProcessor, ImageProcessor, Lowdb, MediaProcessor, type PluginDefinition, Plugins, type PluginsConfigType, type PluginsHandlerType, StickerProcessor, VideoProcessor, cleanJid, cleanMediaObject, createLowdb, definePlugins, extractJids, extractUrls, findGlobalWord, findNestedByKeys, generateId, getDeepContent, getLatestLibVersion, getMediaThumbnail, getUsersMentions, getVideoDuration, getVideoThumbnail, getWaAudio, getWaDocument, getWaSticker, ignoreLint, logColor, modifyFn, normalizeText, numbersToJids, pickKeysFromArray, randomize, registerAuthCreds, removeAuthCreds, shuffleString, toBuffer, toJson, toString, useAuthState };
|