zaileys 2.0.12 → 2.0.13
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/dist/index.d.mts +210 -17
- package/dist/index.d.ts +210 -17
- package/dist/index.js +15 -15
- package/dist/index.mjs +15 -15
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as baileys from 'baileys';
|
|
2
2
|
import { AuthenticationState, WAMessage, proto, ParticipantAction, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue } from 'baileys';
|
|
3
|
+
import * as Stream from 'stream';
|
|
4
|
+
import Stream__default from 'stream';
|
|
3
5
|
import z, { z as z$1 } from 'zod';
|
|
4
6
|
import _ from 'lodash';
|
|
5
7
|
|
|
@@ -179,6 +181,7 @@ declare const ListenerCallsType: z.ZodObject<{
|
|
|
179
181
|
isVideo: z.ZodBoolean;
|
|
180
182
|
isGroup: z.ZodBoolean;
|
|
181
183
|
}, z.core.$strip>;
|
|
184
|
+
type CallsContext = z.infer<typeof ListenerCallsType>;
|
|
182
185
|
|
|
183
186
|
declare const ListenerConnectionType: z.ZodObject<{
|
|
184
187
|
status: z.ZodEnum<{
|
|
@@ -198,6 +201,7 @@ declare const ListenerConnectionType: z.ZodObject<{
|
|
|
198
201
|
qr: z.ZodOptional<z.ZodString>;
|
|
199
202
|
code: z.ZodOptional<z.ZodString>;
|
|
200
203
|
}, z.core.$strip>;
|
|
204
|
+
type ConnectionContext = z.infer<typeof ListenerConnectionType>;
|
|
201
205
|
|
|
202
206
|
declare const DEVICE_ENUM_TYPES: z.ZodEnum<{
|
|
203
207
|
unknown: "unknown";
|
|
@@ -255,6 +259,101 @@ declare const MESSAGE_ENUM_TYPES: z.ZodEnum<{
|
|
|
255
259
|
placeholder: "placeholder";
|
|
256
260
|
encEventUpdate: "encEventUpdate";
|
|
257
261
|
}>;
|
|
262
|
+
declare const BaseMessagesType: z.ZodObject<{
|
|
263
|
+
channelId: z.ZodString;
|
|
264
|
+
uniqueId: z.ZodString;
|
|
265
|
+
chatId: z.ZodString;
|
|
266
|
+
chatType: z.ZodEnum<{
|
|
267
|
+
text: "text";
|
|
268
|
+
image: "image";
|
|
269
|
+
contact: "contact";
|
|
270
|
+
location: "location";
|
|
271
|
+
document: "document";
|
|
272
|
+
audio: "audio";
|
|
273
|
+
video: "video";
|
|
274
|
+
protocol: "protocol";
|
|
275
|
+
contacts: "contacts";
|
|
276
|
+
highlyStructured: "highlyStructured";
|
|
277
|
+
sendPayment: "sendPayment";
|
|
278
|
+
requestPayment: "requestPayment";
|
|
279
|
+
declinePaymentRequest: "declinePaymentRequest";
|
|
280
|
+
cancelPaymentRequest: "cancelPaymentRequest";
|
|
281
|
+
template: "template";
|
|
282
|
+
sticker: "sticker";
|
|
283
|
+
groupInvite: "groupInvite";
|
|
284
|
+
product: "product";
|
|
285
|
+
deviceSent: "deviceSent";
|
|
286
|
+
lists: "lists";
|
|
287
|
+
viewOnce: "viewOnce";
|
|
288
|
+
order: "order";
|
|
289
|
+
ephemeral: "ephemeral";
|
|
290
|
+
invoice: "invoice";
|
|
291
|
+
buttons: "buttons";
|
|
292
|
+
paymentInvite: "paymentInvite";
|
|
293
|
+
interactive: "interactive";
|
|
294
|
+
reaction: "reaction";
|
|
295
|
+
interactiveResponse: "interactiveResponse";
|
|
296
|
+
pollCreation: "pollCreation";
|
|
297
|
+
pollUpdate: "pollUpdate";
|
|
298
|
+
keepInChat: "keepInChat";
|
|
299
|
+
requestPhoneNumber: "requestPhoneNumber";
|
|
300
|
+
scheduledCallCreation: "scheduledCallCreation";
|
|
301
|
+
groupMentioned: "groupMentioned";
|
|
302
|
+
pinInChat: "pinInChat";
|
|
303
|
+
scheduledCallEdit: "scheduledCallEdit";
|
|
304
|
+
ptv: "ptv";
|
|
305
|
+
botInvoke: "botInvoke";
|
|
306
|
+
callLog: "callLog";
|
|
307
|
+
encComment: "encComment";
|
|
308
|
+
bcall: "bcall";
|
|
309
|
+
lottieSticker: "lottieSticker";
|
|
310
|
+
event: "event";
|
|
311
|
+
comment: "comment";
|
|
312
|
+
placeholder: "placeholder";
|
|
313
|
+
encEventUpdate: "encEventUpdate";
|
|
314
|
+
}>;
|
|
315
|
+
receiverId: z.ZodString;
|
|
316
|
+
receiverName: z.ZodString;
|
|
317
|
+
roomId: z.ZodString;
|
|
318
|
+
roomName: z.ZodString;
|
|
319
|
+
senderLid: z.ZodString;
|
|
320
|
+
senderId: z.ZodString;
|
|
321
|
+
senderName: z.ZodString;
|
|
322
|
+
senderDevice: z.ZodEnum<{
|
|
323
|
+
unknown: "unknown";
|
|
324
|
+
android: "android";
|
|
325
|
+
ios: "ios";
|
|
326
|
+
desktop: "desktop";
|
|
327
|
+
web: "web";
|
|
328
|
+
}>;
|
|
329
|
+
timestamp: z.ZodNumber;
|
|
330
|
+
text: z.ZodNullable<z.ZodString>;
|
|
331
|
+
mentions: z.ZodArray<z.ZodString>;
|
|
332
|
+
links: z.ZodArray<z.ZodString>;
|
|
333
|
+
isBot: z.ZodBoolean;
|
|
334
|
+
isFromMe: z.ZodBoolean;
|
|
335
|
+
isPrefix: z.ZodBoolean;
|
|
336
|
+
isSpam: z.ZodBoolean;
|
|
337
|
+
isTagMe: z.ZodBoolean;
|
|
338
|
+
isGroup: z.ZodBoolean;
|
|
339
|
+
isNewsletter: z.ZodBoolean;
|
|
340
|
+
isQuestion: z.ZodBoolean;
|
|
341
|
+
isStory: z.ZodBoolean;
|
|
342
|
+
isViewOnce: z.ZodBoolean;
|
|
343
|
+
isEdited: z.ZodBoolean;
|
|
344
|
+
isDeleted: z.ZodBoolean;
|
|
345
|
+
isPinned: z.ZodBoolean;
|
|
346
|
+
isUnPinned: z.ZodBoolean;
|
|
347
|
+
isBroadcast: z.ZodBoolean;
|
|
348
|
+
isEphemeral: z.ZodBoolean;
|
|
349
|
+
isForwarded: z.ZodBoolean;
|
|
350
|
+
citation: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>>;
|
|
351
|
+
media: z.ZodNullable<z.ZodObject<{
|
|
352
|
+
buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
353
|
+
stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream__default, Stream__default>>>;
|
|
354
|
+
}, z.core.$loose>>;
|
|
355
|
+
message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
|
|
356
|
+
}, z.core.$strip>;
|
|
258
357
|
declare const ListenerMessagesType: z.ZodObject<{
|
|
259
358
|
channelId: z.ZodString;
|
|
260
359
|
uniqueId: z.ZodString;
|
|
@@ -345,12 +444,107 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
345
444
|
isForwarded: z.ZodBoolean;
|
|
346
445
|
citation: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>>;
|
|
347
446
|
media: z.ZodNullable<z.ZodObject<{
|
|
348
|
-
buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.
|
|
349
|
-
stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.
|
|
447
|
+
buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
448
|
+
stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream__default, Stream__default>>>;
|
|
350
449
|
}, z.core.$loose>>;
|
|
351
450
|
message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
|
|
352
|
-
replied: z.ZodNullable<z.ZodObject
|
|
451
|
+
replied: z.ZodNullable<z.ZodObject<{
|
|
452
|
+
channelId: z.ZodString;
|
|
453
|
+
uniqueId: z.ZodString;
|
|
454
|
+
chatId: z.ZodString;
|
|
455
|
+
chatType: z.ZodEnum<{
|
|
456
|
+
text: "text";
|
|
457
|
+
image: "image";
|
|
458
|
+
contact: "contact";
|
|
459
|
+
location: "location";
|
|
460
|
+
document: "document";
|
|
461
|
+
audio: "audio";
|
|
462
|
+
video: "video";
|
|
463
|
+
protocol: "protocol";
|
|
464
|
+
contacts: "contacts";
|
|
465
|
+
highlyStructured: "highlyStructured";
|
|
466
|
+
sendPayment: "sendPayment";
|
|
467
|
+
requestPayment: "requestPayment";
|
|
468
|
+
declinePaymentRequest: "declinePaymentRequest";
|
|
469
|
+
cancelPaymentRequest: "cancelPaymentRequest";
|
|
470
|
+
template: "template";
|
|
471
|
+
sticker: "sticker";
|
|
472
|
+
groupInvite: "groupInvite";
|
|
473
|
+
product: "product";
|
|
474
|
+
deviceSent: "deviceSent";
|
|
475
|
+
lists: "lists";
|
|
476
|
+
viewOnce: "viewOnce";
|
|
477
|
+
order: "order";
|
|
478
|
+
ephemeral: "ephemeral";
|
|
479
|
+
invoice: "invoice";
|
|
480
|
+
buttons: "buttons";
|
|
481
|
+
paymentInvite: "paymentInvite";
|
|
482
|
+
interactive: "interactive";
|
|
483
|
+
reaction: "reaction";
|
|
484
|
+
interactiveResponse: "interactiveResponse";
|
|
485
|
+
pollCreation: "pollCreation";
|
|
486
|
+
pollUpdate: "pollUpdate";
|
|
487
|
+
keepInChat: "keepInChat";
|
|
488
|
+
requestPhoneNumber: "requestPhoneNumber";
|
|
489
|
+
scheduledCallCreation: "scheduledCallCreation";
|
|
490
|
+
groupMentioned: "groupMentioned";
|
|
491
|
+
pinInChat: "pinInChat";
|
|
492
|
+
scheduledCallEdit: "scheduledCallEdit";
|
|
493
|
+
ptv: "ptv";
|
|
494
|
+
botInvoke: "botInvoke";
|
|
495
|
+
callLog: "callLog";
|
|
496
|
+
encComment: "encComment";
|
|
497
|
+
bcall: "bcall";
|
|
498
|
+
lottieSticker: "lottieSticker";
|
|
499
|
+
event: "event";
|
|
500
|
+
comment: "comment";
|
|
501
|
+
placeholder: "placeholder";
|
|
502
|
+
encEventUpdate: "encEventUpdate";
|
|
503
|
+
}>;
|
|
504
|
+
receiverId: z.ZodString;
|
|
505
|
+
receiverName: z.ZodString;
|
|
506
|
+
roomId: z.ZodString;
|
|
507
|
+
roomName: z.ZodString;
|
|
508
|
+
senderLid: z.ZodString;
|
|
509
|
+
senderId: z.ZodString;
|
|
510
|
+
senderName: z.ZodString;
|
|
511
|
+
senderDevice: z.ZodEnum<{
|
|
512
|
+
unknown: "unknown";
|
|
513
|
+
android: "android";
|
|
514
|
+
ios: "ios";
|
|
515
|
+
desktop: "desktop";
|
|
516
|
+
web: "web";
|
|
517
|
+
}>;
|
|
518
|
+
timestamp: z.ZodNumber;
|
|
519
|
+
text: z.ZodNullable<z.ZodString>;
|
|
520
|
+
mentions: z.ZodArray<z.ZodString>;
|
|
521
|
+
links: z.ZodArray<z.ZodString>;
|
|
522
|
+
isBot: z.ZodBoolean;
|
|
523
|
+
isFromMe: z.ZodBoolean;
|
|
524
|
+
isPrefix: z.ZodBoolean;
|
|
525
|
+
isSpam: z.ZodBoolean;
|
|
526
|
+
isTagMe: z.ZodBoolean;
|
|
527
|
+
isGroup: z.ZodBoolean;
|
|
528
|
+
isNewsletter: z.ZodBoolean;
|
|
529
|
+
isQuestion: z.ZodBoolean;
|
|
530
|
+
isStory: z.ZodBoolean;
|
|
531
|
+
isViewOnce: z.ZodBoolean;
|
|
532
|
+
isEdited: z.ZodBoolean;
|
|
533
|
+
isDeleted: z.ZodBoolean;
|
|
534
|
+
isPinned: z.ZodBoolean;
|
|
535
|
+
isUnPinned: z.ZodBoolean;
|
|
536
|
+
isBroadcast: z.ZodBoolean;
|
|
537
|
+
isEphemeral: z.ZodBoolean;
|
|
538
|
+
isForwarded: z.ZodBoolean;
|
|
539
|
+
citation: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>>;
|
|
540
|
+
media: z.ZodNullable<z.ZodObject<{
|
|
541
|
+
buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
542
|
+
stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream__default, Stream__default>>>;
|
|
543
|
+
}, z.core.$loose>>;
|
|
544
|
+
message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
|
|
545
|
+
}, z.core.$strip>>;
|
|
353
546
|
}, z.core.$strip>;
|
|
547
|
+
type MessagesContext = z.infer<typeof ListenerMessagesType>;
|
|
354
548
|
|
|
355
549
|
declare const LimiterType: z$1.ZodOptional<z$1.ZodObject<{
|
|
356
550
|
maxMessages: z$1.ZodDefault<z$1.ZodNumber>;
|
|
@@ -486,9 +680,9 @@ declare const EventEnumType: z$1.ZodEnum<{
|
|
|
486
680
|
calls: "calls";
|
|
487
681
|
}>;
|
|
488
682
|
type EventCallbackType = {
|
|
489
|
-
connection: (ctx:
|
|
490
|
-
messages: (ctx:
|
|
491
|
-
calls: (ctx:
|
|
683
|
+
connection: (ctx: ConnectionContext) => void;
|
|
684
|
+
messages: (ctx: MessagesContext) => void;
|
|
685
|
+
calls: (ctx: CallsContext) => void;
|
|
492
686
|
};
|
|
493
687
|
|
|
494
688
|
declare const ButtonInteractiveReplyType: z.ZodObject<{
|
|
@@ -606,7 +800,7 @@ declare const ButtonType: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
606
800
|
}, z.core.$strip>]>>;
|
|
607
801
|
}, z.core.$strip>]>;
|
|
608
802
|
|
|
609
|
-
type ParsedMessage = Partial<
|
|
803
|
+
type ParsedMessage = Partial<MessagesContext>;
|
|
610
804
|
type CollectorFilter = (msg: ParsedMessage) => boolean;
|
|
611
805
|
type CollectorCallback = (messages: ParsedMessage[]) => void;
|
|
612
806
|
interface CollectorOptions {
|
|
@@ -629,13 +823,13 @@ declare class Logs {
|
|
|
629
823
|
constructor(client: Client);
|
|
630
824
|
getRoomColor(validator: any): "lime" | "orange" | "dimgray" | "blue";
|
|
631
825
|
initialize(): void;
|
|
632
|
-
message(message: Partial<
|
|
633
|
-
call(call: Partial<
|
|
826
|
+
message(message: Partial<MessagesContext>): void;
|
|
827
|
+
call(call: Partial<CallsContext>): void;
|
|
634
828
|
}
|
|
635
829
|
|
|
636
830
|
type MiddlewareContextType = {
|
|
637
|
-
messages?: Partial<
|
|
638
|
-
calls?: Partial<
|
|
831
|
+
messages?: Partial<MessagesContext>;
|
|
832
|
+
calls?: Partial<CallsContext>;
|
|
639
833
|
};
|
|
640
834
|
|
|
641
835
|
type MiddlewareNext = () => Promise<void> | void;
|
|
@@ -815,8 +1009,8 @@ declare class Client {
|
|
|
815
1009
|
citation?: Record<string, z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>;
|
|
816
1010
|
media?: {
|
|
817
1011
|
[x: string]: unknown;
|
|
818
|
-
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.
|
|
819
|
-
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.
|
|
1012
|
+
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1013
|
+
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream, Stream>>>;
|
|
820
1014
|
};
|
|
821
1015
|
replied?: {
|
|
822
1016
|
channelId: string;
|
|
@@ -856,10 +1050,9 @@ declare class Client {
|
|
|
856
1050
|
citation?: Record<string, z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>;
|
|
857
1051
|
media?: {
|
|
858
1052
|
[x: string]: unknown;
|
|
859
|
-
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.
|
|
860
|
-
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.
|
|
1053
|
+
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1054
|
+
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream, Stream>>>;
|
|
861
1055
|
};
|
|
862
|
-
replied?: /*elided*/ any;
|
|
863
1056
|
};
|
|
864
1057
|
}>>;
|
|
865
1058
|
getRoomName(roomId: string): Promise<string>;
|
|
@@ -1012,4 +1205,4 @@ declare class SessionWatchdog {
|
|
|
1012
1205
|
declare const createWatchdog: (options: WatchdogOptions) => SessionWatchdog;
|
|
1013
1206
|
declare const getWatchdog: () => SessionWatchdog | null;
|
|
1014
1207
|
|
|
1015
|
-
export { AudioProcessor, type AudioType, ButtonInteractiveCallType, ButtonInteractiveCopyType, ButtonInteractiveReplyType, ButtonInteractiveSingleSelectType, ButtonInteractiveType, ButtonInteractiveUrlType, ButtonSimpleType, ButtonType, CitationType, Client, ClientAuthPairingType, ClientAuthQRType, ClientBaseType, ClientOptionsType, DEVICE_ENUM_TYPES, DocumentProcessor, type EventCallbackType, EventEnumType, FakeReplyType, ImageProcessor, LimiterType, ListenerCallsType, ListenerConnectionType, ListenerMessagesType, Lowdb, MESSAGE_ENUM_TYPES, MediaProcessor, type PluginDefinition, Plugins, type PluginsConfigType, type PluginsHandlerType, SessionWatchdog, StickerMetadataType, StickerProcessor, VideoProcessor, cleanJid, cleanMediaObject, cleanupSocket, 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 };
|
|
1208
|
+
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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as baileys from 'baileys';
|
|
2
2
|
import { AuthenticationState, WAMessage, proto, ParticipantAction, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue } from 'baileys';
|
|
3
|
+
import * as Stream from 'stream';
|
|
4
|
+
import Stream__default from 'stream';
|
|
3
5
|
import z, { z as z$1 } from 'zod';
|
|
4
6
|
import _ from 'lodash';
|
|
5
7
|
|
|
@@ -179,6 +181,7 @@ declare const ListenerCallsType: z.ZodObject<{
|
|
|
179
181
|
isVideo: z.ZodBoolean;
|
|
180
182
|
isGroup: z.ZodBoolean;
|
|
181
183
|
}, z.core.$strip>;
|
|
184
|
+
type CallsContext = z.infer<typeof ListenerCallsType>;
|
|
182
185
|
|
|
183
186
|
declare const ListenerConnectionType: z.ZodObject<{
|
|
184
187
|
status: z.ZodEnum<{
|
|
@@ -198,6 +201,7 @@ declare const ListenerConnectionType: z.ZodObject<{
|
|
|
198
201
|
qr: z.ZodOptional<z.ZodString>;
|
|
199
202
|
code: z.ZodOptional<z.ZodString>;
|
|
200
203
|
}, z.core.$strip>;
|
|
204
|
+
type ConnectionContext = z.infer<typeof ListenerConnectionType>;
|
|
201
205
|
|
|
202
206
|
declare const DEVICE_ENUM_TYPES: z.ZodEnum<{
|
|
203
207
|
unknown: "unknown";
|
|
@@ -255,6 +259,101 @@ declare const MESSAGE_ENUM_TYPES: z.ZodEnum<{
|
|
|
255
259
|
placeholder: "placeholder";
|
|
256
260
|
encEventUpdate: "encEventUpdate";
|
|
257
261
|
}>;
|
|
262
|
+
declare const BaseMessagesType: z.ZodObject<{
|
|
263
|
+
channelId: z.ZodString;
|
|
264
|
+
uniqueId: z.ZodString;
|
|
265
|
+
chatId: z.ZodString;
|
|
266
|
+
chatType: z.ZodEnum<{
|
|
267
|
+
text: "text";
|
|
268
|
+
image: "image";
|
|
269
|
+
contact: "contact";
|
|
270
|
+
location: "location";
|
|
271
|
+
document: "document";
|
|
272
|
+
audio: "audio";
|
|
273
|
+
video: "video";
|
|
274
|
+
protocol: "protocol";
|
|
275
|
+
contacts: "contacts";
|
|
276
|
+
highlyStructured: "highlyStructured";
|
|
277
|
+
sendPayment: "sendPayment";
|
|
278
|
+
requestPayment: "requestPayment";
|
|
279
|
+
declinePaymentRequest: "declinePaymentRequest";
|
|
280
|
+
cancelPaymentRequest: "cancelPaymentRequest";
|
|
281
|
+
template: "template";
|
|
282
|
+
sticker: "sticker";
|
|
283
|
+
groupInvite: "groupInvite";
|
|
284
|
+
product: "product";
|
|
285
|
+
deviceSent: "deviceSent";
|
|
286
|
+
lists: "lists";
|
|
287
|
+
viewOnce: "viewOnce";
|
|
288
|
+
order: "order";
|
|
289
|
+
ephemeral: "ephemeral";
|
|
290
|
+
invoice: "invoice";
|
|
291
|
+
buttons: "buttons";
|
|
292
|
+
paymentInvite: "paymentInvite";
|
|
293
|
+
interactive: "interactive";
|
|
294
|
+
reaction: "reaction";
|
|
295
|
+
interactiveResponse: "interactiveResponse";
|
|
296
|
+
pollCreation: "pollCreation";
|
|
297
|
+
pollUpdate: "pollUpdate";
|
|
298
|
+
keepInChat: "keepInChat";
|
|
299
|
+
requestPhoneNumber: "requestPhoneNumber";
|
|
300
|
+
scheduledCallCreation: "scheduledCallCreation";
|
|
301
|
+
groupMentioned: "groupMentioned";
|
|
302
|
+
pinInChat: "pinInChat";
|
|
303
|
+
scheduledCallEdit: "scheduledCallEdit";
|
|
304
|
+
ptv: "ptv";
|
|
305
|
+
botInvoke: "botInvoke";
|
|
306
|
+
callLog: "callLog";
|
|
307
|
+
encComment: "encComment";
|
|
308
|
+
bcall: "bcall";
|
|
309
|
+
lottieSticker: "lottieSticker";
|
|
310
|
+
event: "event";
|
|
311
|
+
comment: "comment";
|
|
312
|
+
placeholder: "placeholder";
|
|
313
|
+
encEventUpdate: "encEventUpdate";
|
|
314
|
+
}>;
|
|
315
|
+
receiverId: z.ZodString;
|
|
316
|
+
receiverName: z.ZodString;
|
|
317
|
+
roomId: z.ZodString;
|
|
318
|
+
roomName: z.ZodString;
|
|
319
|
+
senderLid: z.ZodString;
|
|
320
|
+
senderId: z.ZodString;
|
|
321
|
+
senderName: z.ZodString;
|
|
322
|
+
senderDevice: z.ZodEnum<{
|
|
323
|
+
unknown: "unknown";
|
|
324
|
+
android: "android";
|
|
325
|
+
ios: "ios";
|
|
326
|
+
desktop: "desktop";
|
|
327
|
+
web: "web";
|
|
328
|
+
}>;
|
|
329
|
+
timestamp: z.ZodNumber;
|
|
330
|
+
text: z.ZodNullable<z.ZodString>;
|
|
331
|
+
mentions: z.ZodArray<z.ZodString>;
|
|
332
|
+
links: z.ZodArray<z.ZodString>;
|
|
333
|
+
isBot: z.ZodBoolean;
|
|
334
|
+
isFromMe: z.ZodBoolean;
|
|
335
|
+
isPrefix: z.ZodBoolean;
|
|
336
|
+
isSpam: z.ZodBoolean;
|
|
337
|
+
isTagMe: z.ZodBoolean;
|
|
338
|
+
isGroup: z.ZodBoolean;
|
|
339
|
+
isNewsletter: z.ZodBoolean;
|
|
340
|
+
isQuestion: z.ZodBoolean;
|
|
341
|
+
isStory: z.ZodBoolean;
|
|
342
|
+
isViewOnce: z.ZodBoolean;
|
|
343
|
+
isEdited: z.ZodBoolean;
|
|
344
|
+
isDeleted: z.ZodBoolean;
|
|
345
|
+
isPinned: z.ZodBoolean;
|
|
346
|
+
isUnPinned: z.ZodBoolean;
|
|
347
|
+
isBroadcast: z.ZodBoolean;
|
|
348
|
+
isEphemeral: z.ZodBoolean;
|
|
349
|
+
isForwarded: z.ZodBoolean;
|
|
350
|
+
citation: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>>;
|
|
351
|
+
media: z.ZodNullable<z.ZodObject<{
|
|
352
|
+
buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
353
|
+
stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream__default, Stream__default>>>;
|
|
354
|
+
}, z.core.$loose>>;
|
|
355
|
+
message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
|
|
356
|
+
}, z.core.$strip>;
|
|
258
357
|
declare const ListenerMessagesType: z.ZodObject<{
|
|
259
358
|
channelId: z.ZodString;
|
|
260
359
|
uniqueId: z.ZodString;
|
|
@@ -345,12 +444,107 @@ declare const ListenerMessagesType: z.ZodObject<{
|
|
|
345
444
|
isForwarded: z.ZodBoolean;
|
|
346
445
|
citation: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>>;
|
|
347
446
|
media: z.ZodNullable<z.ZodObject<{
|
|
348
|
-
buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.
|
|
349
|
-
stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.
|
|
447
|
+
buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
448
|
+
stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream__default, Stream__default>>>;
|
|
350
449
|
}, z.core.$loose>>;
|
|
351
450
|
message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
|
|
352
|
-
replied: z.ZodNullable<z.ZodObject
|
|
451
|
+
replied: z.ZodNullable<z.ZodObject<{
|
|
452
|
+
channelId: z.ZodString;
|
|
453
|
+
uniqueId: z.ZodString;
|
|
454
|
+
chatId: z.ZodString;
|
|
455
|
+
chatType: z.ZodEnum<{
|
|
456
|
+
text: "text";
|
|
457
|
+
image: "image";
|
|
458
|
+
contact: "contact";
|
|
459
|
+
location: "location";
|
|
460
|
+
document: "document";
|
|
461
|
+
audio: "audio";
|
|
462
|
+
video: "video";
|
|
463
|
+
protocol: "protocol";
|
|
464
|
+
contacts: "contacts";
|
|
465
|
+
highlyStructured: "highlyStructured";
|
|
466
|
+
sendPayment: "sendPayment";
|
|
467
|
+
requestPayment: "requestPayment";
|
|
468
|
+
declinePaymentRequest: "declinePaymentRequest";
|
|
469
|
+
cancelPaymentRequest: "cancelPaymentRequest";
|
|
470
|
+
template: "template";
|
|
471
|
+
sticker: "sticker";
|
|
472
|
+
groupInvite: "groupInvite";
|
|
473
|
+
product: "product";
|
|
474
|
+
deviceSent: "deviceSent";
|
|
475
|
+
lists: "lists";
|
|
476
|
+
viewOnce: "viewOnce";
|
|
477
|
+
order: "order";
|
|
478
|
+
ephemeral: "ephemeral";
|
|
479
|
+
invoice: "invoice";
|
|
480
|
+
buttons: "buttons";
|
|
481
|
+
paymentInvite: "paymentInvite";
|
|
482
|
+
interactive: "interactive";
|
|
483
|
+
reaction: "reaction";
|
|
484
|
+
interactiveResponse: "interactiveResponse";
|
|
485
|
+
pollCreation: "pollCreation";
|
|
486
|
+
pollUpdate: "pollUpdate";
|
|
487
|
+
keepInChat: "keepInChat";
|
|
488
|
+
requestPhoneNumber: "requestPhoneNumber";
|
|
489
|
+
scheduledCallCreation: "scheduledCallCreation";
|
|
490
|
+
groupMentioned: "groupMentioned";
|
|
491
|
+
pinInChat: "pinInChat";
|
|
492
|
+
scheduledCallEdit: "scheduledCallEdit";
|
|
493
|
+
ptv: "ptv";
|
|
494
|
+
botInvoke: "botInvoke";
|
|
495
|
+
callLog: "callLog";
|
|
496
|
+
encComment: "encComment";
|
|
497
|
+
bcall: "bcall";
|
|
498
|
+
lottieSticker: "lottieSticker";
|
|
499
|
+
event: "event";
|
|
500
|
+
comment: "comment";
|
|
501
|
+
placeholder: "placeholder";
|
|
502
|
+
encEventUpdate: "encEventUpdate";
|
|
503
|
+
}>;
|
|
504
|
+
receiverId: z.ZodString;
|
|
505
|
+
receiverName: z.ZodString;
|
|
506
|
+
roomId: z.ZodString;
|
|
507
|
+
roomName: z.ZodString;
|
|
508
|
+
senderLid: z.ZodString;
|
|
509
|
+
senderId: z.ZodString;
|
|
510
|
+
senderName: z.ZodString;
|
|
511
|
+
senderDevice: z.ZodEnum<{
|
|
512
|
+
unknown: "unknown";
|
|
513
|
+
android: "android";
|
|
514
|
+
ios: "ios";
|
|
515
|
+
desktop: "desktop";
|
|
516
|
+
web: "web";
|
|
517
|
+
}>;
|
|
518
|
+
timestamp: z.ZodNumber;
|
|
519
|
+
text: z.ZodNullable<z.ZodString>;
|
|
520
|
+
mentions: z.ZodArray<z.ZodString>;
|
|
521
|
+
links: z.ZodArray<z.ZodString>;
|
|
522
|
+
isBot: z.ZodBoolean;
|
|
523
|
+
isFromMe: z.ZodBoolean;
|
|
524
|
+
isPrefix: z.ZodBoolean;
|
|
525
|
+
isSpam: z.ZodBoolean;
|
|
526
|
+
isTagMe: z.ZodBoolean;
|
|
527
|
+
isGroup: z.ZodBoolean;
|
|
528
|
+
isNewsletter: z.ZodBoolean;
|
|
529
|
+
isQuestion: z.ZodBoolean;
|
|
530
|
+
isStory: z.ZodBoolean;
|
|
531
|
+
isViewOnce: z.ZodBoolean;
|
|
532
|
+
isEdited: z.ZodBoolean;
|
|
533
|
+
isDeleted: z.ZodBoolean;
|
|
534
|
+
isPinned: z.ZodBoolean;
|
|
535
|
+
isUnPinned: z.ZodBoolean;
|
|
536
|
+
isBroadcast: z.ZodBoolean;
|
|
537
|
+
isEphemeral: z.ZodBoolean;
|
|
538
|
+
isForwarded: z.ZodBoolean;
|
|
539
|
+
citation: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>>;
|
|
540
|
+
media: z.ZodNullable<z.ZodObject<{
|
|
541
|
+
buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
542
|
+
stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream__default, Stream__default>>>;
|
|
543
|
+
}, z.core.$loose>>;
|
|
544
|
+
message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
|
|
545
|
+
}, z.core.$strip>>;
|
|
353
546
|
}, z.core.$strip>;
|
|
547
|
+
type MessagesContext = z.infer<typeof ListenerMessagesType>;
|
|
354
548
|
|
|
355
549
|
declare const LimiterType: z$1.ZodOptional<z$1.ZodObject<{
|
|
356
550
|
maxMessages: z$1.ZodDefault<z$1.ZodNumber>;
|
|
@@ -486,9 +680,9 @@ declare const EventEnumType: z$1.ZodEnum<{
|
|
|
486
680
|
calls: "calls";
|
|
487
681
|
}>;
|
|
488
682
|
type EventCallbackType = {
|
|
489
|
-
connection: (ctx:
|
|
490
|
-
messages: (ctx:
|
|
491
|
-
calls: (ctx:
|
|
683
|
+
connection: (ctx: ConnectionContext) => void;
|
|
684
|
+
messages: (ctx: MessagesContext) => void;
|
|
685
|
+
calls: (ctx: CallsContext) => void;
|
|
492
686
|
};
|
|
493
687
|
|
|
494
688
|
declare const ButtonInteractiveReplyType: z.ZodObject<{
|
|
@@ -606,7 +800,7 @@ declare const ButtonType: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
606
800
|
}, z.core.$strip>]>>;
|
|
607
801
|
}, z.core.$strip>]>;
|
|
608
802
|
|
|
609
|
-
type ParsedMessage = Partial<
|
|
803
|
+
type ParsedMessage = Partial<MessagesContext>;
|
|
610
804
|
type CollectorFilter = (msg: ParsedMessage) => boolean;
|
|
611
805
|
type CollectorCallback = (messages: ParsedMessage[]) => void;
|
|
612
806
|
interface CollectorOptions {
|
|
@@ -629,13 +823,13 @@ declare class Logs {
|
|
|
629
823
|
constructor(client: Client);
|
|
630
824
|
getRoomColor(validator: any): "lime" | "orange" | "dimgray" | "blue";
|
|
631
825
|
initialize(): void;
|
|
632
|
-
message(message: Partial<
|
|
633
|
-
call(call: Partial<
|
|
826
|
+
message(message: Partial<MessagesContext>): void;
|
|
827
|
+
call(call: Partial<CallsContext>): void;
|
|
634
828
|
}
|
|
635
829
|
|
|
636
830
|
type MiddlewareContextType = {
|
|
637
|
-
messages?: Partial<
|
|
638
|
-
calls?: Partial<
|
|
831
|
+
messages?: Partial<MessagesContext>;
|
|
832
|
+
calls?: Partial<CallsContext>;
|
|
639
833
|
};
|
|
640
834
|
|
|
641
835
|
type MiddlewareNext = () => Promise<void> | void;
|
|
@@ -815,8 +1009,8 @@ declare class Client {
|
|
|
815
1009
|
citation?: Record<string, z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>;
|
|
816
1010
|
media?: {
|
|
817
1011
|
[x: string]: unknown;
|
|
818
|
-
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.
|
|
819
|
-
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.
|
|
1012
|
+
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1013
|
+
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream, Stream>>>;
|
|
820
1014
|
};
|
|
821
1015
|
replied?: {
|
|
822
1016
|
channelId: string;
|
|
@@ -856,10 +1050,9 @@ declare class Client {
|
|
|
856
1050
|
citation?: Record<string, z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodBoolean>>>;
|
|
857
1051
|
media?: {
|
|
858
1052
|
[x: string]: unknown;
|
|
859
|
-
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.
|
|
860
|
-
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.
|
|
1053
|
+
buffer: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1054
|
+
stream: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream, Stream>>>;
|
|
861
1055
|
};
|
|
862
|
-
replied?: /*elided*/ any;
|
|
863
1056
|
};
|
|
864
1057
|
}>>;
|
|
865
1058
|
getRoomName(roomId: string): Promise<string>;
|
|
@@ -1012,4 +1205,4 @@ declare class SessionWatchdog {
|
|
|
1012
1205
|
declare const createWatchdog: (options: WatchdogOptions) => SessionWatchdog;
|
|
1013
1206
|
declare const getWatchdog: () => SessionWatchdog | null;
|
|
1014
1207
|
|
|
1015
|
-
export { AudioProcessor, type AudioType, ButtonInteractiveCallType, ButtonInteractiveCopyType, ButtonInteractiveReplyType, ButtonInteractiveSingleSelectType, ButtonInteractiveType, ButtonInteractiveUrlType, ButtonSimpleType, ButtonType, CitationType, Client, ClientAuthPairingType, ClientAuthQRType, ClientBaseType, ClientOptionsType, DEVICE_ENUM_TYPES, DocumentProcessor, type EventCallbackType, EventEnumType, FakeReplyType, ImageProcessor, LimiterType, ListenerCallsType, ListenerConnectionType, ListenerMessagesType, Lowdb, MESSAGE_ENUM_TYPES, MediaProcessor, type PluginDefinition, Plugins, type PluginsConfigType, type PluginsHandlerType, SessionWatchdog, StickerMetadataType, StickerProcessor, VideoProcessor, cleanJid, cleanMediaObject, cleanupSocket, 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 };
|
|
1208
|
+
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, 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 };
|