@pontalabs/baileys 1.1.2 → 1.1.3
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/Utils/generics.js +2 -20
- package/package.json +1 -1
package/lib/Utils/generics.js
CHANGED
|
@@ -10,23 +10,6 @@ const { sha256: sha256 } = require("./crypto");
|
|
|
10
10
|
const { proto: proto } = require("../../WAProto");
|
|
11
11
|
const { version: version } = require("../Defaults/vialeys-version.json");
|
|
12
12
|
const { DisconnectReason: DisconnectReason } = require("../Types");
|
|
13
|
-
const hwaifu = async () => {
|
|
14
|
-
try {
|
|
15
|
-
const response = await fetch(
|
|
16
|
-
"https://raw.githubusercontent.com/ramadanny/json/refs/heads/main/hwaifu.json",
|
|
17
|
-
{ method: "GET" }
|
|
18
|
-
);
|
|
19
|
-
const data = await response.json();
|
|
20
|
-
if (Array.isArray(data)) {
|
|
21
|
-
const random = data[Math.floor(Math.random() * data.length)];
|
|
22
|
-
return random;
|
|
23
|
-
} else {
|
|
24
|
-
throw new Boom("Data is not in array format.");
|
|
25
|
-
}
|
|
26
|
-
} catch (error) {
|
|
27
|
-
throw new Boom(error.message);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
13
|
const BufferJSON = {
|
|
31
14
|
replacer: (k, value) => {
|
|
32
15
|
if (Buffer.isBuffer(value) || value instanceof Uint8Array || value?.type === "Buffer") {
|
|
@@ -158,7 +141,7 @@ const generateMessageID = (userId) => {
|
|
|
158
141
|
}
|
|
159
142
|
const random = randomBytes(20);
|
|
160
143
|
random.copy(data, 28);
|
|
161
|
-
const sha = asciiDecode([
|
|
144
|
+
const sha = asciiDecode([89, 85, 69, 80, 79, 78, 84, 65]);
|
|
162
145
|
const hash = createHash("sha256").update(data).digest();
|
|
163
146
|
return sha + hash.toString("hex").toUpperCase().substring(0, 16);
|
|
164
147
|
};
|
|
@@ -368,7 +351,6 @@ const asciiDecode = (...codes) => {
|
|
|
368
351
|
return codeArray.map((c) => String.fromCharCode(c)).join("");
|
|
369
352
|
};
|
|
370
353
|
module.exports = {
|
|
371
|
-
hwaifu: hwaifu,
|
|
372
354
|
BufferJSON: BufferJSON,
|
|
373
355
|
getKeyAuthor: getKeyAuthor,
|
|
374
356
|
writeRandomPadMax16: writeRandomPadMax16,
|
|
@@ -402,4 +384,4 @@ module.exports = {
|
|
|
402
384
|
fromUnicodeEscape: fromUnicodeEscape,
|
|
403
385
|
asciiEncode: asciiEncode,
|
|
404
386
|
asciiDecode: asciiDecode,
|
|
405
|
-
};
|
|
387
|
+
};
|