kage-baileys 25.3.10 → 25.3.12
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/Example/plugins/scarr.mjs +1 -1
- package/Example/plugins/unico6.mjs +1 -1
- package/extras/Extensions/package.json +3 -0
- package/extras/Extensions/rich-carousel.js +1 -1
- package/extras/Extensions/rich-classic.js +1 -1
- package/extras/index.js +10 -10
- package/helpers/package.json +3 -0
- package/lib/Framework/Bot.js +36 -1
- package/lib/Utils/kage-airich.js +23 -0
- package/lib/index.d.ts +483 -28
- package/lib/index.js +7 -69
- package/lib/index.mjs +1 -0
- package/package.json +8 -4
- package/lib/Builders/index.d.ts +0 -454
- package/lib/Builders/mbuilder/bot-signature.d.ts +0 -22
- package/lib/Builders/mbuilder/extras.d.ts +0 -348
- package/lib/Builders/mbuilder/html-app.d.ts +0 -19
- package/lib/Builders/mbuilder/index.d.ts +0 -221
- package/lib/Builders/mbuilder/metaai.d.ts +0 -438
- package/lib/Defaults/index.d.ts +0 -145
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -10
- package/lib/Signal/Group/group-session-builder.d.ts +0 -8
- package/lib/Signal/Group/group_cipher.d.ts +0 -11
- package/lib/Signal/Group/index.d.ts +0 -12
- package/lib/Signal/Group/keyhelper.d.ts +0 -7
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
- package/lib/Signal/Group/sender-key-message.d.ts +0 -19
- package/lib/Signal/Group/sender-key-name.d.ts +0 -12
- package/lib/Signal/Group/sender-key-record.d.ts +0 -13
- package/lib/Signal/Group/sender-key-state.d.ts +0 -17
- package/lib/Signal/Group/sender-message-key.d.ts +0 -12
- package/lib/Signal/libsignal.d.ts +0 -55
- package/lib/Signal/lid-mapping.d.ts +0 -21
- package/lib/Socket/Client/index.d.ts +0 -3
- package/lib/Socket/Client/types.d.ts +0 -6
- package/lib/Socket/Client/websocket.d.ts +0 -13
- package/lib/Socket/business.d.ts +0 -395
- package/lib/Socket/chats.d.ts +0 -137
- package/lib/Socket/communities.d.ts +0 -562
- package/lib/Socket/groups.d.ts +0 -286
- package/lib/Socket/index.d.ts +0 -530
- package/lib/Socket/messages-recv.d.ts +0 -334
- package/lib/Socket/messages-send.d.ts +0 -330
- package/lib/Socket/mex.d.ts +0 -2
- package/lib/Socket/newsletter.d.ts +0 -283
- package/lib/Socket/socket.d.ts +0 -61
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/make-in-memory-store.d.ts +0 -63
- package/lib/Store/make-ordered-dictionary.d.ts +0 -13
- package/lib/Store/object-repository.d.ts +0 -11
- package/lib/Types/Auth.d.ts +0 -2
- package/lib/Types/Bussines.d.ts +0 -2
- package/lib/Types/Call.d.ts +0 -2
- package/lib/Types/Chat.d.ts +0 -2
- package/lib/Types/Contact.d.ts +0 -2
- package/lib/Types/Events.d.ts +0 -2
- package/lib/Types/GroupMetadata.d.ts +0 -2
- package/lib/Types/Label.d.ts +0 -3
- package/lib/Types/LabelAssociation.d.ts +0 -3
- package/lib/Types/Message.d.ts +0 -12
- package/lib/Types/Mex.d.ts +0 -3
- package/lib/Types/Product.d.ts +0 -2
- package/lib/Types/RichType.d.ts +0 -3
- package/lib/Types/Signal.d.ts +0 -2
- package/lib/Types/Socket.d.ts +0 -2
- package/lib/Types/State.d.ts +0 -6
- package/lib/Types/USync.d.ts +0 -2
- package/lib/Types/index.d.ts +0 -14
- package/lib/Utils/auth-utils.d.ts +0 -58
- package/lib/Utils/browser-utils.d.ts +0 -9
- package/lib/Utils/business.d.ts +0 -50
- package/lib/Utils/chat-utils.d.ts +0 -409
- package/lib/Utils/companion-reg-client-utils.d.ts +0 -5
- package/lib/Utils/crypto.d.ts +0 -40
- package/lib/Utils/decode-wa-message.d.ts +0 -84
- package/lib/Utils/event-buffer.d.ts +0 -13
- package/lib/Utils/generics.d.ts +0 -71
- package/lib/Utils/history.d.ts +0 -76
- package/lib/Utils/identity-change-handler.d.ts +0 -14
- package/lib/Utils/index.d.ts +0 -25
- package/lib/Utils/link-preview.d.ts +0 -13
- package/lib/Utils/logger.d.ts +0 -3
- package/lib/Utils/lt-hash.d.ts +0 -7
- package/lib/Utils/make-mutex.d.ts +0 -7
- package/lib/Utils/message-retry-manager.d.ts +0 -80
- package/lib/Utils/messages-media.d.ts +0 -137
- package/lib/Utils/messages.d.ts +0 -47
- package/lib/Utils/noise-handler.d.ts +0 -21
- package/lib/Utils/offline-node-processor.d.ts +0 -10
- package/lib/Utils/pre-key-manager.d.ts +0 -26
- package/lib/Utils/process-message.d.ts +0 -84
- package/lib/Utils/reporting-utils.d.ts +0 -13
- package/lib/Utils/rich-message-utils.d.ts +0 -49
- package/lib/Utils/signal.d.ts +0 -83
- package/lib/Utils/stanza-ack.d.ts +0 -17
- package/lib/Utils/sync-action-utils.d.ts +0 -3
- package/lib/Utils/tc-token-utils.d.ts +0 -30
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -11
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -11
- package/lib/Utils/use-sqlite-auth-state.d.ts +0 -11
- package/lib/Utils/validate-connection.d.ts +0 -44
- package/lib/WABinary/constants.d.ts +0 -62
- package/lib/WABinary/decode.d.ts +0 -10
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/generic-utils.d.ts +0 -77
- package/lib/WABinary/index.d.ts +0 -6
- package/lib/WABinary/jid-utils.d.ts +0 -29
- package/lib/WABinary/types.d.ts +0 -2
- /package/extras/{optional-media.js → optional-media.mjs} +0 -0
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* generateWAMessageFromContent(jid, content, { userJid }) lalu
|
|
17
17
|
* relayMessage(jid, msg.message, { messageId: msg.key.id }).
|
|
18
18
|
*/
|
|
19
|
-
import { generateWAMessageFromContent } from '
|
|
19
|
+
import { generateWAMessageFromContent } from '../../lib/Utils/messages.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Normalisasi 1 definisi tombol ringkas menjadi NativeFlowButton
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* generateWAMessageFromContent(jid, content, { userJid }) lalu
|
|
17
17
|
* relayMessage(jid, msg.message, { messageId: msg.key.id }).
|
|
18
18
|
*/
|
|
19
|
-
import { generateWAMessageFromContent } from '
|
|
19
|
+
import { generateWAMessageFromContent } from '../../lib/Utils/messages.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Normalisasi userJid.
|
package/extras/index.js
CHANGED
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
* Kage Baileys — índice de extras
|
|
3
3
|
* MessageBuilder extendido, rich UI, módulos proto adicionales
|
|
4
4
|
*/
|
|
5
|
+
const fs = require('fs')
|
|
5
6
|
const path = require('path')
|
|
6
7
|
|
|
7
8
|
function load(rel) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
9
|
+
const target = path.resolve(__dirname, rel)
|
|
10
|
+
if (!fs.existsSync(target)) return null
|
|
11
|
+
// Do not hide dependency or module-format errors behind a null return.
|
|
12
|
+
return require(target)
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
module.exports = {
|
|
16
|
-
loadMessageBuilder: () => load('
|
|
17
|
-
loadMessageExtras: () => load('
|
|
18
|
-
loadMetaAI: () => load('
|
|
19
|
-
loadBotSignature: () => load('
|
|
16
|
+
loadMessageBuilder: () => load('../lib/Builders/mbuilder/index.js'),
|
|
17
|
+
loadMessageExtras: () => load('../lib/Builders/mbuilder/extras.js'),
|
|
18
|
+
loadMetaAI: () => load('../lib/Builders/mbuilder/metaai.js'),
|
|
19
|
+
loadBotSignature: () => load('../lib/Builders/mbuilder/bot-signature.js'),
|
|
20
20
|
loadRichMenu: () => load('Extensions/rich-menu.js'),
|
|
21
21
|
loadRichCarousel: () => load('Extensions/rich-carousel.js'),
|
|
22
22
|
loadRichClassic: () => load('Extensions/rich-classic.js'),
|
|
23
23
|
loadRichWebUI: () => load('Extensions/rich-webui.js'),
|
|
24
24
|
loadMediaProcessor: () => load('Extensions/media-processor.js'),
|
|
25
|
-
loadOptionalMedia: () => load('optional-media.
|
|
25
|
+
loadOptionalMedia: () => load('optional-media.mjs'),
|
|
26
26
|
loadProtoModule: (name) => load(`WAProto/${name}/${name}.js`),
|
|
27
27
|
PROTO_MODULES: [
|
|
28
28
|
'Adv', 'BotMetadata', 'Cert', 'ChatLockSettings', 'CompanionReg',
|
package/lib/Framework/Bot.js
CHANGED
|
@@ -3,7 +3,42 @@ import makeWASocket from "../Socket/index.js";
|
|
|
3
3
|
import { DisconnectReason } from "../Types/index.js";
|
|
4
4
|
import { isJidGroup } from "../WABinary/index.js";
|
|
5
5
|
import defaultLogger from "../Utils/logger.js";
|
|
6
|
-
import
|
|
6
|
+
import generics from "../Utils/generics.js";
|
|
7
|
+
|
|
8
|
+
// Import CommonJS utilities through their default namespace. Node's synthetic
|
|
9
|
+
// named-export detection can miss exports appended by compiled/merged CJS files.
|
|
10
|
+
// Keep startup compatible with older installs that only expose the legacy
|
|
11
|
+
// version lookup helpers.
|
|
12
|
+
const fetchBestWaVersion = async (options = {}) => {
|
|
13
|
+
const isValid = (value) => Array.isArray(value?.version) && value.version.length === 3;
|
|
14
|
+
|
|
15
|
+
if (typeof generics.fetchBestWaVersion === "function") {
|
|
16
|
+
try {
|
|
17
|
+
const result = await generics.fetchBestWaVersion(options);
|
|
18
|
+
if (isValid(result)) return result;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
// Continue to the legacy lookup functions; version lookup must not stop
|
|
21
|
+
// the bot from starting when WhatsApp's public endpoint is unavailable.
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (const [name, source] of [
|
|
26
|
+
["fetchLatestWaWebVersion", "wa-web"],
|
|
27
|
+
["fetchLatestBaileysVersion", "baileys-upstream"]
|
|
28
|
+
]) {
|
|
29
|
+
const lookup = generics[name];
|
|
30
|
+
if (typeof lookup !== "function") continue;
|
|
31
|
+
try {
|
|
32
|
+
const result = await lookup(options);
|
|
33
|
+
if (isValid(result) && !result.error) return { ...result, source };
|
|
34
|
+
} catch (error) {
|
|
35
|
+
// Try the next known source. resolveSocketVersionConfig keeps the
|
|
36
|
+
// configured/default version when all lookups fail.
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
throw new Error("No compatible Baileys version lookup is available");
|
|
41
|
+
};
|
|
7
42
|
import { SQLiteStore } from "./Store/SQLiteStore.js";
|
|
8
43
|
import { Context } from "./Context.js";
|
|
9
44
|
import { SessionManager } from "./SessionManager.js";
|
package/lib/Utils/kage-airich.js
CHANGED
|
@@ -109,6 +109,24 @@ class KageAIRich {
|
|
|
109
109
|
return this;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/** Add a pre-built GenAI section without converting it into media. */
|
|
113
|
+
addSection(section) {
|
|
114
|
+
if (!section || typeof section !== 'object' || Array.isArray(section)) {
|
|
115
|
+
throw new TypeError('addSection(section) requiere un objeto');
|
|
116
|
+
}
|
|
117
|
+
if (!section.view_model || typeof section.view_model !== 'object' || Array.isArray(section.view_model)) {
|
|
118
|
+
throw new TypeError('addSection(section) requiere section.view_model');
|
|
119
|
+
}
|
|
120
|
+
let normalized;
|
|
121
|
+
try {
|
|
122
|
+
normalized = structuredClone(section);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
throw new TypeError(`addSection(section) debe ser clonable: ${error?.message || error}`);
|
|
125
|
+
}
|
|
126
|
+
this._sections.push(normalized);
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
|
|
112
130
|
setContextInfo(contextInfo) {
|
|
113
131
|
if (contextInfo && typeof contextInfo === 'object' && !Array.isArray(contextInfo)) {
|
|
114
132
|
this._contextInfo = { ...this._contextInfo, ...contextInfo };
|
|
@@ -372,6 +390,11 @@ class KageAIRich {
|
|
|
372
390
|
userJidLid,
|
|
373
391
|
timestamp,
|
|
374
392
|
ephemeralExpiration,
|
|
393
|
+
// Compatibility flags accepted by the higher-level helper. KageAIRich
|
|
394
|
+
// deliberately performs one relay and never sends a follow-up edit.
|
|
395
|
+
bypassDownload: _bypassDownload,
|
|
396
|
+
nativeEdit: _nativeEdit,
|
|
397
|
+
skipImageFallback: _skipImageFallback,
|
|
375
398
|
...relayOptions
|
|
376
399
|
} = options;
|
|
377
400
|
|