node-ainzfb-new 1.6.32-stable → 1.6.2431-test

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/index.js +1 -1
  2. package/package.json +3 -4
  3. package/src/addExternalModule.js +6 -13
  4. package/src/addUserToGroup.js +12 -35
  5. package/src/changeAdminStatus.js +16 -32
  6. package/src/changeArchivedStatus.js +9 -15
  7. package/src/changeAvt.js +34 -40
  8. package/src/changeBio.js +8 -12
  9. package/src/changeBlockedStatus.js +8 -14
  10. package/src/changeGroupImage.js +13 -27
  11. package/src/changeNickname.js +10 -19
  12. package/src/changeThreadColor.js +10 -15
  13. package/src/changeThreadEmoji.js +9 -17
  14. package/src/createNewGroup.js +10 -18
  15. package/src/createPoll.js +11 -16
  16. package/src/deleteMessage.js +10 -16
  17. package/src/deleteThread.js +10 -16
  18. package/src/forwardAttachment.js +9 -14
  19. package/src/getCurrentUserID.js +1 -1
  20. package/src/getEmojiUrl.js +2 -3
  21. package/src/getFriendsList.js +10 -18
  22. package/src/getMessage.js +48 -52
  23. package/src/getThreadHistory.js +59 -156
  24. package/src/getThreadHistoryDeprecated.js +15 -26
  25. package/src/getThreadInfoDeprecated.js +13 -25
  26. package/src/getThreadList.js +53 -112
  27. package/src/getThreadListDeprecated.js +12 -30
  28. package/src/getThreadPictures.js +13 -25
  29. package/src/getUserID.js +7 -8
  30. package/src/getUserInfo.js +9 -12
  31. package/src/handleFriendRequest.js +9 -10
  32. package/src/handleMessageRequest.js +10 -16
  33. package/src/httpGet.js +13 -18
  34. package/src/httpPost.js +13 -18
  35. package/src/httpPostFormData.js +9 -14
  36. package/src/listenMqtt.js +571 -1218
  37. package/src/logout.js +13 -18
  38. package/src/markAsDelivered.js +10 -16
  39. package/src/markAsRead.js +24 -36
  40. package/src/markAsReadAll.js +10 -14
  41. package/src/markAsSeen.js +11 -18
  42. package/src/muteThread.js +8 -12
  43. package/src/removeUserFromGroup.js +10 -33
  44. package/src/resolvePhotoUrl.js +6 -8
  45. package/src/searchForThread.js +8 -13
  46. package/src/sendMessage.js +78 -172
  47. package/src/sendTypingIndicator.js +14 -29
  48. package/src/setMessageReaction.js +8 -13
  49. package/src/setPostReaction.js +95 -97
  50. package/src/setTitle.js +12 -18
  51. package/src/threadColors.js +17 -17
  52. package/src/unfriend.js +9 -14
  53. package/src/unsendMessage.js +7 -7
  54. package/utils.js +19 -18
@@ -3,31 +3,27 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, api, ctx) {
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function changeThreadColor(color, threadID, callback) {
8
- var resolveFunc = function() {};
9
- var rejectFunc = function() {};
10
- var returnPromise = new Promise(function(resolve, reject) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
11
  resolveFunc = resolve;
12
12
  rejectFunc = reject;
13
13
  });
14
14
 
15
15
  if (!callback) {
16
- callback = function(err) {
16
+ callback = function (err) {
17
17
  if (err) return rejectFunc(err);
18
18
  resolveFunc(err);
19
19
  };
20
20
  }
21
21
 
22
22
  var validatedColor = color !== null ? color.toLowerCase() : color; // API only accepts lowercase letters in hex string
23
- var colorList = Object.keys(api.threadColors).map(function(name) {
23
+ var colorList = Object.keys(api.threadColors).map(function (name) {
24
24
  return api.threadColors[name];
25
25
  });
26
- if (!colorList.includes(validatedColor))
27
- throw {
28
- error:
29
- "The color you are trying to use is not a valid thread color. Use api.threadColors to find acceptable values."
30
- };
26
+ if (!colorList.includes(validatedColor)) throw { error: "The color you are trying to use is not a valid thread color. Use api.threadColors to find acceptable values." };
31
27
 
32
28
  var form = {
33
29
  dpr: 1,
@@ -51,13 +47,12 @@ module.exports = function(defaultFuncs, api, ctx) {
51
47
  defaultFuncs
52
48
  .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
53
49
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
54
- .then(function(resData) {
55
- if (resData[resData.length - 1].error_results > 0)
56
- throw resData[0].o0.errors;
50
+ .then(function (resData) {
51
+ if (resData[resData.length - 1].error_results > 0) throw resData[0].o0.errors;
57
52
 
58
53
  return callback();
59
54
  })
60
- .catch(function(err) {
55
+ .catch(function (err) {
61
56
  log.error("changeThreadColor", err);
62
57
  return callback(err);
63
58
  });
@@ -3,17 +3,17 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, api, ctx) {
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function changeThreadEmoji(emoji, threadID, callback) {
8
- var resolveFunc = function() {};
9
- var rejectFunc = function() {};
10
- var returnPromise = new Promise(function(resolve, reject) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
11
  resolveFunc = resolve;
12
12
  rejectFunc = reject;
13
13
  });
14
14
 
15
15
  if (!callback) {
16
- callback = function(err) {
16
+ callback = function (err) {
17
17
  if (err) return rejectFunc(err);
18
18
  resolveFunc();
19
19
  };
@@ -24,23 +24,15 @@ module.exports = function(defaultFuncs, api, ctx) {
24
24
  };
25
25
 
26
26
  defaultFuncs
27
- .post(
28
- "https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",
29
- ctx.jar,
30
- form
31
- )
27
+ .post("https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg", ctx.jar, form)
32
28
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
33
- .then(function(resData) {
34
- if (resData.error === 1357031)
35
- throw {
36
- error:
37
- "Trying to change emoji of a chat that doesn't exist. Have at least one message in the thread before trying to change the emoji."
38
- };
29
+ .then(function (resData) {
30
+ if (resData.error === 1357031) throw { error: "Trying to change emoji of a chat that doesn't exist. Have at least one message in the thread before trying to change the emoji." };
39
31
  if (resData.error) throw resData;
40
32
 
41
33
  return callback();
42
34
  })
43
- .catch(function(err) {
35
+ .catch(function (err) {
44
36
  log.error("changeThreadEmoji", err);
45
37
  return callback(err);
46
38
  });
@@ -3,30 +3,26 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, api, ctx) {
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function createNewGroup(participantIDs, groupTitle, callback) {
8
8
  if (utils.getType(groupTitle) == "Function") {
9
9
  callback = groupTitle;
10
10
  groupTitle = null;
11
11
  }
12
12
 
13
- if (utils.getType(participantIDs) !== "Array")
14
- throw { error: "createNewGroup: participantIDs should be an array." };
13
+ if (utils.getType(participantIDs) !== "Array") throw { error: "createNewGroup: participantIDs should be an array." };
15
14
 
16
- if (participantIDs.length < 2)
17
- throw {
18
- error: "createNewGroup: participantIDs should have at least 2 IDs."
19
- };
15
+ if (participantIDs.length < 2) throw { error: "createNewGroup: participantIDs should have at least 2 IDs." };
20
16
 
21
- var resolveFunc = function() {};
22
- var rejectFunc = function() {};
23
- var returnPromise = new Promise(function(resolve, reject) {
17
+ var resolveFunc = function () { };
18
+ var rejectFunc = function () { };
19
+ var returnPromise = new Promise(function (resolve, reject) {
24
20
  resolveFunc = resolve;
25
21
  rejectFunc = reject;
26
22
  });
27
23
 
28
24
  if (!callback) {
29
- callback = function(err, threadID) {
25
+ callback = function (err, threadID) {
30
26
  if (err) return rejectFunc(err);
31
27
  resolveFunc(threadID);
32
28
  };
@@ -60,15 +56,11 @@ module.exports = function(defaultFuncs, api, ctx) {
60
56
  defaultFuncs
61
57
  .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
62
58
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
63
- .then(function(resData) {
59
+ .then(function (resData) {
64
60
  if (resData.errors) throw resData;
65
- return callback(
66
- null,
67
- resData.data.messenger_group_thread_create.thread.thread_key
68
- .thread_fbid
69
- );
61
+ return callback(null, resData.data.messenger_group_thread_create.thread.thread_key.thread_fbid);
70
62
  })
71
- .catch(function(err) {
63
+ .catch(function (err) {
72
64
  log.error("createNewGroup", err);
73
65
  return callback(err);
74
66
  });
package/src/createPoll.js CHANGED
@@ -3,11 +3,11 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, api, ctx) {
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function createPoll(title, threadID, options, callback) {
8
- var resolveFunc = function() {};
9
- var rejectFunc = function() {};
10
- var returnPromise = new Promise(function(resolve, reject) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
11
  resolveFunc = resolve;
12
12
  rejectFunc = reject;
13
13
  });
@@ -16,8 +16,9 @@ module.exports = function(defaultFuncs, api, ctx) {
16
16
  if (utils.getType(options) == "Function") {
17
17
  callback = options;
18
18
  options = null;
19
- } else {
20
- callback = function(err) {
19
+ }
20
+ else {
21
+ callback = function (err) {
21
22
  if (err) return rejectFunc(err);
22
23
  resolveFunc();
23
24
  };
@@ -36,26 +37,20 @@ module.exports = function(defaultFuncs, api, ctx) {
36
37
  // eslint-disable-next-line no-prototype-builtins
37
38
  if (options.hasOwnProperty(opt)) {
38
39
  form["option_text_array[" + ind + "]"] = opt;
39
- form["option_is_selected_array[" + ind + "]"] = options[opt]
40
- ? "1"
41
- : "0";
40
+ form["option_is_selected_array[" + ind + "]"] = options[opt] ? "1" : "0";
42
41
  ind++;
43
42
  }
44
43
  }
45
44
 
46
45
  defaultFuncs
47
- .post(
48
- "https://www.facebook.com/messaging/group_polling/create_poll/?dpr=1",
49
- ctx.jar,
50
- form
51
- )
46
+ .post("https://www.facebook.com/messaging/group_polling/create_poll/?dpr=1", ctx.jar, form)
52
47
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
53
- .then(function(resData) {
48
+ .then(function (resData) {
54
49
  if (resData.payload.status != "success") throw resData;
55
50
 
56
51
  return callback();
57
52
  })
58
- .catch(function(err) {
53
+ .catch(function (err) {
59
54
  log.error("createPoll", err);
60
55
  return callback(err);
61
56
  });
@@ -3,16 +3,16 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, api, ctx) {
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function deleteMessage(messageOrMessages, callback) {
8
- var resolveFunc = function() {};
9
- var rejectFunc = function() {};
10
- var returnPromise = new Promise(function(resolve, reject) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
11
  resolveFunc = resolve;
12
12
  rejectFunc = reject;
13
13
  });
14
14
  if (!callback) {
15
- callback = function(err) {
15
+ callback = function (err) {
16
16
  if (err) return rejectFunc(err);
17
17
 
18
18
  resolveFunc();
@@ -23,25 +23,19 @@ module.exports = function(defaultFuncs, api, ctx) {
23
23
  client: "mercury"
24
24
  };
25
25
 
26
- if (utils.getType(messageOrMessages) !== "Array")
27
- messageOrMessages = [messageOrMessages];
26
+ if (utils.getType(messageOrMessages) !== "Array") messageOrMessages = [messageOrMessages];
28
27
 
29
- for (var i = 0; i < messageOrMessages.length; i++)
30
- form["message_ids[" + i + "]"] = messageOrMessages[i];
28
+ for (var i = 0; i < messageOrMessages.length; i++) form["message_ids[" + i + "]"] = messageOrMessages[i];
31
29
 
32
30
  defaultFuncs
33
- .post(
34
- "https://www.facebook.com/ajax/mercury/delete_messages.php",
35
- ctx.jar,
36
- form
37
- )
31
+ .post("https://www.facebook.com/ajax/mercury/delete_messages.php", ctx.jar, form)
38
32
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
39
- .then(function(resData) {
33
+ .then(function (resData) {
40
34
  if (resData.error) throw resData;
41
35
 
42
36
  return callback();
43
37
  })
44
- .catch(function(err) {
38
+ .catch(function (err) {
45
39
  log.error("deleteMessage", err);
46
40
  return callback(err);
47
41
  });
@@ -3,16 +3,16 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, api, ctx) {
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function deleteThread(threadOrThreads, callback) {
8
- var resolveFunc = function() {};
9
- var rejectFunc = function() {};
10
- var returnPromise = new Promise(function(resolve, reject) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
11
  resolveFunc = resolve;
12
12
  rejectFunc = reject;
13
13
  });
14
14
  if (!callback) {
15
- callback = function(err) {
15
+ callback = function (err) {
16
16
  if (err) return rejectFunc(err);
17
17
  resolveFunc();
18
18
  };
@@ -22,24 +22,18 @@ module.exports = function(defaultFuncs, api, ctx) {
22
22
  client: "mercury"
23
23
  };
24
24
 
25
- if (utils.getType(threadOrThreads) !== "Array")
26
- threadOrThreads = [threadOrThreads];
27
- for (var i = 0; i < threadOrThreads.length; i++)
28
- form["ids[" + i + "]"] = threadOrThreads[i];
25
+ if (utils.getType(threadOrThreads) !== "Array") threadOrThreads = [threadOrThreads];
26
+ for (var i = 0; i < threadOrThreads.length; i++) form["ids[" + i + "]"] = threadOrThreads[i];
29
27
 
30
28
  defaultFuncs
31
- .post(
32
- "https://www.facebook.com/ajax/mercury/delete_thread.php",
33
- ctx.jar,
34
- form
35
- )
29
+ .post("https://www.facebook.com/ajax/mercury/delete_thread.php", ctx.jar, form)
36
30
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
37
- .then(function(resData) {
31
+ .then(function (resData) {
38
32
  if (resData.error) throw resData;
39
33
 
40
34
  return callback();
41
35
  })
42
- .catch(function(err) {
36
+ .catch(function (err) {
43
37
  log.error("deleteThread", err);
44
38
  return callback(err);
45
39
  });
@@ -3,16 +3,16 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, api, ctx) {
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function forwardAttachment(attachmentID, userOrUsers, callback) {
8
- var resolveFunc = function() {};
9
- var rejectFunc = function() {};
10
- var returnPromise = new Promise(function(resolve, reject) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
11
  resolveFunc = resolve;
12
12
  rejectFunc = reject;
13
13
  });
14
14
  if (!callback) {
15
- callback = function(err) {
15
+ callback = function (err) {
16
16
  if (err) return rejectFunc(err);
17
17
  resolveFunc();
18
18
  };
@@ -28,22 +28,17 @@ module.exports = function(defaultFuncs, api, ctx) {
28
28
 
29
29
  //That's good, the key of the array is really timestmap in seconds + index
30
30
  //Probably time when the attachment will be sent?
31
- for (var i = 0; i < userOrUsers.length; i++)
32
- form["recipient_map[" + (timestamp + i) + "]"] = userOrUsers[i];
31
+ for (var i = 0; i < userOrUsers.length; i++) form["recipient_map[" + (timestamp + i) + "]"] = userOrUsers[i];
33
32
 
34
33
  defaultFuncs
35
- .post(
36
- "https://www.facebook.com/mercury/attachments/forward/",
37
- ctx.jar,
38
- form
39
- )
34
+ .post("https://www.facebook.com/mercury/attachments/forward/", ctx.jar, form)
40
35
  .then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
41
- .then(function(resData) {
36
+ .then(function (resData) {
42
37
  if (resData.error) throw resData;
43
38
 
44
39
  return callback();
45
40
  })
46
- .catch(function(err) {
41
+ .catch(function (err) {
47
42
  log.error("forwardAttachment", err);
48
43
  return callback(err);
49
44
  });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- module.exports = function(defaultFuncs, api, ctx) {
3
+ module.exports = function (defaultFuncs, api, ctx) {
4
4
  return function getCurrentUserID() {
5
5
  return ctx.userID;
6
6
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  const util = require("util");
4
4
 
5
- module.exports = function() {
5
+ module.exports = function () {
6
6
  return function getEmojiUrl(c, size, pixelRatio) {
7
7
  /*
8
8
  Resolves Facebook Messenger emoji image asset URL for an emoji character.
@@ -19,8 +19,7 @@ module.exports = function() {
19
19
  c.codePointAt(0).toString(16)
20
20
  );
21
21
  let base = 317426846;
22
- for (let i = 0; i < ending.length; i++)
23
- base = (base << 5) - base + ending.charCodeAt(i);
22
+ for (let i = 0; i < ending.length; i++) base = (base << 5) - base + ending.charCodeAt(i);
24
23
 
25
24
  let hashed = (base & 255).toString(16);
26
25
  return util.format(baseUrl, hashed, ending);
@@ -21,7 +21,7 @@ var GENDERS = {
21
21
  };
22
22
 
23
23
  function formatData(obj) {
24
- return Object.keys(obj).map(function(key) {
24
+ return Object.keys(obj).map(function (key) {
25
25
  var user = obj[key];
26
26
  return {
27
27
  alternateName: user.alternateName,
@@ -39,40 +39,32 @@ function formatData(obj) {
39
39
  });
40
40
  }
41
41
 
42
- module.exports = function(defaultFuncs, api, ctx) {
42
+ module.exports = function (defaultFuncs, api, ctx) {
43
43
  return function getFriendsList(callback) {
44
- var resolveFunc = function() {};
45
- var rejectFunc = function() {};
46
- var returnPromise = new Promise(function(resolve, reject) {
44
+ var resolveFunc = function () { };
45
+ var rejectFunc = function () { };
46
+ var returnPromise = new Promise(function (resolve, reject) {
47
47
  resolveFunc = resolve;
48
48
  rejectFunc = reject;
49
49
  });
50
50
 
51
51
  if (!callback) {
52
- callback = function(err, friendList) {
52
+ callback = function (err, friendList) {
53
53
  if (err) return rejectFunc(err);
54
54
  resolveFunc(friendList);
55
55
  };
56
56
  }
57
57
 
58
58
  defaultFuncs
59
- .postFormData(
60
- "https://www.facebook.com/chat/user_info_all",
61
- ctx.jar,
62
- {},
63
- { viewer: ctx.userID }
64
- )
59
+ .postFormData("https://www.facebook.com/chat/user_info_all", ctx.jar, {}, { viewer: ctx.userID })
65
60
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
66
- .then(function(resData) {
61
+ .then(function (resData) {
67
62
  if (!resData) throw { error: "getFriendsList returned empty object." };
68
63
  if (resData.error) throw resData;
69
64
  callback(null, formatData(resData.payload));
70
65
  })
71
- .catch(function(err) {
72
- log.error(
73
- "getFriendsList",
74
- "Lỗi getFriendsList Có Thể Do Bạn Spam Quá Nhiều ! Hãy Hạn Chế !"
75
- );
66
+ .catch(function (err) {
67
+ log.error("getFriendsList", "Lỗi getFriendsList Có Thể Do Bạn Spam Quá Nhiều ! Hãy Hạn Chế !");
76
68
  return callback(err);
77
69
  });
78
70
 
package/src/getMessage.js CHANGED
@@ -5,80 +5,76 @@ var utils = require("../utils");
5
5
  var log = require("npmlog");
6
6
 
7
7
  module.exports = function(defaultFuncs, api, ctx) {
8
- return function getMessage(threadID, messageID, callback) {
9
- if (!callback) {
10
- return callback({ error: "getMessage: need callback" });
11
- }
8
+ return function getMessage(threadID, messageID, callback) {
9
+ if (!callback) {
10
+ return callback({ error: "getMessage: need callback" });
11
+ }
12
12
 
13
- if (!threadID || !messageID) {
14
- return callback({ error: "getMessage: need threadID and messageID" });
15
- }
13
+ if (!threadID || !messageID) {
14
+ return callback({ error: "getMessage: need threadID and messageID" });
15
+ }
16
16
 
17
- const form = {
18
- av: ctx.globalOptions.pageID,
19
- queries: JSON.stringify({
20
- o0: {
21
- //This doc_id is valid as of ? (prob January 18, 2020)
22
- doc_id: "1768656253222505",
23
- query_params: {
24
- thread_and_message_id: {
25
- thread_id: threadID,
26
- message_id: messageID
17
+ const form = {
18
+ "av": ctx.globalOptions.pageID,
19
+ "queries": JSON.stringify({
20
+ "o0": {
21
+ //This doc_id is valid as of ? (prob January 18, 2020)
22
+ "doc_id": "1768656253222505",
23
+ "query_params": {
24
+ "thread_and_message_id": {
25
+ "thread_id": threadID,
26
+ "message_id": messageID,
27
+ }
27
28
  }
28
29
  }
29
- }
30
- })
31
- };
30
+ })
31
+ };
32
32
 
33
- defaultFuncs
33
+ defaultFuncs
34
34
  .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
35
35
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
- .then(resData => {
36
+ .then((resData) => {
37
37
  if (resData[resData.length - 1].error_results > 0) {
38
38
  throw resData[0].o0.errors;
39
39
  }
40
40
 
41
41
  if (resData[resData.length - 1].successful_results === 0) {
42
- throw {
43
- error: "getMessage: there was no successful_results",
44
- res: resData
45
- };
42
+ throw { error: "getMessage: there was no successful_results", res: resData };
46
43
  }
47
44
 
48
45
  var fetchData = resData[0].o0.data.message;
49
46
  if (fetchData) {
50
47
  (!ctx.globalOptions.selfListen &&
51
48
  fetchData.message_sender.id.toString() === ctx.userID) ||
52
- !ctx.loggedIn
53
- ? undefined
54
- : (function() {
55
- callback(null, {
56
- threadID: threadID,
57
- messageID: fetchData.message_id,
58
- senderID: fetchData.message_sender.id,
59
- attachments: fetchData.blob_attachments.map(att => {
49
+ !ctx.loggedIn ?
50
+ undefined :
51
+ (function () { callback(null, {
52
+ threadID: threadID,
53
+ messageID: fetchData.message_id,
54
+ senderID: fetchData.message_sender.id,
55
+ attachments: fetchData.blob_attachments.map(att => {
60
56
  var x;
61
57
  try {
62
- x = utils._formatAttachment(att);
58
+ x = utils._formatAttachment(att);
63
59
  } catch (ex) {
64
- x = att;
65
- x.error = ex;
66
- x.type = "unknown";
60
+ x = att;
61
+ x.error = ex;
62
+ x.type = "unknown";
67
63
  }
68
64
  return x;
69
- }),
70
- body: fetchData.message.text,
71
- mentions: fetchData.message.ranges,
72
- timestamp: fetchData.timestamp_precise,
73
- messageReply: fetchData.replied_to_message,
74
- raw: fetchData
75
- });
76
- })();
65
+ }),
66
+ body: fetchData.message.text,
67
+ mentions: fetchData.message.ranges,
68
+ timestamp: fetchData.timestamp_precise,
69
+ messageReply: fetchData.replied_to_message,
70
+ raw: fetchData,
71
+ }); })();
77
72
  }
78
- })
79
- .catch(err => {
80
- log.error("getMessage", err);
81
- callback(err);
82
- });
73
+ })
74
+ .catch((err) => {
75
+ log.error("getMessage", err);
76
+ callback(err);
77
+ });
78
+
83
79
  };
84
- };
80
+ };