@fvckerss/baileys 1.0.13 → 1.0.15

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.
@@ -0,0 +1,169 @@
1
+ export declare const VERSION: "4.7";
2
+ export declare const MESSAGE_BUILDER_VERSION: "4.7";
3
+
4
+ export interface AIRichItemOptions {
5
+ id?: string;
6
+ replace?: string | number;
7
+ insertAt?: string | number;
8
+ }
9
+
10
+ export declare class AIRichError extends Error {
11
+ constructor(message: string, code: string, meta?: Record<string, any>);
12
+ code: string;
13
+ }
14
+
15
+ export declare class ItemNotFoundError extends AIRichError {
16
+ constructor(id: string, availableIds?: string[]);
17
+ id: string;
18
+ availableIds: string[];
19
+ }
20
+
21
+ export declare class DuplicateIdError extends AIRichError {
22
+ constructor(id: string);
23
+ id: string;
24
+ }
25
+
26
+ export declare class InvalidTargetError extends AIRichError {
27
+ constructor(message: string, meta?: Record<string, any>);
28
+ }
29
+
30
+ export declare class ContentValidationError extends AIRichError {
31
+ constructor(message: string, meta?: Record<string, any>);
32
+ }
33
+
34
+ export declare class Toolkit {
35
+ constructor();
36
+ static extractIE(text: string, options?: Record<string, any>): any;
37
+ static resize(buffer: Buffer, x: number, y: number, fit?: string): Promise<Buffer>;
38
+ static waitAllPromises(input: any): Promise<any>;
39
+ static fetchBuffer(url: string, options?: Record<string, any>, settings?: { silent?: boolean }): Promise<Buffer>;
40
+ static toUrl(client: any, path: any, mediaType?: string): Promise<any>;
41
+ static resolveMedia(client: any, media: any, mediaType?: string, options?: Record<string, any>): Promise<any>;
42
+ static getMp4Duration(buffer: Buffer, options?: { silent?: boolean }): number;
43
+ static getMp4Preview(videoBuffer: Buffer, options?: Record<string, any>): Promise<Buffer | string>;
44
+ static stringifyEscaped(obj: any): string;
45
+ }
46
+
47
+ declare class BaseBuilder {
48
+ setTitle(title: string): this;
49
+ setSubtitle(subtitle: string): this;
50
+ setBody(body: string): this;
51
+ setFooter(footer: string): this;
52
+ setContextInfo(obj: Record<string, any>): this;
53
+ addPayload(obj: Record<string, any>): this;
54
+ }
55
+
56
+ export declare class Button extends BaseBuilder {
57
+ constructor(client: any);
58
+ loadFrom(msg: any): this;
59
+ setVideo(path: any, options?: Record<string, any>): this;
60
+ setImage(path: any, options?: Record<string, any>): this;
61
+ setDocument(path: any, options?: Record<string, any>): this;
62
+ setMedia(obj: Record<string, any>): this;
63
+ clearButtons(): this;
64
+ setParams(obj: Record<string, any>): this;
65
+ addButton(name: string, params: Record<string, any> | string): this;
66
+ makeRow(header?: string, title?: string, description?: string, id?: string): this;
67
+ makeSection(title?: string, highlightLabel?: string): this;
68
+ addSelection(title: string, options?: Record<string, any>): this;
69
+ addReply(displayText?: string, id?: string, options?: Record<string, any>): this;
70
+ addCall(displayText?: string, id?: string, options?: Record<string, any>): this;
71
+ addReminder(displayText?: string, id?: string, options?: Record<string, any>): this;
72
+ addCancelReminder(displayText?: string, id?: string, options?: Record<string, any>): this;
73
+ addAddress(displayText?: string, id?: string, options?: Record<string, any>): this;
74
+ addLocation(options?: Record<string, any>): this;
75
+ addUrl(displayText?: string, url?: string, webviewInteraction?: boolean, options?: Record<string, any>): this;
76
+ addCopy(displayText?: string, copyCode?: string, options?: Record<string, any>): this;
77
+ static paramsList: Record<string, any>;
78
+ toCard(): Promise<any>;
79
+ build(jid: string, options?: Record<string, any>): Promise<any>;
80
+ send(jid: string, options?: Record<string, any>): Promise<any>;
81
+ }
82
+
83
+ export declare class ButtonV2 extends BaseBuilder {
84
+ constructor(client: any);
85
+ loadFrom(msg: any): this;
86
+ addButton(displayText?: string, buttonId?: string): this;
87
+ addRawButton(obj: Record<string, any>): this;
88
+ setRawThumbnail(thumbnail: string): this;
89
+ setThumbnail(path: any): this;
90
+ setMedia(obj: Record<string, any>): this;
91
+ build(jid: string, options?: Record<string, any>): Promise<any>;
92
+ send(jid: string, options?: Record<string, any>): Promise<any>;
93
+ }
94
+
95
+ export declare class Carousel extends BaseBuilder {
96
+ constructor(client: any);
97
+ loadFrom(msg: any): this;
98
+ addCard(card: any): this;
99
+ build(jid: string, options?: Record<string, any>): any;
100
+ send(jid: string, options?: Record<string, any>): Promise<any>;
101
+ }
102
+
103
+ export declare class AIRich extends BaseBuilder {
104
+ constructor(client: any, options?: { dynamic?: boolean; unsupportedTypeAlert?: boolean });
105
+ loadFrom(msg: any): this;
106
+ setResponseMeta(meta: Record<string, any>): this;
107
+ setResponseId(id: string): this;
108
+ refreshResponseId(): this;
109
+ setBotResponseId(id: string): this;
110
+ refreshBotResponseId(): this;
111
+ createAlert(type: string): any;
112
+ hasId(id: string): boolean;
113
+ getIds(): string[];
114
+ peek(id?: string | number): any;
115
+ assignId(target: string | number, id: string): this;
116
+ delete(target: string | number): this;
117
+ addSubmessage(submessage: any, options?: AIRichItemOptions): this;
118
+ /**
119
+ * A section with no submessage travels as submessages: [], which every
120
+ * rendered AI Rich message has non-empty. Pass text for the plain-text
121
+ * twin, or submessage to shape it yourself.
122
+ */
123
+ addSection(section: any, options?: AIRichItemOptions & { text?: string; submessage?: any }): this;
124
+ addFooterSection(section: any): this;
125
+ addEmbeddedScreen(screen: any): this;
126
+ setBotMetadata(extra: Record<string, any>): this;
127
+ clearFooterSections(): this;
128
+ addText(text: string, options?: AIRichItemOptions & { hyperlink?: boolean; citation?: boolean; latex?: boolean }): this;
129
+ addFOAText(text: string, options?: AIRichItemOptions): this;
130
+ addCode(language: string, code: string, options?: AIRichItemOptions): this;
131
+ addTable(table: string[][], options?: AIRichItemOptions & { hyperlink?: boolean; citation?: boolean; latex?: boolean }): this;
132
+ addSource(sources?: any[], options?: AIRichItemOptions): this;
133
+ addReels(reelsItems?: any, options?: AIRichItemOptions): this;
134
+ addImage(imageUrl: any, options?: AIRichItemOptions & { width?: number; height?: number; status?: string; update_text?: string; resolveUrl?: boolean }): this;
135
+ addVideo(videoUrl: any, options?: AIRichItemOptions & { autoFill?: boolean; status?: string; estimatedTime?: number }): this;
136
+ addProduct(data?: any, options?: AIRichItemOptions): this;
137
+ addPost(data?: any, options?: AIRichItemOptions): this;
138
+ addMetadata(text: string, options?: AIRichItemOptions): this;
139
+ addTip(text: string, options?: AIRichItemOptions): this;
140
+ addWidget(data: any, options?: AIRichItemOptions & { layout?: string }): this;
141
+ addFooterAction(data: any, options?: AIRichItemOptions & { layout?: string }): this;
142
+ addSuggest(suggestion: string | string[], options?: AIRichItemOptions & { scroll?: boolean; layout?: string }): this;
143
+ build(jid: string, options?: Record<string, any>): Promise<any>;
144
+ buildEdit(targetJid: string, targetId: string, options?: Record<string, any>): Promise<any>;
145
+ send(jid: string, options?: Record<string, any>): Promise<any>;
146
+ sendEdit(jid?: string, id?: string, options?: Record<string, any>): Promise<any>;
147
+ readonly sections: any[];
148
+ readonly items: any[];
149
+ static tokenizer(code: string, lang?: string): any;
150
+ static toTableMetadata(arr: string[][], options?: Record<string, any>): any;
151
+ static newLayout(name: string, data: any, extra?: Record<string, any>): any;
152
+ static generateVerificationMetadata(): any;
153
+ }
154
+
155
+ export declare const MessageBuilder: Readonly<{
156
+ VERSION: "4.7";
157
+ Button: typeof Button;
158
+ ButtonV2: typeof ButtonV2;
159
+ Carousel: typeof Carousel;
160
+ AIRich: typeof AIRich;
161
+ Toolkit: typeof Toolkit;
162
+ AIRichError: typeof AIRichError;
163
+ ItemNotFoundError: typeof ItemNotFoundError;
164
+ DuplicateIdError: typeof DuplicateIdError;
165
+ InvalidTargetError: typeof InvalidTargetError;
166
+ ContentValidationError: typeof ContentValidationError;
167
+ }>;
168
+
169
+ export declare const MB: typeof MessageBuilder;