alicezetion 1.3.6 → 1.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -1
  2. package/.cache/replit/nix/env.json +1 -1
  3. package/Extra/Database/index.js +469 -0
  4. package/Extra/ExtraAddons.js +82 -0
  5. package/Extra/ExtraFindUID.js +62 -0
  6. package/Extra/ExtraGetThread.js +340 -0
  7. package/Extra/ExtraScreenShot.js +430 -0
  8. package/Extra/ExtraUptimeRobot.js +38 -0
  9. package/Extra/Html/Classic/script.js +119 -0
  10. package/Extra/Html/Classic/style.css +8 -0
  11. package/Extra/Security/AES_256_GCM/index.js +0 -0
  12. package/Extra/Security/Base/Step_1.js +6 -0
  13. package/Extra/Security/Base/Step_2.js +22 -0
  14. package/Extra/Security/Base/Step_3.js +22 -0
  15. package/Extra/Security/Base/index.js +173 -0
  16. package/Extra/Security/Index.js +5 -0
  17. package/Extra/Security/Step_1.js +6 -0
  18. package/Extra/Security/Step_2.js +22 -0
  19. package/Extra/Security/Step_3.js +22 -0
  20. package/Extra/Src/Change_Environment.js +24 -0
  21. package/Extra/Src/Check_Update.js +67 -0
  22. package/Extra/Src/History.js +115 -0
  23. package/Extra/Src/Instant_Update.js +65 -0
  24. package/Extra/Src/Last-Run.js +65 -0
  25. package/Extra/Src/Premium.js +81 -0
  26. package/Extra/Src/Release_Memory.js +41 -0
  27. package/Extra/Src/Websocket.js +213 -0
  28. package/Extra/Src/image/checkmate.jpg +0 -0
  29. package/Extra/Src/uuid.js +137 -0
  30. package/Func/AcceptAgreement.js +31 -0
  31. package/Func/ClearCache.js +64 -0
  32. package/Func/ReportV1.js +54 -0
  33. package/Language/index.json +217 -0
  34. package/Main.js +1211 -0
  35. package/broadcast.js +40 -0
  36. package/index.js +367 -522
  37. package/leiamnash/Dev_Horizon_Data.js +125 -0
  38. package/leiamnash/Premium.js +25 -0
  39. package/leiamnash/Screenshot.js +83 -0
  40. package/leiamnash/addExternalModule.js +7 -10
  41. package/leiamnash/addUserToGroup.js +17 -51
  42. package/leiamnash/changeAdminStatus.js +0 -0
  43. package/leiamnash/changeArchivedStatus.js +12 -26
  44. package/leiamnash/changeAvt.js +85 -0
  45. package/leiamnash/changeBio.js +6 -18
  46. package/leiamnash/changeBlockedStatus.js +3 -14
  47. package/leiamnash/changeGroupImage.js +16 -39
  48. package/leiamnash/changeNickname.js +11 -25
  49. package/leiamnash/changeThreadColor.js +10 -19
  50. package/leiamnash/changeThreadEmoji.js +10 -23
  51. package/leiamnash/chat.js +111 -196
  52. package/leiamnash/createNewGroup.js +12 -28
  53. package/leiamnash/createPoll.js +13 -24
  54. package/leiamnash/deleteMessage.js +12 -23
  55. package/leiamnash/deleteThread.js +11 -24
  56. package/leiamnash/forwardAttachment.js +13 -25
  57. package/leiamnash/getAccessToken.js +28 -0
  58. package/leiamnash/getCurrentUserID.js +1 -1
  59. package/leiamnash/getEmojiUrl.js +2 -4
  60. package/leiamnash/getFriendsList.js +11 -22
  61. package/leiamnash/getMessage.js +80 -0
  62. package/leiamnash/getThreadHistory.js +59 -167
  63. package/leiamnash/getThreadInfo.js +247 -28
  64. package/leiamnash/getThreadList.js +41 -66
  65. package/leiamnash/getThreadMain.js +220 -0
  66. package/leiamnash/getThreadPictures.js +17 -37
  67. package/leiamnash/getUID.js +59 -0
  68. package/leiamnash/getUserID.js +9 -13
  69. package/leiamnash/getUserInfo.js +67 -26
  70. package/leiamnash/getUserInfoMain.js +65 -0
  71. package/leiamnash/getUserInfoV2.js +32 -0
  72. package/leiamnash/getUserInfoV3.js +63 -0
  73. package/leiamnash/getUserInfoV4.js +55 -0
  74. package/leiamnash/getUserInfoV5.js +61 -0
  75. package/leiamnash/handleFriendRequest.js +12 -27
  76. package/leiamnash/handleMessageRequest.js +15 -31
  77. package/leiamnash/httpGet.js +13 -16
  78. package/leiamnash/httpPost.js +12 -16
  79. package/leiamnash/httpPostFormData.js +41 -0
  80. package/leiamnash/listenMqtt.js +301 -200
  81. package/leiamnash/logout.js +13 -20
  82. package/leiamnash/markAsDelivered.js +11 -21
  83. package/leiamnash/markAsRead.js +11 -21
  84. package/leiamnash/markAsReadAll.js +11 -18
  85. package/leiamnash/markAsSeen.js +9 -17
  86. package/leiamnash/muteThread.js +10 -15
  87. package/leiamnash/removeUserFromGroup.js +15 -45
  88. package/leiamnash/resolvePhotoUrl.js +8 -16
  89. package/leiamnash/searchForThread.js +10 -20
  90. package/leiamnash/sendMessage.js +379 -0
  91. package/leiamnash/sendTypingIndicator.js +9 -32
  92. package/leiamnash/setMessageReaction.js +12 -20
  93. package/leiamnash/setPostReaction.js +100 -74
  94. package/leiamnash/setTitle.js +13 -25
  95. package/leiamnash/threadColors.js +18 -36
  96. package/leiamnash/unfriend.js +9 -18
  97. package/leiamnash/unsendMessage.js +8 -17
  98. package/logger.js +66 -0
  99. package/package.json +49 -34
  100. package/replit.nix +1 -3
  101. package/utils.js +593 -108
  102. package/leiamnash/getThreadHistoryDeprecated.js +0 -93
  103. package/leiamnash/getThreadInfoDeprecated.js +0 -80
  104. package/leiamnash/getThreadListDeprecated.js +0 -75
@@ -3,10 +3,10 @@
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 logout(callback) {
8
- var resolveFunc = function(){};
9
- var rejectFunc = function(){};
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
10
  var returnPromise = new Promise(function (resolve, reject) {
11
11
  resolveFunc = resolve;
12
12
  rejectFunc = reject;
@@ -14,9 +14,8 @@ module.exports = function(defaultFuncs, api, ctx) {
14
14
 
15
15
  if (!callback) {
16
16
  callback = function (err, friendList) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
17
+ if (err) return rejectFunc(err);
18
+
20
19
  resolveFunc(friendList);
21
20
  };
22
21
  }
@@ -26,18 +25,14 @@ module.exports = function(defaultFuncs, api, ctx) {
26
25
  };
27
26
 
28
27
  defaultFuncs
29
- .post(
30
- "https://www.facebook.com/bluebar/modern_settings_menu/?help_type=364455653583099&show_contextual_help=1",
31
- ctx.jar,
32
- form
33
- )
28
+ .post("https://www.facebook.com/bluebar/modern_settings_menu/?help_type=364455653583099&show_contextual_help=1", ctx.jar, form)
34
29
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
- .then(function(resData) {
36
- var elem = resData.jsmods.instances[0][2][0].filter(function(v) {
30
+ .then(function (resData) {
31
+ var elem = resData.jsmods.instances[0][2][0].filter(function (v) {
37
32
  return v.value === "logout";
38
33
  })[0];
39
34
 
40
- var html = resData.jsmods.markup.filter(function(v) {
35
+ var html = resData.jsmods.markup.filter(function (v) {
41
36
  return v[0] === elem.markup.__m;
42
37
  })[0][1].__html;
43
38
 
@@ -51,21 +46,19 @@ module.exports = function(defaultFuncs, api, ctx) {
51
46
  .post("https://www.facebook.com/logout.php", ctx.jar, form)
52
47
  .then(utils.saveCookies(ctx.jar));
53
48
  })
54
- .then(function(res) {
55
- if (!res.headers) {
56
- throw { error: "An error occurred when logging out." };
57
- }
49
+ .then(function (res) {
50
+ if (!res.headers) throw { error: "An error occurred when logging out." };
58
51
 
59
52
  return defaultFuncs
60
53
  .get(res.headers.location, ctx.jar)
61
54
  .then(utils.saveCookies(ctx.jar));
62
55
  })
63
- .then(function() {
56
+ .then(function () {
64
57
  ctx.loggedIn = false;
65
58
  log.info("logout", "Logged out successfully.");
66
59
  callback();
67
60
  })
68
- .catch(function(err) {
61
+ .catch(function (err) {
69
62
  log.error("logout", err);
70
63
  return callback(err);
71
64
  });
@@ -5,25 +5,22 @@ var log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function markAsDelivered(threadID, messageID, callback) {
8
- var resolveFunc = function(){};
9
- var rejectFunc = function(){};
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
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, friendList) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc(friendList);
16
+ callback = function (err, data) {
17
+ if (err) return rejectFunc(err);
18
+
19
+ resolveFunc(data);
21
20
  };
22
21
  }
23
22
 
24
- if (!threadID || !messageID) {
25
- return callback("Error: messageID or threadID is not defined");
26
- }
23
+ if (!threadID || !messageID) return callback("Error: messageID or threadID is not defined");
27
24
 
28
25
  var form = {};
29
26
 
@@ -31,25 +28,18 @@ module.exports = function (defaultFuncs, api, ctx) {
31
28
  form["thread_ids[" + threadID + "][0]"] = messageID;
32
29
 
33
30
  defaultFuncs
34
- .post(
35
- "https://www.facebook.com/ajax/mercury/delivery_receipts.php",
36
- ctx.jar,
37
- form
38
- )
31
+ .post("https://www.facebook.com/ajax/mercury/delivery_receipts.php", ctx.jar, form)
39
32
  .then(utils.saveCookies(ctx.jar))
40
33
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
41
34
  .then(function (resData) {
42
- if (resData.error) {
43
- throw resData;
44
- }
35
+ if (resData.error) throw resData;
45
36
 
46
37
  return callback();
47
38
  })
48
39
  .catch(function (err) {
49
40
  log.error("markAsDelivered", err);
50
- if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
51
- ctx.loggedIn = false;
52
- }
41
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
42
+
53
43
  return callback(err);
54
44
  });
55
45
 
@@ -9,13 +9,9 @@ module.exports = function (defaultFuncs, api, ctx) {
9
9
  callback = read;
10
10
  read = true;
11
11
  }
12
- if (read == undefined) {
13
- read = true;
14
- }
12
+ if (read == undefined) read = true;
15
13
 
16
- if (!callback) {
17
- callback = () => { };
18
- }
14
+ if (!callback) callback = () => { };
19
15
 
20
16
  var form = {};
21
17
 
@@ -32,15 +28,12 @@ module.exports = function (defaultFuncs, api, ctx) {
32
28
  try {
33
29
  resData = await (
34
30
  defaultFuncs
35
- .post(
36
- "https://www.facebook.com/ajax/mercury/change_read_status.php",
37
- ctx.jar,
38
- form
39
- )
31
+ .post("https://www.facebook.com/ajax/mercury/change_read_status.php", ctx.jar, form)
40
32
  .then(utils.saveCookies(ctx.jar))
41
33
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
42
34
  );
43
- } catch (e) {
35
+ }
36
+ catch (e) {
44
37
  callback(e);
45
38
  return e;
46
39
  }
@@ -48,16 +41,15 @@ module.exports = function (defaultFuncs, api, ctx) {
48
41
  if (resData.error) {
49
42
  let err = resData.error;
50
43
  log.error("markAsRead", err);
51
- if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
52
- ctx.loggedIn = false;
53
- }
44
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
54
45
  callback(err);
55
46
  return err;
56
47
  }
57
48
 
58
49
  callback();
59
50
  return null;
60
- } else {
51
+ }
52
+ else {
61
53
  try {
62
54
  if (ctx.mqttClient) {
63
55
  let err = await new Promise(r => ctx.mqttClient.publish("/mark_thread", JSON.stringify({
@@ -66,12 +58,10 @@ module.exports = function (defaultFuncs, api, ctx) {
66
58
  state: read
67
59
  }), { qos: 1, retain: false }, r));
68
60
  if (err) throw err;
69
- } else {
70
- throw {
71
- error: "You can only use this function after you start listening."
72
- };
73
61
  }
74
- } catch (e) {
62
+ else throw { error: "You can only use this function after you start listening." };
63
+ }
64
+ catch (e) {
75
65
  callback(e);
76
66
  return e;
77
67
  }
@@ -3,21 +3,20 @@
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 markAsReadAll(callback) {
8
- var resolveFunc = function(){};
9
- var rejectFunc = function(){};
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
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, friendList) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc(friendList);
16
+ callback = function (err, data) {
17
+ if (err) return rejectFunc(err);
18
+
19
+ resolveFunc(data);
21
20
  };
22
21
  }
23
22
 
@@ -26,21 +25,15 @@ module.exports = function(defaultFuncs, api, ctx) {
26
25
  };
27
26
 
28
27
  defaultFuncs
29
- .post(
30
- "https://www.facebook.com/ajax/mercury/mark_folder_as_read.php",
31
- ctx.jar,
32
- form
33
- )
28
+ .post("https://www.facebook.com/ajax/mercury/mark_folder_as_read.php", ctx.jar, form)
34
29
  .then(utils.saveCookies(ctx.jar))
35
30
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
- .then(function(resData) {
37
- if (resData.error) {
38
- throw resData;
39
- }
31
+ .then(function (resData) {
32
+ if (resData.error) throw resData;
40
33
 
41
34
  return callback();
42
35
  })
43
- .catch(function(err) {
36
+ .catch(function (err) {
44
37
  log.error("markAsReadAll", err);
45
38
  return callback(err);
46
39
  });
@@ -4,7 +4,7 @@ var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
- return function markAsRead(seen_timestamp, callback) {
7
+ return function markAsSeen(seen_timestamp, callback) {
8
8
  if (utils.getType(seen_timestamp) == "Function" ||
9
9
  utils.getType(seen_timestamp) == "AsyncFunction") {
10
10
  callback = seen_timestamp;
@@ -19,11 +19,10 @@ module.exports = function (defaultFuncs, api, ctx) {
19
19
  });
20
20
 
21
21
  if (!callback) {
22
- callback = function (err, friendList) {
23
- if (err) {
24
- return rejectFunc(err);
25
- }
26
- resolveFunc(friendList);
22
+ callback = function (err, data) {
23
+ if (err) return rejectFunc(err);
24
+
25
+ resolveFunc(data);
27
26
  };
28
27
  }
29
28
 
@@ -32,25 +31,18 @@ module.exports = function (defaultFuncs, api, ctx) {
32
31
  };
33
32
 
34
33
  defaultFuncs
35
- .post(
36
- "https://www.facebook.com/ajax/mercury/mark_seen.php",
37
- ctx.jar,
38
- form
39
- )
34
+ .post("https://www.facebook.com/ajax/mercury/mark_seen.php", ctx.jar, form)
40
35
  .then(utils.saveCookies(ctx.jar))
41
36
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
42
37
  .then(function (resData) {
43
- if (resData.error) {
44
- throw resData;
45
- }
38
+ if (resData.error) throw resData;
46
39
 
47
40
  return callback();
48
41
  })
49
42
  .catch(function (err) {
50
43
  log.error("markAsSeen", err);
51
- if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
52
- ctx.loggedIn = false;
53
- }
44
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
45
+
54
46
  return callback(err);
55
47
  });
56
48
 
@@ -3,22 +3,21 @@
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
  // muteSecond: -1=permanent mute, 0=unmute, 60=one minute, 3600=one hour, etc.
8
8
  return function muteThread(threadID, muteSeconds, callback) {
9
- var resolveFunc = function(){};
10
- var rejectFunc = function(){};
9
+ var resolveFunc = function () { };
10
+ var rejectFunc = function () { };
11
11
  var returnPromise = new Promise(function (resolve, reject) {
12
12
  resolveFunc = resolve;
13
13
  rejectFunc = reject;
14
14
  });
15
15
 
16
16
  if (!callback) {
17
- callback = function (err, friendList) {
18
- if (err) {
19
- return rejectFunc(err);
20
- }
21
- resolveFunc(friendList);
17
+ callback = function (err, data) {
18
+ if (err) return rejectFunc(err);
19
+
20
+ resolveFunc(data);
22
21
  };
23
22
  }
24
23
 
@@ -28,21 +27,17 @@ module.exports = function(defaultFuncs, api, ctx) {
28
27
  };
29
28
 
30
29
  defaultFuncs
31
- .post(
32
- "https://www.facebook.com/ajax/mercury/change_mute_thread.php",
33
- ctx.jar,
34
- form
35
- )
30
+ .post("https://www.facebook.com/ajax/mercury/change_mute_thread.php", ctx.jar, form)
36
31
  .then(utils.saveCookies(ctx.jar))
37
32
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
38
- .then(function(resData) {
33
+ .then(function (resData) {
39
34
  if (resData.error) {
40
35
  throw resData;
41
36
  }
42
37
 
43
38
  return callback();
44
39
  })
45
- .catch(function(err) {
40
+ .catch(function (err) {
46
41
  log.error("muteThread", err);
47
42
  return callback(err);
48
43
  });
@@ -3,51 +3,24 @@
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 removeUserFromGroup(userID, threadID, callback) {
8
- if (
9
- !callback &&
10
- (utils.getType(threadID) === "Function" ||
11
- utils.getType(threadID) === "AsyncFunction")
12
- ) {
13
- throw { error: "please pass a threadID as a second argument." };
14
- }
15
- if (
16
- utils.getType(threadID) !== "Number" &&
17
- utils.getType(threadID) !== "String"
18
- ) {
19
- throw {
20
- error:
21
- "threadID should be of type Number or String and not " +
22
- utils.getType(threadID) +
23
- "."
24
- };
25
- }
26
- if (
27
- utils.getType(userID) !== "Number" &&
28
- utils.getType(userID) !== "String"
29
- ) {
30
- throw {
31
- error:
32
- "userID should be of type Number or String and not " +
33
- utils.getType(userID) +
34
- "."
35
- };
36
- }
8
+ if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction")) throw { error: "please pass a threadID as a second argument." };
9
+ if (utils.getType(threadID) !== "Number" && utils.getType(threadID) !== "String") throw { error: "threadID should be of type Number or String and not " + utils.getType(threadID) + "." };
10
+ if (utils.getType(userID) !== "Number" && utils.getType(userID) !== "String") throw { error: "userID should be of type Number or String and not " + utils.getType(userID) + "." };
37
11
 
38
- var resolveFunc = function(){};
39
- var rejectFunc = function(){};
12
+ var resolveFunc = function () { };
13
+ var rejectFunc = function () { };
40
14
  var returnPromise = new Promise(function (resolve, reject) {
41
15
  resolveFunc = resolve;
42
16
  rejectFunc = reject;
43
17
  });
44
18
 
45
19
  if (!callback) {
46
- callback = function (err, friendList) {
47
- if (err) {
48
- return rejectFunc(err);
49
- }
50
- resolveFunc(friendList);
20
+ callback = function (err, data) {
21
+ if (err) return rejectFunc(err);
22
+
23
+ resolveFunc(data);
51
24
  };
52
25
  }
53
26
 
@@ -59,17 +32,14 @@ module.exports = function(defaultFuncs, api, ctx) {
59
32
  defaultFuncs
60
33
  .post("https://www.facebook.com/chat/remove_participants", ctx.jar, form)
61
34
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
62
- .then(function(resData) {
63
- if (!resData) {
64
- throw { error: "Remove from group failed." };
65
- }
66
- if (resData.error) {
67
- throw resData;
68
- }
35
+ .then(function (resData) {
36
+ if (!resData) throw { error: "Remove from group failed." };
37
+
38
+ if (resData.error) throw resData;
69
39
 
70
40
  return callback();
71
41
  })
72
- .catch(function(err) {
42
+ .catch(function (err) {
73
43
  log.error("removeUserFromGroup", err);
74
44
  return callback(err);
75
45
  });
@@ -3,36 +3,28 @@
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 resolvePhotoUrl(photoID, callback) {
8
- var resolveFunc = function(){};
9
- var rejectFunc = function(){};
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
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, friendList) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc(friendList);
16
+ callback = function (err, data) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc(data);
21
19
  };
22
20
  }
23
21
 
24
22
  defaultFuncs
25
- .get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, {
26
- photo_id: photoID
27
- })
23
+ .get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, { photo_id: photoID })
28
24
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
29
25
  .then(resData => {
30
- if (resData.error) {
31
- throw resData;
32
- }
33
-
26
+ if (resData.error) throw resData;
34
27
  var photoUrl = resData.jsmods.require[0][3][0];
35
-
36
28
  return callback(null, photoUrl);
37
29
  })
38
30
  .catch(err => {
@@ -2,21 +2,19 @@
2
2
 
3
3
  var utils = require("../utils");
4
4
 
5
- module.exports = function(defaultFuncs, api, ctx) {
5
+ module.exports = function (defaultFuncs, api, ctx) {
6
6
  return function searchForThread(name, callback) {
7
- var resolveFunc = function(){};
8
- var rejectFunc = function(){};
7
+ var resolveFunc = function () { };
8
+ var rejectFunc = function () { };
9
9
  var returnPromise = new Promise(function (resolve, reject) {
10
10
  resolveFunc = resolve;
11
11
  rejectFunc = reject;
12
12
  });
13
13
 
14
14
  if (!callback) {
15
- callback = function (err, friendList) {
16
- if (err) {
17
- return rejectFunc(err);
18
- }
19
- resolveFunc(friendList);
15
+ callback = function (err, data) {
16
+ if (err) return rejectFunc(err);
17
+ resolveFunc(data);
20
18
  };
21
19
  }
22
20
 
@@ -29,19 +27,11 @@ module.exports = function(defaultFuncs, api, ctx) {
29
27
  };
30
28
 
31
29
  defaultFuncs
32
- .post(
33
- "https://www.facebook.com/ajax/mercury/search_threads.php",
34
- ctx.jar,
35
- tmpForm
36
- )
30
+ .post("https://www.facebook.com/ajax/mercury/search_threads.php", ctx.jar, tmpForm)
37
31
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
38
- .then(function(resData) {
39
- if (resData.error) {
40
- throw resData;
41
- }
42
- if (!resData.payload.mercury_payload.threads) {
43
- return callback({ error: "Could not find thread `" + name + "`." });
44
- }
32
+ .then(function (resData) {
33
+ if (resData.error) throw resData;
34
+ if (!resData.payload.mercury_payload.threads) return callback({ error: "Could not find thread `" + name + "`." });
45
35
  return callback(
46
36
  null,
47
37
  resData.payload.mercury_payload.threads.map(utils.formatThread)