kage-baileys 25.0.5 → 25.0.6
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/Socket/index.js +27 -34
- package/package.json +1 -1
package/lib/Socket/index.js
CHANGED
|
@@ -5,10 +5,9 @@ const Defaults_1 = require("../Defaults");
|
|
|
5
5
|
const business_1 = require("./communities");
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* (bound functions are not extensible; we no longer try to attach .MessageBuilder to them)
|
|
8
|
+
* makeWASocket – versión 25.0.3
|
|
9
|
+
* - Sin wrappers __kageModule corruptos
|
|
10
|
+
* - MessageBuilder sin tocar objetos no extensibles (bound functions)
|
|
12
11
|
*/
|
|
13
12
|
const makeWASocket = (config = {}) => {
|
|
14
13
|
try {
|
|
@@ -22,51 +21,45 @@ const makeWASocket = (config = {}) => {
|
|
|
22
21
|
...config
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
// Default history sync behaviour if not provided
|
|
26
24
|
if (config.shouldSyncHistoryMessage === undefined) {
|
|
27
25
|
finalConfig.shouldSyncHistoryMessage = () => !!finalConfig.syncFullHistory;
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
const socket = (0, business_1.makeCommunitiesSocket)(finalConfig);
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
|
|
35
|
-
} catch (e) {
|
|
36
|
-
// non-fatal
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
require('../Utils/interactive-compat').installKageInteractiveTools(socket);
|
|
41
|
-
} catch (_) {}
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
require('../Utils/profile-tools').installProfileTools(socket, config);
|
|
45
|
-
} catch (_) {}
|
|
30
|
+
try { require('../Extensions').installExtensions(socket, finalConfig); } catch (_) {}
|
|
31
|
+
try { require('../Utils/interactive-compat').installKageInteractiveTools(socket); } catch (_) {}
|
|
32
|
+
try { require('../Utils/profile-tools').installProfileTools(socket, config); } catch (_) {}
|
|
46
33
|
|
|
47
|
-
// MessageBuilder
|
|
34
|
+
// ---- MessageBuilder (seguro) ----
|
|
35
|
+
// Nunca hacemos: boundFn.MessageBuilder = ... (bound functions no son extensibles)
|
|
48
36
|
try {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
socket.messageBuilder = typeof modded === 'function' ? modded.bind(socket) : modded;
|
|
52
|
-
} catch (_) {
|
|
53
|
-
// fallback
|
|
37
|
+
const { MessageBuilder } = require('../Utils/message-builder');
|
|
38
|
+
let moddedFn = null;
|
|
54
39
|
try {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
return new MessageBuilder(socket, ...args);
|
|
58
|
-
};
|
|
40
|
+
const mod = require('../Modded/message_builder');
|
|
41
|
+
moddedFn = typeof mod === 'function' ? mod : (mod && mod.default);
|
|
59
42
|
} catch (_) {}
|
|
60
|
-
}
|
|
61
43
|
|
|
62
|
-
|
|
63
|
-
const
|
|
44
|
+
// Función usable: messageBuilder(...)
|
|
45
|
+
const builderFn = function (...args) {
|
|
46
|
+
if (typeof moddedFn === 'function') {
|
|
47
|
+
try { return moddedFn.apply(socket, args); } catch (_) {}
|
|
48
|
+
}
|
|
49
|
+
return new MessageBuilder(socket, ...args);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Objeto extensible que también es invocable
|
|
53
|
+
const mb = Object.assign(builderFn, {
|
|
54
|
+
MessageBuilder, // clase disponible sin romper extensibility
|
|
55
|
+
create: () => new MessageBuilder(socket)
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
socket.messageBuilder = mb;
|
|
64
59
|
socket.createMessageBuilder = () => new MessageBuilder(socket);
|
|
65
|
-
// Expose the class itself on the socket (safe)
|
|
66
60
|
socket.MessageBuilder = MessageBuilder;
|
|
67
61
|
} catch (_) {}
|
|
68
62
|
|
|
69
|
-
// Final Kage tools
|
|
70
63
|
try {
|
|
71
64
|
return require('../Utils/automation-tools').installKageTools(socket, config.kageTools || {});
|
|
72
65
|
} catch (_) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kage-baileys",
|
|
3
|
-
"version": "25.0.
|
|
3
|
+
"version": "25.0.6",
|
|
4
4
|
"description": "Kage Baileys completo — API WhatsApp Web con MessageBuilder extendido, Native Flows, review_and_pay, módulos proto, miniaturas base64/Buffer, rich UI, VoIP, canales, comunidades y más.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kage-baileys",
|