@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.
- package/lib/Builder/extras.d.ts +332 -0
- package/lib/Builder/extras.js +948 -0
- package/lib/Builder/index.d.ts +169 -0
- package/lib/Builder/index.js +3298 -0
- package/lib/Socket/messages-send.js +62 -1
- package/lib/Utils/html-app.js +96 -0
- package/lib/Utils/messages-media.js +152 -67
- package/lib/Utils/messages.js +2 -0
- package/lib/Utils/optional-media.js +45 -0
- package/lib/Utils/rich-message-utils.js +269 -1028
- package/lib/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
export declare const AI_RICH_LAYOUTS: readonly string[];
|
|
2
|
+
export declare const AI_RICH_PRIMITIVES: readonly string[];
|
|
3
|
+
export declare const AI_RICH_PRIMITIVES_ANDROID_ONLY: readonly string[];
|
|
4
|
+
export declare const AI_RICH_HTML_PRIMITIVE: 'GenAIaeacdsnwHtmlPrimitive';
|
|
5
|
+
|
|
6
|
+
export declare const DividerType: Readonly<{ DOT: 'DOT'; HORIZONTAL_LINE: 'HORIZONTAL_LINE' }>;
|
|
7
|
+
export declare const ImagineType: Readonly<{ IMAGINE: 'IMAGINE'; ANIMATE: 'ANIMATE'; MEMU: 'MEMU' }>;
|
|
8
|
+
export declare const ImagineStatus: Readonly<{ GENERATING: 'GENERATING'; READY: 'READY'; FAILED: 'FAILED' }>;
|
|
9
|
+
export declare const ThinkingIcon: Readonly<{ THINKING: 'THINKING'; WEB_SEARCH: 'WEB_SEARCH'; META_SEARCH: 'META_SEARCH' }>;
|
|
10
|
+
export declare const TaskStatus: Readonly<{ PENDING: 'PENDING'; RUNNING: 'RUNNING'; DONE: 'DONE' }>;
|
|
11
|
+
export declare const FooterActionType: Readonly<Record<string, string>>;
|
|
12
|
+
export declare const AddonActionType: Readonly<Record<string, string>>;
|
|
13
|
+
|
|
14
|
+
export declare function dividerSection(options?: { dividerType?: string }): any;
|
|
15
|
+
export declare function spacerSection(options?: { spacing?: number }): any;
|
|
16
|
+
export declare function imageSection(url: string, options?: {
|
|
17
|
+
fallbackUrl?: string;
|
|
18
|
+
previewUrl?: string;
|
|
19
|
+
previewFallbackUrl?: string;
|
|
20
|
+
}): any;
|
|
21
|
+
export declare function taskSection(options: {
|
|
22
|
+
taskId: string | number;
|
|
23
|
+
title?: string;
|
|
24
|
+
subtitle?: string;
|
|
25
|
+
status?: string;
|
|
26
|
+
}): any;
|
|
27
|
+
export declare function latexSection(expression: string, options?: {
|
|
28
|
+
image?: string;
|
|
29
|
+
width?: number;
|
|
30
|
+
height?: number;
|
|
31
|
+
fontHeight?: number;
|
|
32
|
+
padding?: number;
|
|
33
|
+
}): any;
|
|
34
|
+
export declare function thinkingSection(title: string, options?: {
|
|
35
|
+
icon?: string;
|
|
36
|
+
inProgress?: boolean;
|
|
37
|
+
metaSearchApps?: string[];
|
|
38
|
+
thoughtDurationSec?: number;
|
|
39
|
+
}): any;
|
|
40
|
+
export declare function progressSection(title: string, options?: {
|
|
41
|
+
icon?: string;
|
|
42
|
+
inProgress?: boolean;
|
|
43
|
+
metaSearchApps?: string[];
|
|
44
|
+
thoughtDurationSec?: number;
|
|
45
|
+
}): any;
|
|
46
|
+
|
|
47
|
+
export declare function lockHeight(height: number): string;
|
|
48
|
+
|
|
49
|
+
export declare const HTML_APP_BRIDGE: 'AndroidBridge';
|
|
50
|
+
|
|
51
|
+
export declare function dataUri(bytes: Buffer | Uint8Array, mimetype: string): string;
|
|
52
|
+
|
|
53
|
+
export declare function htmlMedia(bytes: Buffer | Uint8Array, options: {
|
|
54
|
+
mimetype: string;
|
|
55
|
+
tag?: 'video' | 'audio' | 'img';
|
|
56
|
+
label?: string;
|
|
57
|
+
poster?: string;
|
|
58
|
+
id?: string;
|
|
59
|
+
attributes?: string;
|
|
60
|
+
}): string;
|
|
61
|
+
|
|
62
|
+
export interface AutoHeightOptions {
|
|
63
|
+
min?: number;
|
|
64
|
+
max?: number;
|
|
65
|
+
settleMs?: number;
|
|
66
|
+
maxReports?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare function autoHeight(options?: AutoHeightOptions): string;
|
|
70
|
+
|
|
71
|
+
export interface ScrollControlsOptions {
|
|
72
|
+
/** CSS selector for the pane to scroll. Defaults to the #__wrap that height creates. */
|
|
73
|
+
target?: string;
|
|
74
|
+
/** Pixels per tap, and per repeat while held. */
|
|
75
|
+
step?: number;
|
|
76
|
+
/** Repeat interval while a button is held down, at least 16. */
|
|
77
|
+
holdMs?: number;
|
|
78
|
+
/** Button edge length in pixels, at least 24. */
|
|
79
|
+
size?: number;
|
|
80
|
+
side?: 'right' | 'left';
|
|
81
|
+
inset?: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* On-screen scroll buttons. Touch scrolling inside the bubble is taken by the
|
|
86
|
+
* chat list behind it, so a page taller than its bubble cannot be scrolled by
|
|
87
|
+
* dragging; these move the pane programmatically instead. Hidden when the
|
|
88
|
+
* content already fits.
|
|
89
|
+
*/
|
|
90
|
+
export declare function scrollControls(options?: ScrollControlsOptions): string;
|
|
91
|
+
|
|
92
|
+
export declare const AI_RICH_HTML_PRIMITIVE_ANDROID_CLASS: 'FOAHtmlPrimitive';
|
|
93
|
+
|
|
94
|
+
export declare function htmlSection(html: string, options?: {
|
|
95
|
+
trustedSources?: string[];
|
|
96
|
+
height?: number;
|
|
97
|
+
typename?: string;
|
|
98
|
+
/** WebView base origin (e.g. https://example.com) — without it the WebView runs on an opaque/null origin and WebSocket/fetch are blocked */
|
|
99
|
+
url?: string;
|
|
100
|
+
/** wrapper typename on the section object, defaults to 'GenAIUnifiedResponseSection' (proven wire shape); pass null for the bare layout */
|
|
101
|
+
sectionTypename?: string | null;
|
|
102
|
+
}): any;
|
|
103
|
+
|
|
104
|
+
export declare function sendHtmlApp(sock: any, jid: string, html: string, options?: {
|
|
105
|
+
title?: string;
|
|
106
|
+
label?: string;
|
|
107
|
+
trustedSources?: string[];
|
|
108
|
+
height?: number;
|
|
109
|
+
autoHeight?: boolean | AutoHeightOptions;
|
|
110
|
+
scrollButtons?: boolean | ScrollControlsOptions;
|
|
111
|
+
typename?: string;
|
|
112
|
+
id?: string;
|
|
113
|
+
/** WebView base origin (e.g. https://example.com) — required for WebSocket/fetch to work inside the mini app */
|
|
114
|
+
url?: string;
|
|
115
|
+
/** render the HTML as an embedded_screens bottom-sheet (FOAIDNixelButtonSheets) instead of a plain section */
|
|
116
|
+
embedded?: boolean;
|
|
117
|
+
/** title of the embedded screen sheet (embedded mode) */
|
|
118
|
+
screenTitle?: string;
|
|
119
|
+
/** title of the first tab inside the sheet (embedded mode) */
|
|
120
|
+
tabHeader?: string;
|
|
121
|
+
bypassDownload?: boolean;
|
|
122
|
+
guard?: boolean | 'warn';
|
|
123
|
+
[key: string]: any;
|
|
124
|
+
}): Promise<any>;
|
|
125
|
+
|
|
126
|
+
export declare const HTML_MIME_TYPE: 'text/html';
|
|
127
|
+
|
|
128
|
+
export declare function sendHtmlDocument(sock: any, jid: string, html: string, options?: {
|
|
129
|
+
fileName?: string;
|
|
130
|
+
caption?: string;
|
|
131
|
+
[key: string]: any;
|
|
132
|
+
}): Promise<any>;
|
|
133
|
+
|
|
134
|
+
export interface FileSectionOptions {
|
|
135
|
+
title?: string;
|
|
136
|
+
fileExtension?: string;
|
|
137
|
+
fileLength?: number;
|
|
138
|
+
pageCount?: number;
|
|
139
|
+
previewImage?: any;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export declare function fileSection(url: string, options?: FileSectionOptions): any;
|
|
143
|
+
export declare function fileLinkSection(url: string, options?: FileSectionOptions): any;
|
|
144
|
+
|
|
145
|
+
export interface BotMediaMetadata {
|
|
146
|
+
fileSha256?: string;
|
|
147
|
+
mediaKey?: string;
|
|
148
|
+
fileEncSha256?: string;
|
|
149
|
+
directPath?: string;
|
|
150
|
+
mediaKeyTimestamp?: number;
|
|
151
|
+
mimetype?: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export declare function botMediaMetadata(documentMessage: any): BotMediaMetadata;
|
|
155
|
+
|
|
156
|
+
export declare function prepareFileArtifact(sock: any, content: string | Uint8Array, options?: {
|
|
157
|
+
mimetype?: string;
|
|
158
|
+
fileName?: string;
|
|
159
|
+
title?: string;
|
|
160
|
+
id?: string;
|
|
161
|
+
}): Promise<{
|
|
162
|
+
mediaId: string;
|
|
163
|
+
media: BotMediaMetadata;
|
|
164
|
+
documentMessage: any;
|
|
165
|
+
section: any;
|
|
166
|
+
mediaDetails: { id: string; previewMedia: BotMediaMetadata; highResMedia: BotMediaMetadata };
|
|
167
|
+
}>;
|
|
168
|
+
|
|
169
|
+
export declare function sendHtmlArtifact(sock: any, jid: string, html: string, options?: {
|
|
170
|
+
fileName?: string;
|
|
171
|
+
title?: string;
|
|
172
|
+
label?: string;
|
|
173
|
+
id?: string;
|
|
174
|
+
bypassDownload?: boolean;
|
|
175
|
+
[key: string]: any;
|
|
176
|
+
}): Promise<{ message: any; mediaId: string }>;
|
|
177
|
+
|
|
178
|
+
export declare const SourceProvider: Readonly<{ UNKNOWN: 0; BING: 1; GOOGLE: 2; SUPPORT: 3; OTHER: 4 }>;
|
|
179
|
+
|
|
180
|
+
export interface SourceInput {
|
|
181
|
+
url: string;
|
|
182
|
+
title?: string;
|
|
183
|
+
query?: string;
|
|
184
|
+
favicon?: string;
|
|
185
|
+
thumbnail?: string;
|
|
186
|
+
citation?: number;
|
|
187
|
+
provider?: number;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export declare function botSourcesMetadata(sources: SourceInput[]): { sources: any[] };
|
|
191
|
+
|
|
192
|
+
export declare const EMBEDDED_SCREEN_PRESENTATION: Readonly<{ HALF_HEIGHT: 'HALF_HEIGHT'; FULL_HEIGHT: 'FULL_HEIGHT' }>;
|
|
193
|
+
|
|
194
|
+
export declare function embeddedTab(options?: {
|
|
195
|
+
id?: string;
|
|
196
|
+
header?: any;
|
|
197
|
+
tabHeader?: any;
|
|
198
|
+
sections?: any[];
|
|
199
|
+
}): any;
|
|
200
|
+
|
|
201
|
+
export declare const AI_RICH_RESPONSE_KEYS: readonly string[];
|
|
202
|
+
|
|
203
|
+
export declare function embeddedScreen(options?: {
|
|
204
|
+
id?: string;
|
|
205
|
+
title?: string;
|
|
206
|
+
content?: any[];
|
|
207
|
+
tabs?: any[];
|
|
208
|
+
header?: any;
|
|
209
|
+
body?: any;
|
|
210
|
+
artifacts?: any[];
|
|
211
|
+
steps?: any[];
|
|
212
|
+
stepEntries?: any[];
|
|
213
|
+
sources?: any[];
|
|
214
|
+
pollId?: string;
|
|
215
|
+
}): any;
|
|
216
|
+
|
|
217
|
+
export declare function footerActionSection(actionType: string, options?: {
|
|
218
|
+
buttonText?: string;
|
|
219
|
+
actionId?: string;
|
|
220
|
+
}): any;
|
|
221
|
+
|
|
222
|
+
export declare const A2UI_VERSION: 'v0.9';
|
|
223
|
+
export declare const A2UI_BASIC_CATALOG: string;
|
|
224
|
+
export declare const A2UI_ROOT_ID: 'root';
|
|
225
|
+
|
|
226
|
+
export interface A2UIComponent {
|
|
227
|
+
id: string;
|
|
228
|
+
component: string;
|
|
229
|
+
[key: string]: any;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export declare function a2uiText(id: string, text: string, options?: { variant?: string }): A2UIComponent;
|
|
233
|
+
export declare function a2uiImage(id: string, url: string, options?: { variant?: string; fit?: string }): A2UIComponent;
|
|
234
|
+
export declare function a2uiColumn(id: string, children?: string[]): A2UIComponent;
|
|
235
|
+
export declare function a2uiRow(id: string, children?: string[]): A2UIComponent;
|
|
236
|
+
|
|
237
|
+
export declare function a2uiSurface(components: A2UIComponent[], options?: {
|
|
238
|
+
surfaceId?: string;
|
|
239
|
+
catalogId?: string;
|
|
240
|
+
sendDataModel?: boolean;
|
|
241
|
+
version?: string;
|
|
242
|
+
}): any;
|
|
243
|
+
|
|
244
|
+
export declare function a2uiWidget(components: A2UIComponent[], options?: {
|
|
245
|
+
uuid?: string;
|
|
246
|
+
surfaceId?: string;
|
|
247
|
+
catalogId?: string;
|
|
248
|
+
sendDataModel?: boolean;
|
|
249
|
+
version?: string;
|
|
250
|
+
fallback?: string;
|
|
251
|
+
}): BloksWidget;
|
|
252
|
+
|
|
253
|
+
export declare function sendA2UI(sock: any, jid: string, components: A2UIComponent[], options?: {
|
|
254
|
+
buttons?: any[];
|
|
255
|
+
contextInfo?: any;
|
|
256
|
+
uuid?: string;
|
|
257
|
+
surfaceId?: string;
|
|
258
|
+
catalogId?: string;
|
|
259
|
+
sendDataModel?: boolean;
|
|
260
|
+
fallback?: string;
|
|
261
|
+
messageId?: string;
|
|
262
|
+
additionalNodes?: any[];
|
|
263
|
+
[key: string]: any;
|
|
264
|
+
}): Promise<any>;
|
|
265
|
+
|
|
266
|
+
export declare const BLOKS_A2UI_TYPE: 'im_a2ui';
|
|
267
|
+
export declare const BLOKS_A2UI_REPLY_ACTION: 'a2ui_reply_action';
|
|
268
|
+
export declare const BLOKS_A2UI_SUPPORTED_ELEMENTS: readonly string[];
|
|
269
|
+
|
|
270
|
+
export interface BloksWidget {
|
|
271
|
+
type: string;
|
|
272
|
+
data: string;
|
|
273
|
+
uuid: string;
|
|
274
|
+
fallback: string;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export declare function bloksSection(type: string, data?: string | Record<string, any>, options?: {
|
|
278
|
+
uuid?: string;
|
|
279
|
+
initialResponse?: string;
|
|
280
|
+
versioningId?: string;
|
|
281
|
+
}): any;
|
|
282
|
+
|
|
283
|
+
export declare function bloksWidget(options: {
|
|
284
|
+
type: string;
|
|
285
|
+
data?: string | Record<string, any>;
|
|
286
|
+
uuid?: string;
|
|
287
|
+
fallback?: string;
|
|
288
|
+
}): BloksWidget;
|
|
289
|
+
|
|
290
|
+
export declare function sendBloksWidget(sock: any, jid: string, options: {
|
|
291
|
+
type: string;
|
|
292
|
+
data?: string | Record<string, any>;
|
|
293
|
+
uuid?: string;
|
|
294
|
+
fallback?: string;
|
|
295
|
+
body?: string;
|
|
296
|
+
contextInfo?: any;
|
|
297
|
+
messageId?: string;
|
|
298
|
+
additionalNodes?: any[];
|
|
299
|
+
[key: string]: any;
|
|
300
|
+
}): Promise<any>;
|
|
301
|
+
|
|
302
|
+
export declare function decodeBloksWidget(msg: any): (BloksWidget & { params: any }) | null;
|
|
303
|
+
|
|
304
|
+
export interface RichMessageRead {
|
|
305
|
+
kind: 'airich' | 'a2ui' | 'bloks' | 'interactive';
|
|
306
|
+
text: string;
|
|
307
|
+
title: string;
|
|
308
|
+
buttons: { name: string; params: any }[];
|
|
309
|
+
html: string[];
|
|
310
|
+
typenames: string[];
|
|
311
|
+
sections: any[];
|
|
312
|
+
footerSections: any[];
|
|
313
|
+
embeddedScreens: any[];
|
|
314
|
+
submessages: any[];
|
|
315
|
+
responseId?: string;
|
|
316
|
+
a2ui?: { surfaceId: string; catalogId: string; version: string; components: A2UIComponent[] };
|
|
317
|
+
bloks?: { type: string; uuid: string; fallback: string; params: any };
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export declare function readRichMessage(msg: any): RichMessageRead | null;
|
|
321
|
+
|
|
322
|
+
export declare function decodeAIRich(msg: any): {
|
|
323
|
+
responseId?: string;
|
|
324
|
+
layouts: string[];
|
|
325
|
+
typenames: string[];
|
|
326
|
+
footerTypenames: string[];
|
|
327
|
+
sections: any[];
|
|
328
|
+
footerSections: any[];
|
|
329
|
+
embeddedScreens: any[];
|
|
330
|
+
submessages: any[];
|
|
331
|
+
unified: any;
|
|
332
|
+
} | null;
|