alicezetion 1.3.0 → 1.3.2

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.
Files changed (58) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -1
  2. package/.cache/replit/nix/env.json +1 -1
  3. package/index.js +0 -0
  4. package/leiamnash/addExternalModule.js +10 -6
  5. package/leiamnash/addUserToGroup.js +52 -16
  6. package/leiamnash/changeAdminStatus.js +69 -37
  7. package/leiamnash/changeArchivedStatus.js +26 -12
  8. package/leiamnash/changeBio.js +19 -6
  9. package/leiamnash/changeBlockedStatus.js +14 -3
  10. package/leiamnash/changeGroupImage.js +40 -16
  11. package/leiamnash/changeNickname.js +27 -11
  12. package/leiamnash/changeThreadColor.js +20 -10
  13. package/leiamnash/changeThreadEmoji.js +24 -10
  14. package/leiamnash/chat.js +414 -279
  15. package/leiamnash/createNewGroup.js +28 -12
  16. package/leiamnash/createPoll.js +25 -13
  17. package/leiamnash/deleteMessage.js +24 -12
  18. package/leiamnash/deleteThread.js +25 -11
  19. package/leiamnash/forwardAttachment.js +26 -13
  20. package/leiamnash/getCurrentUserID.js +1 -1
  21. package/leiamnash/getEmojiUrl.js +4 -2
  22. package/leiamnash/getFriendsList.js +21 -10
  23. package/leiamnash/getThreadHistory.js +166 -58
  24. package/leiamnash/getThreadHistoryDeprecated.js +42 -20
  25. package/leiamnash/getThreadInfo.js +60 -25
  26. package/leiamnash/getThreadInfoDeprecated.js +42 -18
  27. package/leiamnash/getThreadList.js +66 -41
  28. package/leiamnash/getThreadListDeprecated.js +43 -14
  29. package/leiamnash/getThreadPictures.js +37 -17
  30. package/leiamnash/getUserID.js +14 -9
  31. package/leiamnash/getUserInfo.js +18 -12
  32. package/leiamnash/handleFriendRequest.js +52 -37
  33. package/leiamnash/handleMessageRequest.js +32 -14
  34. package/leiamnash/httpGet.js +17 -12
  35. package/leiamnash/httpPost.js +17 -12
  36. package/leiamnash/listenMqtt.js +2 -1
  37. package/leiamnash/logout.js +20 -13
  38. package/leiamnash/markAsDelivered.js +22 -11
  39. package/leiamnash/markAsRead.js +21 -11
  40. package/leiamnash/markAsReadAll.js +20 -10
  41. package/leiamnash/markAsSeen.js +18 -7
  42. package/leiamnash/muteThread.js +18 -11
  43. package/leiamnash/removeUserFromGroup.js +48 -14
  44. package/leiamnash/resolvePhotoUrl.js +17 -8
  45. package/leiamnash/searchForThread.js +21 -10
  46. package/leiamnash/sendTypingIndicator.js +47 -14
  47. package/leiamnash/setMessageReaction.js +26 -12
  48. package/leiamnash/setPostReaction.js +26 -13
  49. package/leiamnash/setTitle.js +29 -13
  50. package/leiamnash/threadColors.js +44 -28
  51. package/leiamnash/unfriend.js +19 -9
  52. package/leiamnash/unsendMessage.js +19 -9
  53. package/package.json +1 -1
  54. package/replit.nix +3 -1
  55. package/utils.js +0 -0
  56. package/leiamnash/forwardMessage.js +0 -0
  57. package/leiamnash/listen.js +0 -553
  58. package/leiamnash/listenMqtt-Test.js +0 -687
@@ -3,23 +3,51 @@
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 (!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) + "." };
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
+ }
11
37
 
12
- var resolveFunc = function () { };
13
- var rejectFunc = function () { };
38
+ var resolveFunc = function(){};
39
+ var rejectFunc = function(){};
14
40
  var returnPromise = new Promise(function (resolve, reject) {
15
41
  resolveFunc = resolve;
16
42
  rejectFunc = reject;
17
43
  });
18
44
 
19
45
  if (!callback) {
20
- callback = function (err, data) {
21
- if (err) return rejectFunc(err);
22
- resolveFunc(data);
46
+ callback = function (err, friendList) {
47
+ if (err) {
48
+ return rejectFunc(err);
49
+ }
50
+ resolveFunc(friendList);
23
51
  };
24
52
  }
25
53
 
@@ -31,15 +59,21 @@ module.exports = function (defaultFuncs, api, ctx) {
31
59
  defaultFuncs
32
60
  .post("https://www.facebook.com/chat/remove_participants", ctx.jar, form)
33
61
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
34
- .then(function (resData) {
35
- if (!resData) throw { error: "Remove from group failed." };
36
- if (resData.error) throw resData;
62
+ .then(function(resData) {
63
+ if (!resData) {
64
+ throw { error: "Remove from group failed." };
65
+ }
66
+ if (resData.error) {
67
+ throw resData;
68
+ }
69
+
37
70
  return callback();
38
71
  })
39
- .catch(function (err) {
40
- log.error("removeUserFromGroup", "» Bailing out of trying to parse response");
72
+ .catch(function(err) {
73
+ log.error("removeUserFromGroup", err);
41
74
  return callback(err);
42
75
  });
76
+
43
77
  return returnPromise;
44
78
  };
45
79
  };
@@ -3,34 +3,43 @@
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, data) {
17
- if (err) return rejectFunc(err);
18
- resolveFunc(data);
16
+ callback = function (err, friendList) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc(friendList);
19
21
  };
20
22
  }
21
23
 
22
24
  defaultFuncs
23
- .get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, { photo_id: photoID })
25
+ .get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, {
26
+ photo_id: photoID
27
+ })
24
28
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
25
29
  .then(resData => {
26
- if (resData.error) throw resData;
30
+ if (resData.error) {
31
+ throw resData;
32
+ }
33
+
27
34
  var photoUrl = resData.jsmods.require[0][3][0];
35
+
28
36
  return callback(null, photoUrl);
29
37
  })
30
38
  .catch(err => {
31
39
  log.error("resolvePhotoUrl", err);
32
40
  return callback(err);
33
41
  });
42
+
34
43
  return returnPromise;
35
44
  };
36
45
  };
@@ -2,19 +2,21 @@
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, data) {
16
- if (err) return rejectFunc(err);
17
- resolveFunc(data);
15
+ callback = function (err, friendList) {
16
+ if (err) {
17
+ return rejectFunc(err);
18
+ }
19
+ resolveFunc(friendList);
18
20
  };
19
21
  }
20
22
 
@@ -27,16 +29,25 @@ module.exports = function (defaultFuncs, api, ctx) {
27
29
  };
28
30
 
29
31
  defaultFuncs
30
- .post("https://www.facebook.com/ajax/mercury/search_threads.php", ctx.jar, tmpForm)
32
+ .post(
33
+ "https://www.facebook.com/ajax/mercury/search_threads.php",
34
+ ctx.jar,
35
+ tmpForm
36
+ )
31
37
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
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 + "`." });
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
+ }
35
45
  return callback(
36
46
  null,
37
47
  resData.payload.mercury_payload.threads.map(utils.formatThread)
38
48
  );
39
49
  });
50
+
40
51
  return returnPromise;
41
52
  };
42
53
  };
@@ -15,36 +15,52 @@ module.exports = function (defaultFuncs, api, ctx) {
15
15
  // Check if thread is a single person chat or a group chat
16
16
  // More info on this is in api.sendMessage
17
17
  if (utils.getType(isGroup) == "Boolean") {
18
- if (!isGroup) form.to = threadID;
19
-
18
+ if (!isGroup) {
19
+ form.to = threadID;
20
+ }
20
21
  defaultFuncs
21
22
  .post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
22
23
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
23
24
  .then(function (resData) {
24
- if (resData.error) throw resData;
25
+ if (resData.error) {
26
+ throw resData;
27
+ }
28
+
25
29
  return callback();
26
30
  })
27
31
  .catch(function (err) {
28
32
  log.error("sendTypingIndicator", err);
29
- if (utils.getType(err) == "Object" && err.error === "Not logged in") ctx.loggedIn = false;
33
+ if (utils.getType(err) == "Object" && err.error === "Not logged in") {
34
+ ctx.loggedIn = false;
35
+ }
30
36
  return callback(err);
31
37
  });
32
- }
33
- else {
38
+ } else {
34
39
  api.getUserInfo(threadID, function (err, res) {
35
- if (err) return callback(err);
40
+ if (err) {
41
+ return callback(err);
42
+ }
43
+
36
44
  // If id is single person chat
37
- if (Object.keys(res).length > 0) form.to = threadID;
45
+ if (Object.keys(res).length > 0) {
46
+ form.to = threadID;
47
+ }
48
+
38
49
  defaultFuncs
39
50
  .post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
40
51
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
41
52
  .then(function (resData) {
42
- if (resData.error) throw resData;
53
+ if (resData.error) {
54
+ throw resData;
55
+ }
56
+
43
57
  return callback();
44
58
  })
45
59
  .catch(function (err) {
46
60
  log.error("sendTypingIndicator", err);
47
- if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
61
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
62
+ ctx.loggedIn = false;
63
+ }
48
64
  return callback(err);
49
65
  });
50
66
  });
@@ -52,18 +68,35 @@ module.exports = function (defaultFuncs, api, ctx) {
52
68
  }
53
69
 
54
70
  return function sendTypingIndicator(threadID, callback, isGroup) {
55
- if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
56
- if (callback) log.warn("sendTypingIndicator", "callback is not a function - ignoring.");
71
+ if (
72
+ utils.getType(callback) !== "Function" &&
73
+ utils.getType(callback) !== "AsyncFunction"
74
+ ) {
75
+ if (callback) {
76
+ log.warn(
77
+ "sendTypingIndicator",
78
+ "callback is not a function - ignoring."
79
+ );
80
+ }
57
81
  callback = () => { };
58
82
  }
59
83
 
60
84
  makeTypingIndicator(true, threadID, callback, isGroup);
61
85
 
62
86
  return function end(cb) {
63
- if (utils.getType(cb) !== "Function" && utils.getType(cb) !== "AsyncFunction") {
64
- if (cb) log.warn("sendTypingIndicator", "callback is not a function - ignoring.");
87
+ if (
88
+ utils.getType(cb) !== "Function" &&
89
+ utils.getType(cb) !== "AsyncFunction"
90
+ ) {
91
+ if (cb) {
92
+ log.warn(
93
+ "sendTypingIndicator",
94
+ "callback is not a function - ignoring."
95
+ );
96
+ }
65
97
  cb = () => { };
66
98
  }
99
+
67
100
  makeTypingIndicator(false, threadID, cb, isGroup);
68
101
  };
69
102
  };
@@ -3,19 +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
  return function setMessageReaction(reaction, messageID, callback, forceCustomReaction) {
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, data) {
17
- if (err) return rejectFunc(err);
18
- resolveFunc(data);
16
+ callback = function (err, friendList) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc(friendList);
19
21
  };
20
22
  }
21
23
 
@@ -66,7 +68,9 @@ module.exports = function (defaultFuncs, api, ctx) {
66
68
  reaction = "\uD83D\uDC97";
67
69
  break;
68
70
  default:
69
- if (forceCustomReaction) break;
71
+ if (forceCustomReaction) {
72
+ break;
73
+ }
70
74
  return callback({ error: "Reaction is not a valid emoji." });
71
75
  }
72
76
 
@@ -87,17 +91,27 @@ module.exports = function (defaultFuncs, api, ctx) {
87
91
  };
88
92
 
89
93
  defaultFuncs
90
- .postFormData("https://www.facebook.com/webgraphql/mutation/", ctx.jar, {}, qs)
94
+ .postFormData(
95
+ "https://www.facebook.com/webgraphql/mutation/",
96
+ ctx.jar,
97
+ {},
98
+ qs
99
+ )
91
100
  .then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
92
- .then(function (resData) {
93
- if (!resData) throw { error: "setReaction returned empty object." };
94
- if (resData.error) throw resData;
101
+ .then(function(resData) {
102
+ if (!resData) {
103
+ throw { error: "setReaction returned empty object." };
104
+ }
105
+ if (resData.error) {
106
+ throw resData;
107
+ }
95
108
  callback(null);
96
109
  })
97
- .catch(function (err) {
110
+ .catch(function(err) {
98
111
  log.error("setReaction", err);
99
112
  return callback(err);
100
113
  });
114
+
101
115
  return returnPromise;
102
116
  };
103
117
  };
@@ -3,19 +3,21 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function (defaultFuncs, api, ctx) {
7
- return function setPostReaction(postID, type, callback) {
8
- var resolveFunc = function () { };
9
- var rejectFunc = function () { };
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
+ return function unsendMessage(postID, type, callback) {
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, data) {
17
- if (err) return rejectFunc(err);
18
- resolveFunc(data);
16
+ callback = function (err, friendList) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc(friendList);
19
21
  };
20
22
  }
21
23
 
@@ -29,7 +31,9 @@ module.exports = function (defaultFuncs, api, ctx) {
29
31
  };
30
32
  if (typeof type != "number") {
31
33
  type = map[type.toLocaleLowerCase()];
32
- if (!type) type = 1;
34
+ if (!type) {
35
+ type = 1;
36
+ }
33
37
  }
34
38
  var form = {
35
39
  av: ctx.userID,
@@ -41,23 +45,32 @@ module.exports = function (defaultFuncs, api, ctx) {
41
45
  input: {
42
46
  client_mutation_id: "7",
43
47
  actor_id: ctx.userID,
44
- feedback_reaction: type
48
+ feedback_reaction: type,
49
+
45
50
  },
46
51
  useDefaultActor: true
47
52
  })
48
53
  };
49
54
 
50
55
  defaultFuncs
51
- .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
56
+ .post(
57
+ "https://www.facebook.com/api/graphql/",
58
+ ctx.jar,
59
+ form
60
+ )
52
61
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
53
- .then(function (resData) {
54
- if (resData.error) throw resData;
62
+ .then(function(resData) {
63
+ if (resData.error) {
64
+ throw resData;
65
+ }
66
+
55
67
  return callback();
56
68
  })
57
- .catch(function (err) {
69
+ .catch(function(err) {
58
70
  log.error("setPostReaction", err);
59
71
  return callback(err);
60
72
  });
73
+
61
74
  return returnPromise;
62
75
  };
63
76
  };
@@ -3,23 +3,29 @@
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 setTitle(newTitle, threadID, callback) {
8
- if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction"))
8
+ if (
9
+ !callback &&
10
+ (utils.getType(threadID) === "Function" ||
11
+ utils.getType(threadID) === "AsyncFunction")
12
+ ) {
9
13
  throw { error: "please pass a threadID as a second argument." };
14
+ }
10
15
 
11
-
12
- var resolveFunc = function () { };
13
- var rejectFunc = function () { };
16
+ var resolveFunc = function(){};
17
+ var rejectFunc = function(){};
14
18
  var returnPromise = new Promise(function (resolve, reject) {
15
19
  resolveFunc = resolve;
16
20
  rejectFunc = reject;
17
21
  });
18
22
 
19
23
  if (!callback) {
20
- callback = function (err, data) {
21
- if (err) return rejectFunc(err);
22
- resolveFunc(data);
24
+ callback = function (err, friendList) {
25
+ if (err) {
26
+ return rejectFunc(err);
27
+ }
28
+ resolveFunc(friendList);
23
29
  };
24
30
  }
25
31
 
@@ -55,16 +61,26 @@ module.exports = function (defaultFuncs, api, ctx) {
55
61
  defaultFuncs
56
62
  .post("https://www.facebook.com/messaging/set_thread_name/", ctx.jar, form)
57
63
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
58
- .then(function (resData) {
59
- if (resData.error && resData.error === 1545012) throw { error: "Cannot change chat title: Not member of chat." };
60
- if (resData.error && resData.error === 1545003) throw { error: "Cannot set title of single-user chat." };
61
- if (resData.error) throw resData;
64
+ .then(function(resData) {
65
+ if (resData.error && resData.error === 1545012) {
66
+ throw { error: "Cannot change chat title: Not member of chat." };
67
+ }
68
+
69
+ if (resData.error && resData.error === 1545003) {
70
+ throw { error: "Cannot set title of single-user chat." };
71
+ }
72
+
73
+ if (resData.error) {
74
+ throw resData;
75
+ }
76
+
62
77
  return callback();
63
78
  })
64
- .catch(function (err) {
79
+ .catch(function(err) {
65
80
  log.error("setTitle", err);
66
81
  return callback(err);
67
82
  });
83
+
68
84
  return returnPromise;
69
85
  };
70
86
  };
@@ -1,41 +1,57 @@
1
1
  "use strict";
2
2
 
3
- module.exports = function (_defaultFuncs, _api, _ctx) {
3
+ module.exports = function(_defaultFuncs, _api, _ctx) {
4
4
  // Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more
5
5
  return {
6
-
6
+ //Old hex colors.
7
+ ////MessengerBlue: null,
8
+ ////Viking: "#44bec7",
9
+ ////GoldenPoppy: "#ffc300",
10
+ ////RadicalRed: "#fa3c4c",
11
+ ////Shocking: "#d696bb",
12
+ ////PictonBlue: "#6699cc",
13
+ ////FreeSpeechGreen: "#13cf13",
14
+ ////Pumpkin: "#ff7e29",
15
+ ////LightCoral: "#e68585",
16
+ ////MediumSlateBlue: "#7646ff",
17
+ ////DeepSkyBlue: "#20cef5",
18
+ ////Fern: "#67b868",
19
+ ////Cameo: "#d4a88c",
20
+ ////BrilliantRose: "#ff5ca1",
21
+ ////BilobaFlower: "#a695c7"
22
+
7
23
  //#region This part is for backward compatibly
8
24
  //trying to match the color one-by-one. kill me plz
9
- MessengerBlue: "196241301102133", //DefaultBlue
10
- Viking: "1928399724138152", //TealBlue
11
- GoldenPoppy: "174636906462322", //Yellow
12
- RadicalRed: "2129984390566328", //Red
13
- Shocking: "2058653964378557", //LavenderPurple
25
+ MessengerBlue: "196241301102133", //DefaultBlue
26
+ Viking: "1928399724138152", //TealBlue
27
+ GoldenPoppy: "174636906462322", //Yellow
28
+ RadicalRed: "2129984390566328", //Red
29
+ Shocking: "2058653964378557", //LavenderPurple
14
30
  FreeSpeechGreen: "2136751179887052", //Green
15
- Pumpkin: "175615189761153", //Orange
16
- LightCoral: "980963458735625", //CoralPink
31
+ Pumpkin: "175615189761153", //Orange
32
+ LightCoral: "980963458735625", //CoralPink
17
33
  MediumSlateBlue: "234137870477637", //BrightPurple
18
- DeepSkyBlue: "2442142322678320", //AquaBlue
19
- BrilliantRose: "169463077092846", //HotPink
34
+ DeepSkyBlue: "2442142322678320", //AquaBlue
35
+ BrilliantRose: "169463077092846", //HotPink
20
36
  //i've tried my best, everything else can't be mapped. (or is it?) -UIRI 2020
21
37
  //#endregion
22
38
 
23
- DefaultBlue: "196241301102133",
24
- HotPink: "169463077092846",
25
- AquaBlue: "2442142322678320",
26
- BrightPurple: "234137870477637",
27
- CoralPink: "980963458735625",
28
- Orange: "175615189761153",
29
- Green: "2136751179887052",
30
- LavenderPurple: "2058653964378557",
31
- Red: "2129984390566328",
32
- Yellow: "174636906462322",
33
- TealBlue: "1928399724138152",
34
- Aqua: "417639218648241",
35
- Mango: "930060997172551",
36
- Berry: "164535220883264",
37
- Citrus: "370940413392601",
38
- Candy: "205488546921017",
39
- //StarWars: "809305022860427" Removed.
39
+ DefaultBlue: "196241301102133",
40
+ HotPink: "169463077092846",
41
+ AquaBlue: "2442142322678320",
42
+ BrightPurple: "234137870477637",
43
+ CoralPink: "980963458735625",
44
+ Orange: "175615189761153",
45
+ Green: "2136751179887052",
46
+ LavenderPurple: "2058653964378557",
47
+ Red: "2129984390566328",
48
+ Yellow: "174636906462322",
49
+ TealBlue: "1928399724138152",
50
+ Aqua: "417639218648241",
51
+ Mango: "930060997172551",
52
+ Berry: "164535220883264",
53
+ Citrus: "370940413392601",
54
+ Candy: "205488546921017",
55
+ //StarWars: "809305022860427" Removed.
40
56
  };
41
57
  };
@@ -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) {
7
- return function unfriend(userID, callback) {
8
- var resolveFunc = function () { };
9
- var rejectFunc = function () { };
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
+ return function unsendMessage(userID, callback) {
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,7 +14,9 @@ module.exports = function (defaultFuncs, api, ctx) {
14
14
 
15
15
  if (!callback) {
16
16
  callback = function (err, friendList) {
17
- if (err) return rejectFunc(err);
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
18
20
  resolveFunc(friendList);
19
21
  };
20
22
  }
@@ -27,16 +29,24 @@ module.exports = function (defaultFuncs, api, ctx) {
27
29
  };
28
30
 
29
31
  defaultFuncs
30
- .post("https://www.facebook.com/ajax/profile/removefriendconfirm.php", ctx.jar, form)
32
+ .post(
33
+ "https://www.facebook.com/ajax/profile/removefriendconfirm.php",
34
+ ctx.jar,
35
+ form
36
+ )
31
37
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
32
- .then(function (resData) {
33
- if (resData.error) throw resData;
38
+ .then(function(resData) {
39
+ if (resData.error) {
40
+ throw resData;
41
+ }
42
+
34
43
  return callback();
35
44
  })
36
- .catch(function (err) {
45
+ .catch(function(err) {
37
46
  log.error("unfriend", err);
38
47
  return callback(err);
39
48
  });
49
+
40
50
  return returnPromise;
41
51
  };
42
52
  };