dibosockets 1.0.2 → 1.0.4
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/WAProto/WAProto.proto +5619 -5619
- package/lib/Api/Internet/growagarden.js +28 -28
- package/lib/Api/creator.json +13 -13
- package/lib/Api/downloader/tiktokdownload.js +132 -132
- package/lib/Api/index.js +38 -38
- package/lib/Api/nsfw/loli.js +79 -79
- package/lib/Api/stalker/githubstalk.js +46 -46
- package/lib/Api/stalker/stalkroblox.js +94 -94
- package/lib/Api/stalker/tiktokstalk.js +68 -68
- package/lib/Api/tools/ssweb.js +38 -38
- package/lib/Defaults/baileys-version.json +3 -3
- package/lib/Defaults/index.js +122 -122
- package/lib/Defaults/phonenumber_mcc.json +223 -223
- package/lib/Socket/RHandler.js +448 -448
- package/lib/Socket/business.js +266 -266
- package/lib/Socket/chats.js +1137 -1137
- package/lib/Socket/communities.js +441 -441
- package/lib/Socket/index.js +43 -43
- package/lib/Socket/messages-recv.js +1065 -1065
- package/lib/Socket/messages-send.js +881 -881
- package/lib/Socket/newsletter.js +286 -286
- package/lib/Socket/socket.js +666 -666
- package/lib/Store/make-in-memory-store.js +439 -439
- package/lib/Types/Newsletter.js +18 -18
- package/lib/Utils/async-iterable.js +41 -41
- package/lib/Utils/baileys-event-stream.js +63 -63
- package/lib/Utils/browser-utils.js +34 -34
- package/lib/Utils/event-buffer.js +518 -518
- package/lib/Utils/generics.js +431 -431
- package/lib/Utils/index.js +36 -36
- package/lib/Utils/message-retry-manager.js +127 -127
- package/lib/Utils/messages-media.js +926 -926
- package/lib/Utils/messages.js +1105 -1105
- package/lib/Utils/process-message.js +404 -404
- package/lib/Utils/resolveJid.js +52 -52
- package/lib/Utils/use-multi-file-auth-state.js +122 -122
- package/lib/Utils/validate-connection.js +228 -228
- package/lib/WABinary/jid-utils.js +85 -85
- package/lib/index.js +87 -74
- package/package.json +2 -2
package/lib/Types/Newsletter.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.XWAPaths = exports.MexOperations = void 0;
|
|
4
|
-
var MexOperations;
|
|
5
|
-
(function (MexOperations) {
|
|
6
|
-
MexOperations["PROMOTE"] = "NotificationNewsletterAdminPromote";
|
|
7
|
-
MexOperations["DEMOTE"] = "NotificationNewsletterAdminDemote";
|
|
8
|
-
MexOperations["UPDATE"] = "NotificationNewsletterUpdate";
|
|
9
|
-
})(MexOperations || (exports.MexOperations = MexOperations = {}));
|
|
10
|
-
var XWAPaths;
|
|
11
|
-
(function (XWAPaths) {
|
|
12
|
-
XWAPaths["PROMOTE"] = "xwa2_notify_newsletter_admin_promote";
|
|
13
|
-
XWAPaths["DEMOTE"] = "xwa2_notify_newsletter_admin_demote";
|
|
14
|
-
XWAPaths["ADMIN_COUNT"] = "xwa2_newsletter_admin";
|
|
15
|
-
XWAPaths["CREATE"] = "xwa2_newsletter_create";
|
|
16
|
-
XWAPaths["NEWSLETTER"] = "xwa2_newsletter";
|
|
17
|
-
XWAPaths["METADATA_UPDATE"] = "xwa2_notify_newsletter_on_metadata_update";
|
|
18
|
-
})(XWAPaths || (exports.XWAPaths = XWAPaths = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XWAPaths = exports.MexOperations = void 0;
|
|
4
|
+
var MexOperations;
|
|
5
|
+
(function (MexOperations) {
|
|
6
|
+
MexOperations["PROMOTE"] = "NotificationNewsletterAdminPromote";
|
|
7
|
+
MexOperations["DEMOTE"] = "NotificationNewsletterAdminDemote";
|
|
8
|
+
MexOperations["UPDATE"] = "NotificationNewsletterUpdate";
|
|
9
|
+
})(MexOperations || (exports.MexOperations = MexOperations = {}));
|
|
10
|
+
var XWAPaths;
|
|
11
|
+
(function (XWAPaths) {
|
|
12
|
+
XWAPaths["PROMOTE"] = "xwa2_notify_newsletter_admin_promote";
|
|
13
|
+
XWAPaths["DEMOTE"] = "xwa2_notify_newsletter_admin_demote";
|
|
14
|
+
XWAPaths["ADMIN_COUNT"] = "xwa2_newsletter_admin";
|
|
15
|
+
XWAPaths["CREATE"] = "xwa2_newsletter_create";
|
|
16
|
+
XWAPaths["NEWSLETTER"] = "xwa2_newsletter";
|
|
17
|
+
XWAPaths["METADATA_UPDATE"] = "xwa2_notify_newsletter_on_metadata_update";
|
|
18
|
+
})(XWAPaths || (exports.XWAPaths = XWAPaths = {}));
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toAsyncIterable = void 0;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Helper by @rexxhayanasi to convert various media inputs into an Async Iterable
|
|
7
|
-
* Compatible with Baileys buffer/stream handling
|
|
8
|
-
*/
|
|
9
|
-
function toAsyncIterable(input) {
|
|
10
|
-
if (!input) {
|
|
11
|
-
throw new Error("Invalid media stream (undefined/null)");
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (input[Symbol.asyncIterator]) {
|
|
15
|
-
return input;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (Buffer.isBuffer(input)) {
|
|
20
|
-
return (async function* () {
|
|
21
|
-
yield input;
|
|
22
|
-
})();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (typeof input === "string") {
|
|
26
|
-
const fs = require("fs");
|
|
27
|
-
return fs.createReadStream(input);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (typeof input.on === "function") {
|
|
31
|
-
return (async function* () {
|
|
32
|
-
for await (const chunk of input) {
|
|
33
|
-
yield chunk;
|
|
34
|
-
}
|
|
35
|
-
})();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
throw new Error("Unsupported media stream type");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
exports.toAsyncIterable = toAsyncIterable;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toAsyncIterable = void 0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Helper by @rexxhayanasi to convert various media inputs into an Async Iterable
|
|
7
|
+
* Compatible with Baileys buffer/stream handling
|
|
8
|
+
*/
|
|
9
|
+
function toAsyncIterable(input) {
|
|
10
|
+
if (!input) {
|
|
11
|
+
throw new Error("Invalid media stream (undefined/null)");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (input[Symbol.asyncIterator]) {
|
|
15
|
+
return input;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if (Buffer.isBuffer(input)) {
|
|
20
|
+
return (async function* () {
|
|
21
|
+
yield input;
|
|
22
|
+
})();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (typeof input === "string") {
|
|
26
|
+
const fs = require("fs");
|
|
27
|
+
return fs.createReadStream(input);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (typeof input.on === "function") {
|
|
31
|
+
return (async function* () {
|
|
32
|
+
for await (const chunk of input) {
|
|
33
|
+
yield chunk;
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
throw new Error("Unsupported media stream type");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.toAsyncIterable = toAsyncIterable;
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.readAndEmitEventStream = exports.captureEventStream = void 0;
|
|
7
|
-
const events_1 = __importDefault(require("events"));
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
|
-
const promises_1 = require("fs/promises");
|
|
10
|
-
const readline_1 = require("readline");
|
|
11
|
-
const generics_1 = require("./generics");
|
|
12
|
-
const make_mutex_1 = require("./make-mutex");
|
|
13
|
-
/**
|
|
14
|
-
* Captures events from a RexxHayanasi event emitter & stores them in a file
|
|
15
|
-
* @param ev The event emitter to read events from
|
|
16
|
-
* @param filename File to save to
|
|
17
|
-
*/
|
|
18
|
-
const captureEventStream = (ev, filename) => {
|
|
19
|
-
const oldEmit = ev.emit;
|
|
20
|
-
// write mutex so data is appended in order
|
|
21
|
-
const writeMutex = (0, make_mutex_1.makeMutex)();
|
|
22
|
-
// monkey patch eventemitter to capture all events
|
|
23
|
-
ev.emit = function (...args) {
|
|
24
|
-
const content = JSON.stringify({ timestamp: Date.now(), event: args[0], data: args[1] }) + '\n';
|
|
25
|
-
const result = oldEmit.apply(ev, args);
|
|
26
|
-
writeMutex.mutex(async () => {
|
|
27
|
-
await (0, promises_1.writeFile)(filename, content, { flag: 'a' });
|
|
28
|
-
});
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.captureEventStream = captureEventStream;
|
|
33
|
-
/**
|
|
34
|
-
* Read event file and emit events from there
|
|
35
|
-
* @param filename filename containing event data
|
|
36
|
-
* @param delayIntervalMs delay between each event emit
|
|
37
|
-
*/
|
|
38
|
-
const readAndEmitEventStream = (filename, delayIntervalMs = 0) => {
|
|
39
|
-
const ev = new events_1.default();
|
|
40
|
-
const fireEvents = async () => {
|
|
41
|
-
// from: https://stackoverflow.com/questions/6156501/read-a-file-one-line-at-a-time-in-node-js
|
|
42
|
-
const fileStream = (0, fs_1.createReadStream)(filename);
|
|
43
|
-
const rl = (0, readline_1.createInterface)({
|
|
44
|
-
input: fileStream,
|
|
45
|
-
crlfDelay: Infinity
|
|
46
|
-
});
|
|
47
|
-
// Note: we use the crlfDelay option to recognize all instances of CR LF
|
|
48
|
-
// ('\r\n') in input.txt as a single line break.
|
|
49
|
-
for await (const line of rl) {
|
|
50
|
-
if (line) {
|
|
51
|
-
const { event, data } = JSON.parse(line);
|
|
52
|
-
ev.emit(event, data);
|
|
53
|
-
delayIntervalMs && await (0, generics_1.delay)(delayIntervalMs);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
fileStream.close();
|
|
57
|
-
};
|
|
58
|
-
return {
|
|
59
|
-
ev,
|
|
60
|
-
task: fireEvents()
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
exports.readAndEmitEventStream = readAndEmitEventStream;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readAndEmitEventStream = exports.captureEventStream = void 0;
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const promises_1 = require("fs/promises");
|
|
10
|
+
const readline_1 = require("readline");
|
|
11
|
+
const generics_1 = require("./generics");
|
|
12
|
+
const make_mutex_1 = require("./make-mutex");
|
|
13
|
+
/**
|
|
14
|
+
* Captures events from a RexxHayanasi event emitter & stores them in a file
|
|
15
|
+
* @param ev The event emitter to read events from
|
|
16
|
+
* @param filename File to save to
|
|
17
|
+
*/
|
|
18
|
+
const captureEventStream = (ev, filename) => {
|
|
19
|
+
const oldEmit = ev.emit;
|
|
20
|
+
// write mutex so data is appended in order
|
|
21
|
+
const writeMutex = (0, make_mutex_1.makeMutex)();
|
|
22
|
+
// monkey patch eventemitter to capture all events
|
|
23
|
+
ev.emit = function (...args) {
|
|
24
|
+
const content = JSON.stringify({ timestamp: Date.now(), event: args[0], data: args[1] }) + '\n';
|
|
25
|
+
const result = oldEmit.apply(ev, args);
|
|
26
|
+
writeMutex.mutex(async () => {
|
|
27
|
+
await (0, promises_1.writeFile)(filename, content, { flag: 'a' });
|
|
28
|
+
});
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.captureEventStream = captureEventStream;
|
|
33
|
+
/**
|
|
34
|
+
* Read event file and emit events from there
|
|
35
|
+
* @param filename filename containing event data
|
|
36
|
+
* @param delayIntervalMs delay between each event emit
|
|
37
|
+
*/
|
|
38
|
+
const readAndEmitEventStream = (filename, delayIntervalMs = 0) => {
|
|
39
|
+
const ev = new events_1.default();
|
|
40
|
+
const fireEvents = async () => {
|
|
41
|
+
// from: https://stackoverflow.com/questions/6156501/read-a-file-one-line-at-a-time-in-node-js
|
|
42
|
+
const fileStream = (0, fs_1.createReadStream)(filename);
|
|
43
|
+
const rl = (0, readline_1.createInterface)({
|
|
44
|
+
input: fileStream,
|
|
45
|
+
crlfDelay: Infinity
|
|
46
|
+
});
|
|
47
|
+
// Note: we use the crlfDelay option to recognize all instances of CR LF
|
|
48
|
+
// ('\r\n') in input.txt as a single line break.
|
|
49
|
+
for await (const line of rl) {
|
|
50
|
+
if (line) {
|
|
51
|
+
const { event, data } = JSON.parse(line);
|
|
52
|
+
ev.emit(event, data);
|
|
53
|
+
delayIntervalMs && await (0, generics_1.delay)(delayIntervalMs);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
fileStream.close();
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
ev,
|
|
60
|
+
task: fireEvents()
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
exports.readAndEmitEventStream = readAndEmitEventStream;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPlatformId = exports.Browsers = void 0;
|
|
4
|
-
|
|
5
|
-
const os = require("os");
|
|
6
|
-
const { proto } = require("../../WAProto/index.js");
|
|
7
|
-
|
|
8
|
-
const PLATFORM_MAP = {
|
|
9
|
-
'aix': 'AIX',
|
|
10
|
-
'darwin': 'Mac OS',
|
|
11
|
-
'win32': 'Windows',
|
|
12
|
-
'android': 'Android',
|
|
13
|
-
'freebsd': 'FreeBSD',
|
|
14
|
-
'openbsd': 'OpenBSD',
|
|
15
|
-
'sunos': 'Solaris',
|
|
16
|
-
'linux': undefined, // Default ke Ubuntu untuk Linux
|
|
17
|
-
'haiku': undefined,
|
|
18
|
-
'cygwin': undefined,
|
|
19
|
-
'netbsd': undefined
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// Fixed: Browsers sekarang fungsi yang return array [platform, browser, version]
|
|
23
|
-
// Ini kompatibel dengan pemanggilan Browsers('Chrome') di Defaults/index.js
|
|
24
|
-
exports.Browsers = (browser) => {
|
|
25
|
-
const osName = PLATFORM_MAP[os.platform()] || 'Ubuntu'; // Default Ubuntu kalau undefined
|
|
26
|
-
const osRelease = os.release(); // Ambil versi OS real-time
|
|
27
|
-
return [osName, browser, osRelease];
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const getPlatformId = (browser) => {
|
|
31
|
-
const platformType = proto.DeviceProps.PlatformType[browser.toUpperCase()];
|
|
32
|
-
return platformType ? platformType.toString() : '1'; // Default Chrome
|
|
33
|
-
};
|
|
34
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPlatformId = exports.Browsers = void 0;
|
|
4
|
+
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const { proto } = require("../../WAProto/index.js");
|
|
7
|
+
|
|
8
|
+
const PLATFORM_MAP = {
|
|
9
|
+
'aix': 'AIX',
|
|
10
|
+
'darwin': 'Mac OS',
|
|
11
|
+
'win32': 'Windows',
|
|
12
|
+
'android': 'Android',
|
|
13
|
+
'freebsd': 'FreeBSD',
|
|
14
|
+
'openbsd': 'OpenBSD',
|
|
15
|
+
'sunos': 'Solaris',
|
|
16
|
+
'linux': undefined, // Default ke Ubuntu untuk Linux
|
|
17
|
+
'haiku': undefined,
|
|
18
|
+
'cygwin': undefined,
|
|
19
|
+
'netbsd': undefined
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Fixed: Browsers sekarang fungsi yang return array [platform, browser, version]
|
|
23
|
+
// Ini kompatibel dengan pemanggilan Browsers('Chrome') di Defaults/index.js
|
|
24
|
+
exports.Browsers = (browser) => {
|
|
25
|
+
const osName = PLATFORM_MAP[os.platform()] || 'Ubuntu'; // Default Ubuntu kalau undefined
|
|
26
|
+
const osRelease = os.release(); // Ambil versi OS real-time
|
|
27
|
+
return [osName, browser, osRelease];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const getPlatformId = (browser) => {
|
|
31
|
+
const platformType = proto.DeviceProps.PlatformType[browser.toUpperCase()];
|
|
32
|
+
return platformType ? platformType.toString() : '1'; // Default Chrome
|
|
33
|
+
};
|
|
34
|
+
|
|
35
35
|
exports.getPlatformId = getPlatformId;
|