@vanzxy/baileys 1.4.9 → 1.5.1
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/README.md +10 -0
- package/lib/Utils/MessageBuilder.js +131 -37
- package/package.json +3 -5
- package/cjs/WAProto/index.js +0 -106053
- package/cjs/lib/Defaults/index.js +0 -168
- package/cjs/lib/Signal/Group/ciphertext-message.js +0 -16
- package/cjs/lib/Signal/Group/group-session-builder.js +0 -67
- package/cjs/lib/Signal/Group/group_cipher.js +0 -86
- package/cjs/lib/Signal/Group/index.js +0 -58
- package/cjs/lib/Signal/Group/keyhelper.js +0 -56
- package/cjs/lib/Signal/Group/sender-chain-key.js +0 -30
- package/cjs/lib/Signal/Group/sender-key-distribution-message.js +0 -67
- package/cjs/lib/Signal/Group/sender-key-message.js +0 -70
- package/cjs/lib/Signal/Group/sender-key-name.js +0 -52
- package/cjs/lib/Signal/Group/sender-key-record.js +0 -45
- package/cjs/lib/Signal/Group/sender-key-state.js +0 -88
- package/cjs/lib/Signal/Group/sender-message-key.js +0 -30
- package/cjs/lib/Signal/libsignal.js +0 -467
- package/cjs/lib/Signal/lid-mapping.js +0 -281
- package/cjs/lib/Socket/Client/index.js +0 -19
- package/cjs/lib/Socket/Client/types.js +0 -15
- package/cjs/lib/Socket/Client/websocket.js +0 -61
- package/cjs/lib/Socket/business.js +0 -384
- package/cjs/lib/Socket/chats.js +0 -1257
- package/cjs/lib/Socket/communities.js +0 -442
- package/cjs/lib/Socket/dugong.js +0 -753
- package/cjs/lib/Socket/groups.js +0 -360
- package/cjs/lib/Socket/index.js +0 -30
- package/cjs/lib/Socket/messages-recv.js +0 -1790
- package/cjs/lib/Socket/messages-send.js +0 -1390
- package/cjs/lib/Socket/mex.js +0 -46
- package/cjs/lib/Socket/newsletter.js +0 -340
- package/cjs/lib/Socket/socket.js +0 -1007
- package/cjs/lib/Store/index.js +0 -20
- package/cjs/lib/Store/make-in-memory-store.js +0 -438
- package/cjs/lib/Store/make-ordered-dictionary.js +0 -82
- package/cjs/lib/Store/object-repository.js +0 -28
- package/cjs/lib/Types/Auth.js +0 -3
- package/cjs/lib/Types/Bussines.js +0 -3
- package/cjs/lib/Types/Call.js +0 -3
- package/cjs/lib/Types/Chat.js +0 -11
- package/cjs/lib/Types/Contact.js +0 -3
- package/cjs/lib/Types/Events.js +0 -4
- package/cjs/lib/Types/GroupMetadata.js +0 -3
- package/cjs/lib/Types/Label.js +0 -26
- package/cjs/lib/Types/LabelAssociation.js +0 -8
- package/cjs/lib/Types/Message.js +0 -19
- package/cjs/lib/Types/Mex.js +0 -40
- package/cjs/lib/Types/Product.js +0 -3
- package/cjs/lib/Types/RichType.js +0 -24
- package/cjs/lib/Types/Signal.js +0 -4
- package/cjs/lib/Types/Socket.js +0 -4
- package/cjs/lib/Types/State.js +0 -54
- package/cjs/lib/Types/USync.js +0 -4
- package/cjs/lib/Types/index.js +0 -42
- package/cjs/lib/Utils/MessageBuilder.js +0 -2684
- package/cjs/lib/Utils/auth-utils.js +0 -312
- package/cjs/lib/Utils/browser-utils.js +0 -32
- package/cjs/lib/Utils/business.js +0 -245
- package/cjs/lib/Utils/chat-utils.js +0 -940
- package/cjs/lib/Utils/companion-reg-client-utils.js +0 -45
- package/cjs/lib/Utils/crypto.js +0 -202
- package/cjs/lib/Utils/decode-wa-message.js +0 -324
- package/cjs/lib/Utils/event-buffer.js +0 -643
- package/cjs/lib/Utils/generics.js +0 -429
- package/cjs/lib/Utils/history.js +0 -151
- package/cjs/lib/Utils/identity-change-handler.js +0 -56
- package/cjs/lib/Utils/index.js +0 -42
- package/cjs/lib/Utils/link-preview.js +0 -122
- package/cjs/lib/Utils/logger.js +0 -8
- package/cjs/lib/Utils/lt-hash.js +0 -64
- package/cjs/lib/Utils/make-mutex.js +0 -38
- package/cjs/lib/Utils/message-retry-manager.js +0 -267
- package/cjs/lib/Utils/messages-media.js +0 -933
- package/cjs/lib/Utils/messages.js +0 -2180
- package/cjs/lib/Utils/noise-handler.js +0 -205
- package/cjs/lib/Utils/offline-node-processor.js +0 -43
- package/cjs/lib/Utils/pre-key-manager.js +0 -113
- package/cjs/lib/Utils/process-message.js +0 -772
- package/cjs/lib/Utils/reporting-utils.js +0 -263
- package/cjs/lib/Utils/rich-message-utils.js +0 -439
- package/cjs/lib/Utils/signal.js +0 -214
- package/cjs/lib/Utils/stanza-ack.js +0 -41
- package/cjs/lib/Utils/sync-action-utils.js +0 -54
- package/cjs/lib/Utils/tc-token-utils.js +0 -174
- package/cjs/lib/Utils/use-multi-file-auth-state.js +0 -125
- package/cjs/lib/Utils/use-single-file-auth-state.js +0 -121
- package/cjs/lib/Utils/use-sqlite-auth-state.js +0 -182
- package/cjs/lib/Utils/validate-connection.js +0 -210
- package/cjs/lib/WABinary/constants.js +0 -1470
- package/cjs/lib/WABinary/decode.js +0 -301
- package/cjs/lib/WABinary/encode.js +0 -257
- package/cjs/lib/WABinary/generic-utils.js +0 -275
- package/cjs/lib/WABinary/index.js +0 -22
- package/cjs/lib/WABinary/jid-utils.js +0 -114
- package/cjs/lib/WABinary/types.js +0 -37
- package/cjs/lib/WAM/BinaryInfo.js +0 -14
- package/cjs/lib/WAM/constants.js +0 -22856
- package/cjs/lib/WAM/encode.js +0 -154
- package/cjs/lib/WAM/index.js +0 -20
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -56
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -67
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -31
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -42
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -29
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -55
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -33
- package/cjs/lib/WAUSync/Protocols/index.js +0 -24
- package/cjs/lib/WAUSync/USyncQuery.js +0 -126
- package/cjs/lib/WAUSync/USyncUser.js +0 -35
- package/cjs/lib/WAUSync/index.js +0 -20
- package/cjs/lib/index.js +0 -34
- package/cjs/package.json +0 -1
package/README.md
CHANGED
|
@@ -173,3 +173,13 @@ Use responsibly and follow WhatsApp Terms of Service.
|
|
|
173
173
|
---
|
|
174
174
|
|
|
175
175
|
Made with 🍃 by Vanzxy
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## V4 Patch Notes
|
|
179
|
+
|
|
180
|
+
- Kept the existing Vanzxy custom MessageBuilder classes and AIRich implementation intact.
|
|
181
|
+
- Added `whatsapp-rust-bridge@0.5.5` as a runtime dependency. The library already dynamically imports this module for LT Hash/app-state and crypto helpers; declaring it prevents accidental missing-module fallbacks in normal installations.
|
|
182
|
+
- Existing guarded fallbacks for platforms where the native bridge cannot load remain in place.
|
|
183
|
+
- ESM-only package metadata is preserved; no CommonJS build is included.
|
|
184
|
+
|
|
185
|
+
Reference audit: the supplied Ourin, Elaina, ItsLiaaa, and Noxleyss packages were compared before this patch. Their broader core changes were not copied wholesale because the current Vanzxy tree already contains additional LID, retry, media, interactive, and AIRich fixes that would risk regressions if replaced.
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
const MESSAGE_BUILDER_VERSION = '4.9';
|
|
48
48
|
|
|
49
49
|
import { generateWAMessageFromContent, prepareWAMessageMedia } from './messages.js';
|
|
50
|
-
import { botMetadataSignature, botMetadataCertificate } from './rich-message-utils.js';
|
|
51
50
|
import crypto from 'crypto';
|
|
52
51
|
import { PassThrough, Readable } from 'stream';
|
|
53
52
|
// Vanz@Fix 15-08-26 --- sharp/fluent-ffmpeg were statically imported in the blurose source.
|
|
@@ -1181,6 +1180,14 @@ class Button extends BaseBuilder {
|
|
|
1181
1180
|
}
|
|
1182
1181
|
|
|
1183
1182
|
/** Build and send this interactive message. @param {string} jid Destination chat/group jid. */
|
|
1183
|
+
async sendEdit(jid, messageId, { ...options } = {}) {
|
|
1184
|
+
if (!messageId) throw new Error('messageId is required');
|
|
1185
|
+
const msg = await this.build(jid, options);
|
|
1186
|
+
msg.key = { ...(msg.key || {}), remoteJid: jid, id: messageId, fromMe: true };
|
|
1187
|
+
await this.#client.relayMessage(jid, msg.message, { messageId, ...options });
|
|
1188
|
+
return msg;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1184
1191
|
async send(jid, { ...options } = {}) {
|
|
1185
1192
|
const msg = await this.build(jid, options);
|
|
1186
1193
|
|
|
@@ -1587,6 +1594,9 @@ class AIRich extends BaseBuilder {
|
|
|
1587
1594
|
// mediaKey still doesn't render, so it's a trust-chain gate, not a domain/encoding issue).
|
|
1588
1595
|
// Track every addInlineImage() call here so send() can fall back to a normal imageMessage.
|
|
1589
1596
|
this._inlineImages = [];
|
|
1597
|
+
// Plain WhatsApp-media fallbacks for AIRich primitives that some clients refuse to render inline.
|
|
1598
|
+
// Entries are { type: 'image'|'video'|'audio'|'document', url, caption, mimetype, fileName }.
|
|
1599
|
+
this._mediaFallbacks = [];
|
|
1590
1600
|
|
|
1591
1601
|
// Vanz@Add (v4.9.1) --- { id, insertAt } support for every add*()/set*() call, without
|
|
1592
1602
|
// touching each method's own body/signature. Every add*() call ends up pushing 0-N items
|
|
@@ -1905,7 +1915,7 @@ class AIRich extends BaseBuilder {
|
|
|
1905
1915
|
* One image, no prompt, nothing to download — use this when you don't need the rich card,
|
|
1906
1916
|
* just the picture to show up immediately.
|
|
1907
1917
|
*/
|
|
1908
|
-
addImage(imageUrl, { resolveUrl = false, instant =
|
|
1918
|
+
addImage(imageUrl, { resolveUrl = false, instant = true } = {}) {
|
|
1909
1919
|
if (!(typeof imageUrl === 'string' || Buffer.isBuffer(imageUrl) || (Array.isArray(imageUrl) && imageUrl.every((v) => typeof v === 'string' || Buffer.isBuffer(v))))) {
|
|
1910
1920
|
throw new TypeError('imageUrl must be string | buffer | array of string/buffer');
|
|
1911
1921
|
}
|
|
@@ -1963,6 +1973,8 @@ class AIRich extends BaseBuilder {
|
|
|
1963
1973
|
}
|
|
1964
1974
|
|
|
1965
1975
|
if (instant) {
|
|
1976
|
+
this._mediaFallbacks.push({ type: 'image', url: imagePreviewUrl, caption: undefined });
|
|
1977
|
+
// Keep legacy inline queue in sync for callers that inspect it.
|
|
1966
1978
|
this._inlineImages.push({ url: imagePreviewUrl, caption: undefined });
|
|
1967
1979
|
}
|
|
1968
1980
|
});
|
|
@@ -2040,7 +2052,7 @@ class AIRich extends BaseBuilder {
|
|
|
2040
2052
|
// for before rendering. Mirrors addImage()'s { resolveUrl } — when true, the url is uploaded to
|
|
2041
2053
|
// WA's own media server first via Toolkit.toUrl() so it renders instantly like WA-native media.
|
|
2042
2054
|
/** Add a video block. */
|
|
2043
|
-
addVideo(videoUrl, { autoFill = false, resolveUrl = false } = {}) {
|
|
2055
|
+
addVideo(videoUrl, { autoFill = false, resolveUrl = false, instant = true } = {}) {
|
|
2044
2056
|
const isObjectVideo = (v) => v && typeof v === 'object' && v.url;
|
|
2045
2057
|
|
|
2046
2058
|
const isValidPrimitive =
|
|
@@ -2117,6 +2129,15 @@ class AIRich extends BaseBuilder {
|
|
|
2117
2129
|
__typename: 'GenAIImaginePrimitive',
|
|
2118
2130
|
})
|
|
2119
2131
|
);
|
|
2132
|
+
|
|
2133
|
+
if (instant) {
|
|
2134
|
+
this._mediaFallbacks.push({
|
|
2135
|
+
type: 'video',
|
|
2136
|
+
url,
|
|
2137
|
+
caption: isObject ? (item.caption ?? '') : '',
|
|
2138
|
+
mimetype: isObject ? (item.mime_type ?? 'video/mp4') : 'video/mp4',
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2120
2141
|
});
|
|
2121
2142
|
|
|
2122
2143
|
return this;
|
|
@@ -2280,6 +2301,7 @@ class AIRich extends BaseBuilder {
|
|
|
2280
2301
|
__typename: 'GenAIImagePrimitive',
|
|
2281
2302
|
})
|
|
2282
2303
|
);
|
|
2304
|
+
this._mediaFallbacks.push({ type: 'image', url: full || preview, caption: undefined });
|
|
2283
2305
|
|
|
2284
2306
|
return this;
|
|
2285
2307
|
}
|
|
@@ -2619,12 +2641,6 @@ class AIRich extends BaseBuilder {
|
|
|
2619
2641
|
]
|
|
2620
2642
|
: [...(await waitAllPromises(this._sections))];
|
|
2621
2643
|
|
|
2622
|
-
// Vanz@Merge 15-08-26 --- Neither blurose nor arslan sign the bot metadata with
|
|
2623
|
-
// verificationMetadata (proofs/certificateChain). Backported from this project's own
|
|
2624
|
-
// rich-message-utils.js botMetadataSignature/botMetadataCertificate helpers, plus a
|
|
2625
|
-
// botResponseId tying the signed metadata to unifiedResponse.response_id.
|
|
2626
|
-
const responseId = crypto.randomUUID();
|
|
2627
|
-
|
|
2628
2644
|
return {
|
|
2629
2645
|
messageContextInfo: {
|
|
2630
2646
|
deviceListMetadata: {},
|
|
@@ -2632,17 +2648,6 @@ class AIRich extends BaseBuilder {
|
|
|
2632
2648
|
botMetadata: {
|
|
2633
2649
|
messageDisclaimerText: this._title,
|
|
2634
2650
|
richResponseSourcesMetadata: { sources: this._richResponseSources },
|
|
2635
|
-
botResponseId: responseId,
|
|
2636
|
-
verificationMetadata: {
|
|
2637
|
-
proofs: [
|
|
2638
|
-
{
|
|
2639
|
-
certificateChain: [botMetadataCertificate(), botMetadataCertificate(892)],
|
|
2640
|
-
version: 1,
|
|
2641
|
-
useCase: 1,
|
|
2642
|
-
signature: botMetadataSignature(),
|
|
2643
|
-
},
|
|
2644
|
-
],
|
|
2645
|
-
},
|
|
2646
2651
|
...notif,
|
|
2647
2652
|
},
|
|
2648
2653
|
},
|
|
@@ -2653,7 +2658,7 @@ class AIRich extends BaseBuilder {
|
|
|
2653
2658
|
messageType: 1,
|
|
2654
2659
|
submessages: includesSubmessages ? await waitAllPromises(this._submessages) : [],
|
|
2655
2660
|
unifiedResponse: {
|
|
2656
|
-
data: includesUnifiedResponse ? Buffer.from(JSON.stringify({ response_id:
|
|
2661
|
+
data: includesUnifiedResponse ? Buffer.from(JSON.stringify({ response_id: crypto.randomUUID(), sections })).toString('base64') : '',
|
|
2657
2662
|
},
|
|
2658
2663
|
contextInfo: {
|
|
2659
2664
|
...forward,
|
|
@@ -2674,22 +2679,107 @@ class AIRich extends BaseBuilder {
|
|
|
2674
2679
|
// the two calls expect different option shapes, so the fallback now only forwards `quoted`
|
|
2675
2680
|
// (the one option that clearly applies to both) instead of blindly spreading everything.
|
|
2676
2681
|
/** Build and send this AI-rich message. @param {string} jid Destination chat/group jid. @param {boolean} [skipImageFallback] Skip auto-resending inline images as a plain imageMessage. */
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2682
|
+
\tasync send(jid, {
|
|
2683
|
+
\t\tforwarded,
|
|
2684
|
+
\t\tnotification,
|
|
2685
|
+
\t\tincludesUnifiedResponse,
|
|
2686
|
+
\t\tincludesSubmessages,
|
|
2687
|
+
\t\tskipImageFallback = false,
|
|
2688
|
+
\t\tnativeFallback = true,
|
|
2689
|
+
\t\tquoted,
|
|
2690
|
+
\t\t...options
|
|
2691
|
+
\t} = {}) {
|
|
2692
|
+
\t\tconst msg = await this.build({ forwarded, notification, includesUnifiedResponse, includesSubmessages, quoted, ...options });
|
|
2693
|
+
\t\tconst sendOptions = quoted ? { quoted } : {};
|
|
2694
|
+
|
|
2695
|
+
\t\t// Native fallback is enabled by default because stock/third-party WhatsApp clients
|
|
2696
|
+
\t\t// do not reliably render botForwardedMessage.richResponseMessage. The rich payload
|
|
2697
|
+
\t\t// remains available through build()/relayMessage(), while send() uses ordinary WA
|
|
2698
|
+
\t\t// message types that are known to render immediately.
|
|
2699
|
+
\t\tif (nativeFallback) {
|
|
2700
|
+
\t\t\tconst sent = [];
|
|
2701
|
+
|
|
2702
|
+
\t\t\t// 1) Send real WhatsApp media first. addImage()/addVideo()/addInlineImage()
|
|
2703
|
+
\t\t\t// already populate this queue with resolved URLs/buffers.
|
|
2704
|
+
\t\t\tif (!skipImageFallback && this._mediaFallbacks.length) {
|
|
2705
|
+
\t\t\t\tconst fallbacks = await waitAllPromises(this._mediaFallbacks);
|
|
2706
|
+
\t\t\t\tfor (const item of fallbacks) {
|
|
2707
|
+
\t\t\t\t\ttry {
|
|
2708
|
+
\t\t\t\t\t\tconst media = Buffer.isBuffer(item.url) ? item.url : { url: item.url };
|
|
2709
|
+
\t\t\t\t\t\tconst content = { [item.type]: media };
|
|
2710
|
+
\t\t\t\t\t\tif (item.caption) content.caption = item.caption;
|
|
2711
|
+
\t\t\t\t\t\tif (item.mimetype) content.mimetype = item.mimetype;
|
|
2712
|
+
\t\t\t\t\t\tif (item.fileName) content.fileName = item.fileName;
|
|
2713
|
+
\t\t\t\t\t\tsent.push(await this.#client.sendMessage(jid, content, sendOptions));
|
|
2714
|
+
\t\t\t\t\t} catch (err) {
|
|
2715
|
+
\t\t\t\t\t\tthis.#client.logger?.warn?.(
|
|
2716
|
+
\t\t\t\t\t\t\t{ err, url: item.url, type: item.type },
|
|
2717
|
+
\t\t\t\t\t\t\t'AIRich native media fallback failed'
|
|
2718
|
+
\t\t\t\t\t\t);
|
|
2719
|
+
\t\t\t\t\t}
|
|
2720
|
+
\t\t\t\t}
|
|
2721
|
+
\t\t\t}
|
|
2722
|
+
|
|
2723
|
+
\t\t\t// 2) Convert AIRich submessages into ordinary WhatsApp text. This preserves
|
|
2724
|
+
\t\t\t// every primitive's readable content even when the AI-only rich renderer is absent.
|
|
2725
|
+
\t\t\tconst lines = [];
|
|
2726
|
+
\t\t\tfor (const sub of await waitAllPromises(this._submessages)) {
|
|
2727
|
+
\t\t\t\tif (!sub) continue;
|
|
2728
|
+
|
|
2729
|
+
\t\t\t\tif (typeof sub.messageText === 'string' && sub.messageText.trim()) {
|
|
2730
|
+
\t\t\t\t\tconst t = sub.messageText.trim();
|
|
2731
|
+
|
|
2732
|
+
\t\t\t\t\t// Media primitives already have a native media message above; don't emit
|
|
2733
|
+
\t\t\t\t\t// their internal placeholder text as a duplicate.
|
|
2734
|
+
\t\t\t\t\tif (
|
|
2735
|
+
\t\t\t\t\t\tt === '[ Video tidak dapat dimuat ]' ||
|
|
2736
|
+
\t\t\t\t\t\tt === '[ Postingan tidak dapat dimuat ]' ||
|
|
2737
|
+
\t\t\t\t\t\tt === '[ Produk tidak dapat dimuat ]' ||
|
|
2738
|
+
\t\t\t\t\t\tt === '[ Sedang diproses... ]'
|
|
2739
|
+
\t\t\t\t\t) continue;
|
|
2740
|
+
|
|
2741
|
+
\t\t\t\t\tlines.push(t);
|
|
2742
|
+
\t\t\t\t\tcontinue;
|
|
2743
|
+
\t\t\t\t}
|
|
2744
|
+
|
|
2745
|
+
\t\t\t\tif (sub.codeMetadata) {
|
|
2746
|
+
\t\t\t\t\tconst blocks = sub.codeMetadata.codeBlocks ?? [];
|
|
2747
|
+
\t\t\t\t\tconst code = Array.isArray(blocks)
|
|
2748
|
+
\t\t\t\t\t\t? blocks.map((b) => typeof b === 'string' ? b : (b?.value ?? '')).join('')
|
|
2749
|
+
\t\t\t\t\t\t: String(blocks);
|
|
2750
|
+
\t\t\t\t\tlines.push('```' + (sub.codeMetadata.codeLanguage || '') + '\\n' + code + '\\n```');
|
|
2751
|
+
\t\t\t\t\tcontinue;
|
|
2752
|
+
\t\t\t\t}
|
|
2753
|
+
|
|
2754
|
+
\t\t\t\tif (sub.tableMetadata?.rows) {
|
|
2755
|
+
\t\t\t\t\tconst rows = sub.tableMetadata.rows;
|
|
2756
|
+
\t\t\t\t\tif (Array.isArray(rows)) {
|
|
2757
|
+
\t\t\t\t\t\tlines.push(rows.map((row) => {
|
|
2758
|
+
\t\t\t\t\t\t\tconst cells = Array.isArray(row) ? row : row?.cells;
|
|
2759
|
+
\t\t\t\t\t\t\treturn Array.isArray(cells)
|
|
2760
|
+
\t\t\t\t\t\t\t\t? cells.map((c) => typeof c === 'string' ? c : (c?.text ?? c?.value ?? '')).join(' | ')
|
|
2761
|
+
\t\t\t\t\t\t\t\t: String(row);
|
|
2762
|
+
\t\t\t\t\t\t}).join('\\n'));
|
|
2763
|
+
\t\t\t\t\t}
|
|
2764
|
+
\t\t\t\t\tcontinue;
|
|
2765
|
+
\t\t\t\t}
|
|
2766
|
+
|
|
2767
|
+
\t\t\t\tif (sub.latexMetadata?.text) {
|
|
2768
|
+
\t\t\t\t\tlines.push(sub.latexMetadata.text);
|
|
2769
|
+
\t\t\t\t}
|
|
2770
|
+
\t\t\t}
|
|
2771
|
+
|
|
2772
|
+
\t\t\tconst text = lines.join('\\n\\n').trim();
|
|
2773
|
+
\t\t\tif (text) {
|
|
2774
|
+
\t\t\t\tsent.push(await this.#client.sendMessage(jid, { text }, sendOptions));
|
|
2775
|
+
\t\t\t}
|
|
2776
|
+
|
|
2777
|
+
\t\t\tif (sent.length) return sent.length === 1 ? sent[0] : sent;
|
|
2778
|
+
\t\t}
|
|
2779
|
+
|
|
2780
|
+
\t\t// Explicit compatibility mode: preserve the original AIRich rich payload.
|
|
2781
|
+
\t\treturn await this.#client.relayMessage(jid, msg, { ...options });
|
|
2782
|
+
\t}
|
|
2693
2783
|
|
|
2694
2784
|
/** Tokenize `code` into `{ type, value }` spans for syntax highlighting. Covers JS/TS/Python/Java and more; unsupported languages fall back to a single plain-text token. */
|
|
2695
2785
|
static tokenizer(code, lang = 'javascript') {
|
|
@@ -3362,6 +3452,9 @@ class AIRich extends BaseBuilder {
|
|
|
3362
3452
|
if (!Array.isArray(arr) || !arr.every((row) => Array.isArray(row) && row.every((cell) => typeof cell === 'string'))) {
|
|
3363
3453
|
throw new TypeError('Table must be a nested array of strings');
|
|
3364
3454
|
}
|
|
3455
|
+
if (arr.length === 0 || arr[0].length === 0) {
|
|
3456
|
+
throw new TypeError('Table must contain a non-empty header row');
|
|
3457
|
+
}
|
|
3365
3458
|
|
|
3366
3459
|
const [header, ...rows] = arr;
|
|
3367
3460
|
|
|
@@ -3545,6 +3638,7 @@ export {
|
|
|
3545
3638
|
AIRich,
|
|
3546
3639
|
AIRich as AIVanzxy,
|
|
3547
3640
|
AIRich as LeafRich,
|
|
3641
|
+
AIRich as LeafReach,
|
|
3548
3642
|
AIRich as VanzxyAI,
|
|
3549
3643
|
AIRich as VanzxyRich,
|
|
3550
3644
|
Toolkit,
|
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanzxy/baileys",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Enhanced Baileys fork by Vanzxy — based on @itsliaaa/baileys + @whiskeysockets/baileys with fixes for audio group status and clean media without newsletter button.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./cjs/lib/index.js",
|
|
7
6
|
"module": "./lib/index.js",
|
|
8
7
|
"types": "./lib/index.d.ts",
|
|
9
8
|
"exports": {
|
|
10
9
|
".": {
|
|
11
10
|
"types": "./lib/index.d.ts",
|
|
12
11
|
"import": "./lib/index.js",
|
|
13
|
-
"require": "./cjs/lib/index.js",
|
|
14
12
|
"default": "./lib/index.js"
|
|
15
13
|
},
|
|
16
14
|
"./package.json": "./package.json"
|
|
@@ -28,7 +26,6 @@
|
|
|
28
26
|
},
|
|
29
27
|
"files": [
|
|
30
28
|
"lib/**/*",
|
|
31
|
-
"cjs/**/*",
|
|
32
29
|
"WAProto/**/*",
|
|
33
30
|
"engine-requirements.js",
|
|
34
31
|
"postinstall-banner.js",
|
|
@@ -62,7 +59,8 @@
|
|
|
62
59
|
"p-queue": "^9.1.0",
|
|
63
60
|
"pino": "^9.6.0",
|
|
64
61
|
"protobufjs": "^7.5.6",
|
|
65
|
-
"ws": "^8.19.0"
|
|
62
|
+
"ws": "^8.19.0",
|
|
63
|
+
"whatsapp-rust-bridge": "0.5.5"
|
|
66
64
|
},
|
|
67
65
|
"peerDependencies": {
|
|
68
66
|
"@napi-rs/image": "~1.12.0",
|