node-ainzfb-new 1.7.10-14 → 1.7.10-16tfwiu

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,29 +4,32 @@
4
4
  var utils = require("../utils");
5
5
  var log = require("npmlog");
6
6
 
7
- module.exports = function(defaultFuncs, api, ctx) {
8
- return function getUserInfoV2(id, callback) {
9
- var resolveFunc = function() {};
10
- var rejectFunc = function() {};
11
- var returnPromise = new Promise(function(resolve, reject) {
12
- resolveFunc = resolve;
13
- rejectFunc = reject;
14
- });
15
7
 
16
- if (!callback) {
17
- callback = function(err, userInfo) {
18
- if (err) return rejectFunc(err);
19
- resolveFunc(userInfo);
20
- };
21
- }
8
+ module.exports = function (defaultFuncs, api, ctx) {
9
+ return function getUserInfoV2(id, callback) {
10
+ var resolveFunc = function () { };
11
+ var rejectFunc = function () { };
12
+ var returnPromise = new Promise(function (resolve, reject) {
13
+ resolveFunc = resolve;
14
+ rejectFunc = reject;
15
+ });
16
+
17
+ if (!callback) {
18
+ callback = function (err, userInfo) {
19
+ if (err) return rejectFunc(err);
20
+ resolveFunc(userInfo);
21
+ };
22
+ }
22
23
  try {
23
- var { getInfo } = require("../Extra/ExtraAddons");
24
- getInfo(id).then(data => {
24
+ var { getInfo } = require('../Extra/ExtraAddons');
25
+ getInfo(id)
26
+ .then(data => {
25
27
  return callback(null, data);
26
28
  });
27
- } catch (e) {
29
+ }
30
+ catch (e) {
28
31
  return callback(null, e);
29
32
  }
30
33
  return returnPromise;
31
- };
32
- };
34
+ };
35
+ };
package/src/pinMessage.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- const { generateOfflineThreadingID, getCurrentTimestamp } = require("../utils");
3
+ const { generateOfflineThreadingID, getCurrentTimestamp } = require('../utils');
4
4
 
5
5
  function isCallable(func) {
6
6
  try {
@@ -11,22 +11,22 @@ function isCallable(func) {
11
11
  }
12
12
  }
13
13
 
14
- module.exports = function(defaultFuncs, api, ctx) {
14
+ module.exports = function (defaultFuncs, api, ctx) {
15
15
  return function pinMessage(pinMode, messageID, threadID, callback) {
16
16
  if (!ctx.mqttClient) {
17
- throw new Error("Not connected to MQTT");
17
+ throw new Error('Not connected to MQTT');
18
18
  }
19
19
 
20
20
  ctx.wsReqNumber += 1;
21
21
  ctx.wsTaskNumber += 1;
22
22
 
23
- const taskLabel = pinMode ? "430" : "431";
24
- const queueNamePrefix = pinMode ? "pin_msg_v2_" : "unpin_msg_v2_";
23
+ const taskLabel = pinMode ? '430' : '431';
24
+ const queueNamePrefix = pinMode ? 'pin_msg_v2_' : 'unpin_msg_v2_';
25
25
 
26
26
  const taskPayload = {
27
27
  thread_key: threadID,
28
28
  message_id: messageID,
29
- timestamp_ms: getCurrentTimestamp()
29
+ timestamp_ms: getCurrentTimestamp(),
30
30
  };
31
31
 
32
32
  const task = {
@@ -34,28 +34,25 @@ module.exports = function(defaultFuncs, api, ctx) {
34
34
  label: taskLabel,
35
35
  payload: JSON.stringify(taskPayload),
36
36
  queue_name: `${queueNamePrefix}${threadID}`,
37
- task_id: ctx.wsTaskNumber
37
+ task_id: ctx.wsTaskNumber,
38
38
  };
39
39
 
40
40
  const content = {
41
- app_id: "2220391788200892",
41
+ app_id: '2220391788200892',
42
42
  payload: JSON.stringify({
43
43
  data_trace_id: null,
44
44
  epoch_id: parseInt(generateOfflineThreadingID()),
45
45
  tasks: [task],
46
- version_id: "25095469420099952"
46
+ version_id: '25095469420099952',
47
47
  }),
48
48
  request_id: ctx.wsReqNumber,
49
- type: 3
49
+ type: 3,
50
50
  };
51
51
 
52
52
  if (isCallable(callback)) {
53
- // to be implemented
53
+ // to be implemented
54
54
  }
55
55
 
56
- ctx.mqttClient.publish("/ls_req", JSON.stringify(content), {
57
- qos: 1,
58
- retain: false
59
- });
56
+ ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
60
57
  };
61
58
  };
@@ -3,54 +3,44 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, api, ctx) {
7
- return async function shareContact(
8
- text,
9
- senderID,
10
- threadID,
11
- mentionID,
12
- userID,
13
- leaverID,
14
- callback
15
- ) {
16
- var resolveFunc = function() {};
17
- var rejectFunc = function() {};
18
- var returnPromise = new Promise(function(resolve, reject) {
19
- resolveFunc = resolve;
20
- rejectFunc = reject;
21
- });
22
- if (!callback) {
23
- callback = function(err, data) {
24
- if (err) return rejectFunc(err);
25
- resolveFunc(data);
26
- };
27
- }
28
- let count_req = 0;
29
- var form = JSON.stringify({
30
- app_id: "2220391788200892",
31
- payload: JSON.stringify({
32
- tasks: [
33
- {
34
- label: "359",
35
- payload: JSON.stringify({
36
- contact_id: senderID,
37
- sync_group: 1,
38
- text: text || "",
39
- thread_id: threadID
40
- }),
41
- queue_name: "messenger_contact_sharing",
42
- task_id: (Math.random() * 1001) << 0,
43
- failure_count: null
44
- }
45
- ],
46
- epoch_id: utils.generateOfflineThreadingID(),
47
- version_id: "7214102258676893"
48
- }),
49
- request_id: ++count_req,
50
- type: 3
51
- });
52
- ctx.mqttClient.publish("/ls_req", form);
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return async function shareContact(text, senderID, threadID, mentionID, userID, leaverID, callback) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+ if (!callback) {
15
+ callback = function (err, data) {
16
+ if (err) return rejectFunc(err);
17
+ resolveFunc(data);
18
+ };
19
+ }
20
+ let count_req = 0;
21
+ var form = JSON.stringify({
22
+ "app_id": "2220391788200892",
23
+ "payload": JSON.stringify({
24
+ tasks: [{
25
+ label: '359',
26
+ payload: JSON.stringify({
27
+ "contact_id": senderID,
28
+ "sync_group": 1,
29
+ "text": text || "",
30
+ "thread_id": threadID
31
+ }),
32
+ queue_name: 'messenger_contact_sharing',
33
+ task_id: Math.random() * 1001 << 0,
34
+ failure_count: null,
35
+ }],
36
+ epoch_id: utils.generateOfflineThreadingID(),
37
+ version_id: '7214102258676893',
38
+ }),
39
+ "request_id": ++count_req,
40
+ "type": 3
41
+ });
42
+ ctx.mqttClient.publish('/ls_req', form);
53
43
 
54
- return returnPromise;
55
- };
44
+ return returnPromise;
45
+ };
56
46
  };
package/src/shareLink.js CHANGED
@@ -3,55 +3,52 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, api, ctx) {
7
- return async function shareLink(text, url, threadID, callback) {
8
- var resolveFunc = function() {};
9
- var rejectFunc = function() {};
10
- var returnPromise = new Promise(function(resolve, reject) {
11
- resolveFunc = resolve;
12
- rejectFunc = reject;
13
- });
14
- if (!callback) {
15
- callback = function(err, data) {
16
- if (err) return rejectFunc(err);
17
- resolveFunc(data);
18
- };
19
- }
20
- ctx.mqttClient.publish(
21
- "/ls_req",
22
- JSON.stringify({
23
- app_id: "2220391788200892",
24
- payload: JSON.stringify({
25
- tasks: [
26
- {
27
- label: 46,
28
- payload: JSON.stringify({
29
- otid: utils.generateOfflineThreadingID(),
30
- source: 524289,
31
- sync_group: 1,
32
- send_type: 6,
33
- mark_thread_read: 0,
34
- url: url || "",
35
- text: text || "",
36
- thread_id: threadID,
37
- initiating_source: 0
38
- }),
39
- queue_name: threadID,
40
- task_id: (Math.random() * 1001) << 0,
41
- failure_count: null
42
- }
43
- ],
44
- epoch_id: utils.generateOfflineThreadingID(),
45
- version_id: "7191105584331330"
46
- }),
47
- request_id: ++ctx.req_ID,
48
- type: 3
49
- }),
50
- {
51
- qos: 1,
52
- retain: false
53
- }
54
- );
55
- return returnPromise;
56
- };
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return async function shareLink(text, url, threadID, callback) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+ if (!callback) {
15
+ callback = function (err, data) {
16
+ if (err) return rejectFunc(err);
17
+ resolveFunc(data);
18
+ };
19
+ }
20
+ ctx.mqttClient.publish('/ls_req',
21
+ JSON.stringify({
22
+ "app_id": "2220391788200892",
23
+ "payload": JSON.stringify({
24
+ tasks: [{
25
+ label: 46,
26
+ payload: JSON.stringify({
27
+ "otid": utils.generateOfflineThreadingID(),
28
+ "source": 524289,
29
+ "sync_group": 1,
30
+ "send_type": 6,
31
+ "mark_thread_read": 0,
32
+ "url": url || "",
33
+ "text": text || "",
34
+ "thread_id": threadID,
35
+ "initiating_source": 0
36
+ }),
37
+ queue_name: threadID,
38
+ task_id: Math.random() * 1001 << 0,
39
+ failure_count: null,
40
+ }],
41
+ epoch_id: utils.generateOfflineThreadingID(),
42
+ version_id: '7191105584331330',
43
+ }),
44
+ "request_id": ++ctx.req_ID,
45
+ "type": 3
46
+ }),
47
+ {
48
+ qos: 1,
49
+ retain: false,
50
+ }
51
+ )
52
+ return returnPromise;
53
+ };
57
54
  };