zaileys 2.1.8 → 2.2.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/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as baileys from 'baileys';
2
2
  import baileys__default, { AuthenticationState, WAMessage, proto, ParticipantAction, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue } from 'baileys';
3
3
  import { JetDB } from 'jetdb';
4
- export { JetDB, JetDBOptions, createJetDB } from 'jetdb';
5
4
  import z, { z as z$1 } from 'zod';
6
5
  import Stream from 'stream';
6
+ import pino from 'pino';
7
7
  import _ from 'lodash';
8
8
 
9
9
  declare const useAuthState: (folder: string) => Promise<{
@@ -34,8 +34,8 @@ declare const SignalOptionsType: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.Zo
34
34
  sticker: z.ZodUnion<[z.ZodUnion<[z.ZodURL, z.ZodBase64]>, z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>;
35
35
  shape: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
36
36
  default: "default";
37
- rounded: "rounded";
38
37
  circle: "circle";
38
+ rounded: "rounded";
39
39
  oval: "oval";
40
40
  }>>>;
41
41
  caption: z.ZodOptional<z.ZodString>;
@@ -257,7 +257,6 @@ declare class SignalPrivacy {
257
257
  declare const ListenerCallsType: z.ZodObject<{
258
258
  callId: z.ZodString;
259
259
  callerId: z.ZodString;
260
- callerName: z.ZodString;
261
260
  roomId: z.ZodString;
262
261
  roomName: z.ZodString;
263
262
  date: z.ZodDate;
@@ -303,6 +302,7 @@ declare const DEVICE_ENUM_TYPES: z.ZodEnum<{
303
302
  web: "web";
304
303
  }>;
305
304
  declare const MESSAGE_ENUM_TYPES: z.ZodEnum<{
305
+ video: "video";
306
306
  text: "text";
307
307
  album: "album";
308
308
  image: "image";
@@ -310,7 +310,6 @@ declare const MESSAGE_ENUM_TYPES: z.ZodEnum<{
310
310
  location: "location";
311
311
  document: "document";
312
312
  audio: "audio";
313
- video: "video";
314
313
  protocol: "protocol";
315
314
  contacts: "contacts";
316
315
  highlyStructured: "highlyStructured";
@@ -359,6 +358,7 @@ declare const BaseMessagesType: z.ZodObject<{
359
358
  uniqueId: z.ZodString;
360
359
  chatId: z.ZodString;
361
360
  chatType: z.ZodEnum<{
361
+ video: "video";
362
362
  text: "text";
363
363
  album: "album";
364
364
  image: "image";
@@ -366,7 +366,6 @@ declare const BaseMessagesType: z.ZodObject<{
366
366
  location: "location";
367
367
  document: "document";
368
368
  audio: "audio";
369
- video: "video";
370
369
  protocol: "protocol";
371
370
  contacts: "contacts";
372
371
  highlyStructured: "highlyStructured";
@@ -454,6 +453,7 @@ declare const BaseMessagesType: z.ZodObject<{
454
453
  buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
455
454
  stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream, Stream>>>;
456
455
  }, z.core.$loose>>;
456
+ injection: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
457
457
  message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
458
458
  }, z.core.$strip>;
459
459
  declare const ListenerMessagesType: z.ZodObject<{
@@ -461,6 +461,7 @@ declare const ListenerMessagesType: z.ZodObject<{
461
461
  uniqueId: z.ZodString;
462
462
  chatId: z.ZodString;
463
463
  chatType: z.ZodEnum<{
464
+ video: "video";
464
465
  text: "text";
465
466
  album: "album";
466
467
  image: "image";
@@ -468,7 +469,6 @@ declare const ListenerMessagesType: z.ZodObject<{
468
469
  location: "location";
469
470
  document: "document";
470
471
  audio: "audio";
471
- video: "video";
472
472
  protocol: "protocol";
473
473
  contacts: "contacts";
474
474
  highlyStructured: "highlyStructured";
@@ -556,12 +556,14 @@ declare const ListenerMessagesType: z.ZodObject<{
556
556
  buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
557
557
  stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream, Stream>>>;
558
558
  }, z.core.$loose>>;
559
+ injection: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
559
560
  message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
560
561
  replied: z.ZodNullable<z.ZodObject<{
561
562
  channelId: z.ZodString;
562
563
  uniqueId: z.ZodString;
563
564
  chatId: z.ZodString;
564
565
  chatType: z.ZodEnum<{
566
+ video: "video";
565
567
  text: "text";
566
568
  album: "album";
567
569
  image: "image";
@@ -569,7 +571,6 @@ declare const ListenerMessagesType: z.ZodObject<{
569
571
  location: "location";
570
572
  document: "document";
571
573
  audio: "audio";
572
- video: "video";
573
574
  protocol: "protocol";
574
575
  contacts: "contacts";
575
576
  highlyStructured: "highlyStructured";
@@ -657,6 +658,7 @@ declare const ListenerMessagesType: z.ZodObject<{
657
658
  buffer: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
658
659
  stream: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodPromise<z.ZodCustom<Stream, Stream>>>;
659
660
  }, z.core.$loose>>;
661
+ injection: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
660
662
  message: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodCustom<WAMessage, WAMessage>>;
661
663
  }, z.core.$strip>>;
662
664
  }, z.core.$strip>;
@@ -679,8 +681,8 @@ declare const FakeReplyType: z$1.ZodOptional<z$1.ZodObject<{
679
681
  }, z$1.core.$strip>>;
680
682
  declare const StickerShapeType: z$1.ZodDefault<z$1.ZodEnum<{
681
683
  default: "default";
682
- rounded: "rounded";
683
684
  circle: "circle";
685
+ rounded: "rounded";
684
686
  oval: "oval";
685
687
  }>>;
686
688
  declare const StickerMetadataType: z$1.ZodOptional<z$1.ZodObject<{
@@ -689,25 +691,37 @@ declare const StickerMetadataType: z$1.ZodOptional<z$1.ZodObject<{
689
691
  quality: z$1.ZodOptional<z$1.ZodNumber>;
690
692
  shape: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodEnum<{
691
693
  default: "default";
692
- rounded: "rounded";
693
694
  circle: "circle";
695
+ rounded: "rounded";
694
696
  oval: "oval";
695
697
  }>>>;
696
698
  }, z$1.core.$strip>>;
699
+ declare const autoCleanUp: z$1.ZodOptional<z$1.ZodObject<{
700
+ enabled: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
701
+ intervalMs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
702
+ maxAgeMs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
703
+ scopes: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodArray<z$1.ZodString>>>;
704
+ }, z$1.core.$strip>>;
697
705
  declare const ClientBaseType: z$1.ZodObject<{
698
706
  session: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
699
- prefix: z$1.ZodOptional<z$1.ZodString>;
707
+ prefix: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
700
708
  ignoreMe: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
701
709
  showLogs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
710
+ fancyLogs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
702
711
  syncFullHistory: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
703
712
  disableFFmpeg: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
704
- cleanupDays: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
705
713
  autoMarkAI: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
706
714
  autoMentions: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
707
715
  autoOnline: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
708
716
  autoRead: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
709
717
  autoPresence: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
710
718
  autoRejectCall: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
719
+ autoCleanUp: z$1.ZodOptional<z$1.ZodObject<{
720
+ enabled: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
721
+ intervalMs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
722
+ maxAgeMs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
723
+ scopes: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodArray<z$1.ZodString>>>;
724
+ }, z$1.core.$strip>>;
711
725
  limiter: z$1.ZodOptional<z$1.ZodObject<{
712
726
  maxMessages: z$1.ZodDefault<z$1.ZodNumber>;
713
727
  durationMs: z$1.ZodDefault<z$1.ZodNumber>;
@@ -729,8 +743,8 @@ declare const ClientBaseType: z$1.ZodObject<{
729
743
  quality: z$1.ZodOptional<z$1.ZodNumber>;
730
744
  shape: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodEnum<{
731
745
  default: "default";
732
- rounded: "rounded";
733
746
  circle: "circle";
747
+ rounded: "rounded";
734
748
  oval: "oval";
735
749
  }>>>;
736
750
  }, z$1.core.$strip>>;
@@ -746,18 +760,24 @@ declare const ClientOptionsType: z$1.ZodUnion<readonly [z$1.ZodObject<{
746
760
  authType: z$1.ZodLiteral<"pairing">;
747
761
  phoneNumber: z$1.ZodNumber;
748
762
  session: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
749
- prefix: z$1.ZodOptional<z$1.ZodString>;
763
+ prefix: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
750
764
  ignoreMe: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
751
765
  showLogs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
766
+ fancyLogs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
752
767
  syncFullHistory: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
753
768
  disableFFmpeg: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
754
- cleanupDays: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
755
769
  autoMarkAI: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
756
770
  autoMentions: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
757
771
  autoOnline: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
758
772
  autoRead: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
759
773
  autoPresence: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
760
774
  autoRejectCall: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
775
+ autoCleanUp: z$1.ZodOptional<z$1.ZodObject<{
776
+ enabled: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
777
+ intervalMs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
778
+ maxAgeMs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
779
+ scopes: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodArray<z$1.ZodString>>>;
780
+ }, z$1.core.$strip>>;
761
781
  limiter: z$1.ZodOptional<z$1.ZodObject<{
762
782
  maxMessages: z$1.ZodDefault<z$1.ZodNumber>;
763
783
  durationMs: z$1.ZodDefault<z$1.ZodNumber>;
@@ -779,26 +799,32 @@ declare const ClientOptionsType: z$1.ZodUnion<readonly [z$1.ZodObject<{
779
799
  quality: z$1.ZodOptional<z$1.ZodNumber>;
780
800
  shape: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodEnum<{
781
801
  default: "default";
782
- rounded: "rounded";
783
802
  circle: "circle";
803
+ rounded: "rounded";
784
804
  oval: "oval";
785
805
  }>>>;
786
806
  }, z$1.core.$strip>>;
787
807
  }, z$1.core.$strip>, z$1.ZodObject<{
788
808
  authType: z$1.ZodLiteral<"qr">;
789
809
  session: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
790
- prefix: z$1.ZodOptional<z$1.ZodString>;
810
+ prefix: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
791
811
  ignoreMe: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
792
812
  showLogs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
813
+ fancyLogs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
793
814
  syncFullHistory: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
794
815
  disableFFmpeg: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
795
- cleanupDays: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
796
816
  autoMarkAI: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
797
817
  autoMentions: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
798
818
  autoOnline: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
799
819
  autoRead: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
800
820
  autoPresence: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
801
821
  autoRejectCall: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
822
+ autoCleanUp: z$1.ZodOptional<z$1.ZodObject<{
823
+ enabled: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodBoolean>>;
824
+ intervalMs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
825
+ maxAgeMs: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodNumber>>;
826
+ scopes: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodArray<z$1.ZodString>>>;
827
+ }, z$1.core.$strip>>;
802
828
  limiter: z$1.ZodOptional<z$1.ZodObject<{
803
829
  maxMessages: z$1.ZodDefault<z$1.ZodNumber>;
804
830
  durationMs: z$1.ZodDefault<z$1.ZodNumber>;
@@ -820,15 +846,15 @@ declare const ClientOptionsType: z$1.ZodUnion<readonly [z$1.ZodObject<{
820
846
  quality: z$1.ZodOptional<z$1.ZodNumber>;
821
847
  shape: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodEnum<{
822
848
  default: "default";
823
- rounded: "rounded";
824
849
  circle: "circle";
850
+ rounded: "rounded";
825
851
  oval: "oval";
826
852
  }>>>;
827
853
  }, z$1.core.$strip>>;
828
854
  }, z$1.core.$strip>]>;
829
855
  declare const EventEnumType: z$1.ZodEnum<{
830
- connection: "connection";
831
856
  messages: "messages";
857
+ connection: "connection";
832
858
  calls: "calls";
833
859
  }>;
834
860
  type EventCallbackType = {
@@ -952,46 +978,6 @@ declare const ButtonType: z.ZodUnion<readonly [z.ZodObject<{
952
978
  }, z.core.$strip>]>>;
953
979
  }, z.core.$strip>]>;
954
980
 
955
- type ParsedMessage = Partial<MessagesContext>;
956
- type CollectorFilter = (msg: ParsedMessage) => boolean;
957
- type CollectorCallback = (messages: ParsedMessage[]) => void;
958
- interface CollectorOptions {
959
- filter?: CollectorFilter;
960
- timeout: number;
961
- max?: number;
962
- }
963
- declare class MessageCollector {
964
- collect(channelId: string, options: CollectorOptions, callback: CollectorCallback): void;
965
- push(msg: ParsedMessage): boolean;
966
- has(channelId: string): boolean;
967
- cancel(channelId: string): ParsedMessage[];
968
- }
969
-
970
- interface HealthOptions {
971
- checkIntervalMs?: number;
972
- staleThresholdMs?: number;
973
- cooldownMs?: number;
974
- maxRetries?: number;
975
- }
976
- declare class HealthManager {
977
- private client;
978
- private lastActivityTime;
979
- private lastRecoveryTime;
980
- private checkInterval;
981
- private cleanupInterval;
982
- private isRecovering;
983
- private retryCount;
984
- private options;
985
- constructor(client: Client, options?: HealthOptions);
986
- start(): void;
987
- stop(): void;
988
- touch(): void;
989
- private setupActivityListeners;
990
- private check;
991
- private isInCooldown;
992
- recover(): Promise<void>;
993
- }
994
-
995
981
  declare class Logs {
996
982
  private client;
997
983
  private logsInitialized;
@@ -1018,65 +1004,90 @@ declare class Middleware<T> {
1018
1004
  run(ctx: MiddlewareContextType): Promise<void>;
1019
1005
  }
1020
1006
 
1007
+ declare class CleanUpManager {
1008
+ private client;
1009
+ private interval;
1010
+ constructor(client: Client);
1011
+ start(): void;
1012
+ stop(): void;
1013
+ run(): Promise<void>;
1014
+ }
1015
+
1016
+ declare class HealthManager {
1017
+ private client;
1018
+ private keysDb;
1019
+ constructor(client: Client);
1020
+ private setupLogFilters;
1021
+ repair(jid: string): Promise<void>;
1022
+ get logger(): pino.Logger<never, boolean>;
1023
+ }
1024
+
1021
1025
  type PluginsHandlerType = (wa: Client, ctx: MiddlewareContextType) => Promise<void> | void;
1022
1026
  type PluginsConfigType = {
1023
- matcher: string[];
1027
+ matcher: (string | RegExp)[];
1024
1028
  metadata?: Record<string, any>;
1025
1029
  };
1026
1030
  type PluginDefinition = {
1027
1031
  handler: PluginsHandlerType;
1028
1032
  config: PluginsConfigType;
1033
+ parent: string | null;
1034
+ enabled: boolean;
1029
1035
  };
1030
1036
  declare class Plugins {
1031
1037
  private plugins;
1032
1038
  private pluginsDir;
1039
+ private globalEnabled;
1040
+ private disabledPlugins;
1033
1041
  constructor(pluginsDir?: string);
1034
- /**
1035
- * Rekursif membaca semua file di direktori dan subdirektori
1036
- */
1037
1042
  private getAllFiles;
1038
1043
  load(): Promise<void>;
1044
+ private getPluginId;
1039
1045
  execute(wa: Client, ctx: MiddlewareContextType): Promise<void>;
1040
1046
  private match;
1047
+ enableAll(): void;
1048
+ disableAll(): void;
1049
+ enable(matcher: string | RegExp): boolean;
1050
+ disable(matcher: string | RegExp): boolean;
1051
+ enableByParent(parent: string): number;
1052
+ disableByParent(parent: string): number;
1053
+ isEnabled(): boolean;
1041
1054
  getLoadedPlugins(): PluginDefinition[];
1042
1055
  getPluginsInfo(): {
1043
- matcher: string[];
1056
+ matcher: (string | RegExp)[];
1044
1057
  metadata?: Record<string, any>;
1058
+ parent: string | null;
1059
+ enabled: boolean;
1045
1060
  }[];
1046
1061
  reload(): Promise<void>;
1047
1062
  }
1048
- declare const definePlugins: (handler: PluginsHandlerType, config: PluginsConfigType) => PluginDefinition;
1063
+ declare const definePlugins: (handler: PluginsHandlerType, config: PluginsConfigType) => Omit<PluginDefinition, "parent" | "enabled">;
1049
1064
 
1050
1065
  interface Client extends Signal, SignalGroup, SignalPrivacy, SignalNewsletter, SignalCommunity {
1051
1066
  }
1052
1067
  declare class Client {
1053
1068
  options: z.infer<typeof ClientOptionsType>;
1054
- private listener;
1055
1069
  private _ready;
1056
- health: HealthManager;
1057
1070
  logs: Logs;
1058
- collector: MessageCollector;
1059
1071
  middleware: Middleware<any>;
1060
1072
  plugins: Plugins;
1073
+ health: HealthManager;
1074
+ cleanup: CleanUpManager;
1061
1075
  constructor(options: z.infer<typeof ClientOptionsType>);
1062
1076
  initialize(client?: Client): Promise<void>;
1063
1077
  ready(): Promise<void>;
1064
- db(path: string): JetDB;
1078
+ db(scope: string): JetDB;
1065
1079
  on<T extends z.infer<typeof EventEnumType>>(event: T, handler: EventCallbackType[T]): void;
1066
1080
  use<T>(handler: MiddlewareHandler<T>): this;
1067
1081
  get socket(): ReturnType<typeof baileys__default>;
1068
1082
  getRoomName(roomId: string): Promise<string>;
1069
- getLabelName(roomId: string): Promise<string>;
1070
- cleanupMessages(days?: number): Promise<void>;
1083
+ inject<T = any>(key: string, value: T): void;
1084
+ getInjection<T = any>(key: string): T | undefined;
1085
+ removeInjection(key: string): void;
1086
+ clearInjections(): void;
1071
1087
  }
1072
1088
 
1073
1089
  declare const registerAuthCreds: (client: Client) => Promise<void>;
1074
1090
 
1075
- declare const ignoreLint: (data: any) => any;
1076
- declare const getLatestLibVersion: () => Promise<any>;
1077
- declare const removeAuthCreds: (session: string) => Promise<void>;
1078
- declare const normalizeText: (text?: string) => string;
1079
-
1080
1091
  declare const logColor: (text: string, color?: string[] | string) => string;
1081
1092
  declare const toJson: (object: unknown) => any;
1082
1093
  declare const toString: (object: unknown) => string;
@@ -1088,68 +1099,76 @@ declare const pickKeysFromArray: (arr: any[], keys: string[]) => any;
1088
1099
  declare const findNestedByKeys: (data: unknown, target: Record<string, any> | Record<string, any>[]) => any;
1089
1100
  declare const modifyFn: <T extends (...args: any[]) => any>(fn: T, before?: (args: any[]) => void | any, after?: (result: any, args: any[]) => any) => T;
1090
1101
 
1091
- declare const generateId: (input: string | string[]) => string;
1092
- declare const getUsersMentions: (text?: string) => string[];
1093
- declare const extractJids: (text?: string) => string[];
1094
- declare const numbersToJids: (numbers: number[]) => string[];
1095
- 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">;
1096
- declare const getDeepContent: (raw?: proto.IMessage | null) => {
1097
- leaf: any;
1098
- chain: string[];
1099
- };
1100
- declare const cleanJid: (jid: string) => number;
1101
-
1102
- declare const configureFFmpeg: (disable?: boolean) => Promise<void>;
1103
1102
  type MediaInput = string | ArrayBuffer | Buffer;
1103
+
1104
1104
  type AudioType = 'opus' | 'mp3';
1105
- declare class AudioProcessor {
1106
- static getWaAudio(input: MediaInput, type?: AudioType): Promise<Buffer>;
1107
- }
1108
- declare class VideoProcessor {
1109
- static getThumbnail(input: MediaInput): Promise<string>;
1110
- static getDuration(filePath: string): Promise<number>;
1111
- static getWaVideo(input: MediaInput): Promise<Buffer>;
1105
+
1106
+ declare class AudioModifier {
1107
+ private input;
1108
+ constructor(input: MediaInput);
1109
+ toOpus(): Promise<Buffer>;
1110
+ toMp3(): Promise<Buffer>;
1111
+ convert(type?: AudioType): Promise<Buffer>;
1112
1112
  }
1113
- declare class ImageProcessor {
1114
- static getThumbnail(buffer: Buffer): Promise<string>;
1115
- static resizeForSticker(buffer: Buffer, quality: number, shape?: string): Promise<Buffer>;
1116
- static getWaImage(input: MediaInput): Promise<Buffer>;
1113
+ declare class VideoModifier {
1114
+ private input;
1115
+ constructor(input: MediaInput);
1116
+ toMp4(): Promise<Buffer>;
1117
+ thumbnail(): Promise<string>;
1117
1118
  }
1118
- declare class MediaProcessor {
1119
- static getThumbnail(input: MediaInput): Promise<string>;
1119
+ declare class ImageModifier {
1120
+ private input;
1121
+ constructor(input: MediaInput);
1122
+ toJpeg(): Promise<Buffer>;
1123
+ thumbnail(): Promise<string>;
1124
+ resize(width: number, height: number): Promise<Buffer>;
1120
1125
  }
1121
- declare class StickerProcessor {
1122
- private static createExifMetadata;
1123
- private static processAnimated;
1124
- private static getExtension;
1125
- static create(input: MediaInput, metadata?: z.infer<typeof StickerMetadataType>): Promise<Buffer>;
1126
+ declare class StickerModifier {
1127
+ private input;
1128
+ private metadata?;
1129
+ constructor(input: MediaInput, metadata?: z.infer<typeof StickerMetadataType>);
1130
+ create(): Promise<Buffer>;
1126
1131
  }
1127
- declare class DocumentProcessor {
1128
- static create(input: MediaInput): Promise<{
1129
- document: any;
1132
+ declare class DocumentModifier {
1133
+ private input;
1134
+ constructor(input: MediaInput);
1135
+ create(): Promise<{
1136
+ document: Buffer<ArrayBufferLike>;
1130
1137
  mimetype: string;
1131
1138
  fileName: string;
1132
1139
  jpegThumbnail: string;
1133
1140
  }>;
1134
1141
  }
1135
- declare const toBuffer: any;
1136
- declare const getWaAudio: any;
1137
- declare const getWaImage: any;
1138
- declare const getWaVideo: any;
1139
- declare const getVideoThumbnail: any;
1140
- declare const getVideoDuration: any;
1141
- declare const getMediaThumbnail: any;
1142
- declare const getWaSticker: any;
1143
- declare const getWaDocument: any;
1142
+ declare class MediaThumbnailModifier {
1143
+ private input;
1144
+ constructor(input: MediaInput);
1145
+ get(): Promise<string>;
1146
+ }
1147
+ declare class MediaModifier {
1148
+ audio(input: MediaInput): AudioModifier;
1149
+ video(input: MediaInput): VideoModifier;
1150
+ image(input: MediaInput): ImageModifier;
1151
+ sticker(input: MediaInput, metadata?: z.infer<typeof StickerMetadataType>): StickerModifier;
1152
+ document(input: MediaInput): DocumentModifier;
1153
+ thumbnail(input: MediaInput): MediaThumbnailModifier;
1154
+ toBuffer(input: MediaInput): Promise<Buffer>;
1155
+ }
1156
+ declare const mediaModifier: MediaModifier;
1144
1157
 
1145
- type WASocket = {
1146
- ev?: {
1147
- removeAllListeners: () => void;
1148
- };
1149
- end?: (reason?: Error) => void;
1158
+ declare const generateId: (input: string | string[]) => string;
1159
+ declare const getUsersMentions: (text?: string) => string[];
1160
+ declare const extractJids: (text?: string) => string[];
1161
+ declare const numbersToJids: (numbers: number[]) => string[];
1162
+ declare const cleanMediaObject: (object: any) => _.Omit<any, "message" | "url" | "contextInfo" | "fileSha256" | "fileEncSha256" | "mediaKey" | "directPath" | "waveform" | "thumbnail" | "jpegThumbnail" | "thumbnailEncSha256" | "thumbnailSha256" | "thumbnailDirectPath" | "firstFrameSidecar" | "streamingSidecar" | "scansSidecar" | "callKey" | "key" | "midQualityFileSha256" | "historySyncNotification" | "appStateSyncKeyShare" | "appStateSyncKeyRequest" | "initialSecurityNotificationSettingSync" | "appStateFatalExceptionNotification" | "disappearingMode" | "peerDataOperationRequestMessage" | "peerDataOperationRequestResponseMessage" | "botFeedbackMessage">;
1163
+ declare const getDeepContent: (raw?: proto.IMessage | null) => {
1164
+ leaf: any;
1165
+ chain: string[];
1150
1166
  };
1151
- declare const cleanupSocket: (socket: WASocket) => void;
1152
- declare const repairSessionKeys: (session: string) => Promise<void>;
1153
- declare const getExistingSocket: () => WASocket | null;
1167
+ declare const cleanJid: (jid: string) => number;
1168
+
1169
+ declare const ignoreLint: (data: any) => any;
1170
+ declare const getLatestLibVersion: () => Promise<any>;
1171
+ declare const removeAuthCreds: (session: string) => Promise<void>;
1172
+ declare const normalizeText: (text?: string) => string;
1154
1173
 
1155
- 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, getWaImage, getWaSticker, getWaVideo, ignoreLint, logColor, modifyFn, normalizeText, numbersToJids, pickKeysFromArray, randomize, registerAuthCreds, removeAuthCreds, repairSessionKeys, shuffleString, toBuffer, toJson, toString, useAuthState };
1174
+ export { BaseMessagesType, ButtonInteractiveCallType, ButtonInteractiveCopyType, ButtonInteractiveReplyType, ButtonInteractiveSingleSelectType, ButtonInteractiveType, ButtonInteractiveUrlType, ButtonSimpleType, ButtonType, type CallsContext, CitationType, Client, ClientAuthPairingType, ClientAuthQRType, ClientBaseType, ClientOptionsType, type ConnectionContext, DEVICE_ENUM_TYPES, type EventCallbackType, EventEnumType, FakeReplyType, LimiterType, ListenerCallsType, ListenerConnectionType, ListenerMessagesType, MESSAGE_ENUM_TYPES, MediaModifier, type MessagesContext, type PluginDefinition, Plugins, type PluginsConfigType, type PluginsHandlerType, StickerMetadataType, StickerShapeType, autoCleanUp, cleanJid, cleanMediaObject, definePlugins, extractJids, extractUrls, findGlobalWord, findNestedByKeys, generateId, getDeepContent, getLatestLibVersion, getUsersMentions, ignoreLint, logColor, mediaModifier, modifyFn, normalizeText, numbersToJids, pickKeysFromArray, randomize, registerAuthCreds, removeAuthCreds, shuffleString, toJson, toString, useAuthState };