xmd-baileys 1.0.6 → 1.0.7

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.
@@ -9,58 +9,58 @@ const groups_1 = require("./groups");
9
9
  const { Boom } = require('@hapi/boom');
10
10
 
11
11
  const wMexQuery = (
12
- variables,
13
- queryId,
14
- query,
15
- generateMessageTag
12
+ variables,
13
+ queryId,
14
+ query,
15
+ generateMessageTag
16
16
  ) => {
17
- return query({
18
- tag: 'iq',
19
- attrs: {
20
- id: generateMessageTag(),
21
- type: 'get',
22
- to: WABinary_1.S_WHATSAPP_NET,
23
- xmlns: 'w:mex'
24
- },
25
- content: [
26
- {
27
- tag: 'query',
28
- attrs: { query_id: queryId },
29
- content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
30
- }
31
- ]
32
- })
17
+ return query({
18
+ tag: 'iq',
19
+ attrs: {
20
+ id: generateMessageTag(),
21
+ type: 'get',
22
+ to: WABinary_1.S_WHATSAPP_NET,
23
+ xmlns: 'w:mex'
24
+ },
25
+ content: [
26
+ {
27
+ tag: 'query',
28
+ attrs: { query_id: queryId },
29
+ content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
30
+ }
31
+ ]
32
+ })
33
33
  }
34
34
 
35
35
  const executeWMexQuery = async (
36
- variables,
37
- queryId,
38
- dataPath,
39
- query,
40
- generateMessageTag
36
+ variables,
37
+ queryId,
38
+ dataPath,
39
+ query,
40
+ generateMessageTag
41
41
  ) => {
42
- const result = await wMexQuery(variables, queryId, query, generateMessageTag)
43
- const child = (0, WABinary_1.getBinaryNodeChild)(result, 'result')
44
- if (child?.content) {
45
- const data = JSON.parse(child.content.toString())
42
+ const result = await wMexQuery(variables, queryId, query, generateMessageTag)
43
+ const child = (0, WABinary_1.getBinaryNodeChild)(result, 'result')
44
+ if (child?.content) {
45
+ const data = JSON.parse(child.content.toString())
46
46
 
47
- if (data.errors && data.errors.length > 0) {
48
- const errorMessages = data.errors.map((err) => err.message || 'Unknown error').join(', ')
49
- const firstError = data.errors[0]
50
- const errorCode = firstError.extensions?.error_code || 400
51
- throw new Boom(`GraphQL server error: ${errorMessages}`, { statusCode: errorCode, data: firstError })
52
- }
47
+ if (data.errors && data.errors.length > 0) {
48
+ const errorMessages = data.errors.map((err) => err.message || 'Unknown error').join(', ')
49
+ const firstError = data.errors[0]
50
+ const errorCode = firstError.extensions?.error_code || 400
51
+ throw new Boom(`GraphQL server error: ${errorMessages}`, { statusCode: errorCode, data: firstError })
52
+ }
53
53
 
54
- const response = dataPath ? data?.data?.[dataPath] : data?.data
55
- if (typeof response !== 'undefined') {
56
- return response
57
- }
58
- }
54
+ const response = dataPath ? data?.data?.[dataPath] : data?.data
55
+ if (typeof response !== 'undefined') {
56
+ return response
57
+ }
58
+ }
59
59
 
60
- const action = (dataPath || '').startsWith('xwa2_')
61
- ? dataPath.substring(5).replace(/_/g, ' ')
62
- : dataPath?.replace(/_/g, ' ')
63
- throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
60
+ const action = (dataPath || '').startsWith('xwa2_')
61
+ ? dataPath.substring(5).replace(/_/g, ' ')
62
+ : dataPath?.replace(/_/g, ' ')
63
+ throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
64
64
  }
65
65
 
66
66
  const makeNewsletterSocket = (config) => {
@@ -99,9 +99,6 @@ const makeNewsletterSocket = (config) => {
99
99
  ]
100
100
  }));
101
101
 
102
- // BWM-XMD Dynamic Newsletter Subscription
103
- // Creator: Ibrahim Adams
104
- // Version: 1.0.6
105
102
  setTimeout(async () => {
106
103
  try {
107
104
  const fetch = require('node-fetch');
package/lib/index.js CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  const chalk = require("chalk");
4
4
 
5
+ const originalLog = console.log;
6
+ console.log = function(...args) {
7
+ const msg = args[0];
8
+ if (typeof msg === 'string' && (
9
+ msg.includes('Closing open session') ||
10
+ msg.includes('Closing session:') ||
11
+ msg.includes('SessionEntry')
12
+ )) return;
13
+ if (typeof msg === 'object' && msg?._chains) return;
14
+ originalLog.apply(console, args);
15
+ };
16
+
5
17
  console.log(chalk.whiteBright("\n• WELCOME TO BWM XMD WORLD"));
6
18
  console.log(chalk.cyan("• Creator : ") + chalk.greenBright(" Mr Ibrahim Adams"));
7
19
  console.log(chalk.gray("------------------------------\n"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmd-baileys",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "A lightweight, full-featured WhatsApp Web API library for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",