alicezetion 1.2.5 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
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 +6 -3
  4. package/leiamnash/addExternalModule.js +6 -10
  5. package/leiamnash/addUserToGroup.js +16 -52
  6. package/leiamnash/changeAdminStatus.js +37 -69
  7. package/leiamnash/changeArchivedStatus.js +12 -26
  8. package/leiamnash/changeBio.js +6 -19
  9. package/leiamnash/changeBlockedStatus.js +3 -14
  10. package/leiamnash/changeGroupImage.js +16 -40
  11. package/leiamnash/changeNickname.js +11 -27
  12. package/leiamnash/changeThreadColor.js +10 -20
  13. package/leiamnash/changeThreadEmoji.js +10 -24
  14. package/leiamnash/chat.js +279 -414
  15. package/leiamnash/createNewGroup.js +12 -28
  16. package/leiamnash/createPoll.js +13 -25
  17. package/leiamnash/deleteMessage.js +12 -24
  18. package/leiamnash/deleteThread.js +11 -25
  19. package/leiamnash/forwardAttachment.js +13 -26
  20. package/leiamnash/forwardMessage.js +0 -0
  21. package/leiamnash/getCurrentUserID.js +1 -1
  22. package/leiamnash/getEmojiUrl.js +2 -4
  23. package/leiamnash/getFriendsList.js +10 -21
  24. package/leiamnash/getThreadHistory.js +58 -166
  25. package/leiamnash/getThreadHistoryDeprecated.js +20 -42
  26. package/leiamnash/getThreadInfo.js +25 -60
  27. package/leiamnash/getThreadInfoDeprecated.js +18 -42
  28. package/leiamnash/getThreadList.js +41 -66
  29. package/leiamnash/getThreadListDeprecated.js +14 -43
  30. package/leiamnash/getThreadPictures.js +17 -37
  31. package/leiamnash/getUserID.js +9 -14
  32. package/leiamnash/getUserInfo.js +12 -18
  33. package/leiamnash/handleFriendRequest.js +37 -52
  34. package/leiamnash/handleMessageRequest.js +14 -32
  35. package/leiamnash/httpGet.js +12 -17
  36. package/leiamnash/httpPost.js +12 -17
  37. package/leiamnash/listen.js +553 -0
  38. package/leiamnash/listenMqtt-Test.js +687 -0
  39. package/leiamnash/listenMqtt.js +1 -2
  40. package/leiamnash/logout.js +13 -20
  41. package/leiamnash/markAsDelivered.js +11 -22
  42. package/leiamnash/markAsRead.js +11 -21
  43. package/leiamnash/markAsReadAll.js +10 -20
  44. package/leiamnash/markAsSeen.js +7 -18
  45. package/leiamnash/muteThread.js +11 -18
  46. package/leiamnash/removeUserFromGroup.js +14 -48
  47. package/leiamnash/resolvePhotoUrl.js +8 -17
  48. package/leiamnash/searchForThread.js +10 -21
  49. package/leiamnash/sendTypingIndicator.js +14 -47
  50. package/leiamnash/setMessageReaction.js +12 -26
  51. package/leiamnash/setPostReaction.js +13 -26
  52. package/leiamnash/setTitle.js +13 -29
  53. package/leiamnash/threadColors.js +28 -44
  54. package/leiamnash/unfriend.js +9 -19
  55. package/leiamnash/unsendMessage.js +9 -19
  56. package/package.json +1 -1
  57. package/replit.nix +1 -3
  58. package/utils.js +0 -0
@@ -4,58 +4,43 @@ var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
6
  module.exports = function(defaultFuncs, api, ctx) {
7
- return function handleFriendRequest(userID, accept, callback) {
8
- if (utils.getType(accept) !== "Boolean") {
9
- throw {
10
- error: "Please pass a boolean as a second argument."
11
- };
12
- }
13
-
14
- var resolveFunc = function(){};
15
- var rejectFunc = function(){};
16
- var returnPromise = new Promise(function (resolve, reject) {
17
- resolveFunc = resolve;
18
- rejectFunc = reject;
19
- });
20
-
21
- if (!callback) {
22
- callback = function (err, friendList) {
23
- if (err) {
24
- return rejectFunc(err);
7
+ return function handleFriendRequest(userID, accept, callback) {
8
+ if (utils.getType(accept) !== "Boolean") throw { error: "Please pass a boolean as a second argument." };
9
+
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, data) {
19
+ if (err) return rejectFunc(err);
20
+ resolveFunc(data);
21
+ };
25
22
  }
26
- resolveFunc(friendList);
27
- };
28
- }
29
23
 
30
- var form = {
31
- viewer_id: ctx.userID,
32
- "frefs[0]": "jwl",
33
- floc: "friend_center_requests",
34
- ref: "/reqs.php",
35
- action: (accept ? "confirm" : "reject")
24
+ var form = {
25
+ viewer_id: userID,
26
+ "frefs[0]": "jwl",
27
+ floc: "friend_center_requests",
28
+ ref: "/reqs.php",
29
+ action: (accept ? "confirm" : "reject")
30
+ };
31
+
32
+ defaultFuncs
33
+ .post("https://www.facebook.com/requests/friends/ajax/", ctx.jar, form)
34
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
+ .then(function(resData) {
36
+ if (resData.payload.err) throw { err: resData.payload.err };
37
+ return callback();
38
+ })
39
+ .catch(function(err) {
40
+ log.error("handleFriendRequest", err);
41
+ return callback(err);
42
+ });
43
+
44
+ return returnPromise;
36
45
  };
37
-
38
- defaultFuncs
39
- .post(
40
- "https://www.facebook.com/requests/friends/ajax/",
41
- ctx.jar,
42
- form
43
- )
44
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
45
- .then(function(resData) {
46
- if (resData.payload.err) {
47
- throw {
48
- err: resData.payload.err
49
- };
50
- }
51
-
52
- return callback();
53
- })
54
- .catch(function(err) {
55
- log.error("handleFriendRequest", err);
56
- return callback(err);
57
- });
58
-
59
- return returnPromise;
60
- };
61
- };
46
+ };
@@ -3,27 +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 handleMessageRequest(threadID, accept, callback) {
8
- if (utils.getType(accept) !== "Boolean") {
9
- throw {
10
- error: "Please pass a boolean as a second argument."
11
- };
12
- }
8
+ if (utils.getType(accept) !== "Boolean") throw { error: "Please pass a boolean as a second argument." };
13
9
 
14
- var resolveFunc = function(){};
15
- var rejectFunc = function(){};
10
+ var resolveFunc = function () { };
11
+ var rejectFunc = function () { };
16
12
  var returnPromise = new Promise(function (resolve, reject) {
17
13
  resolveFunc = resolve;
18
14
  rejectFunc = reject;
19
15
  });
20
16
 
21
17
  if (!callback) {
22
- callback = function (err, friendList) {
23
- if (err) {
24
- return rejectFunc(err);
25
- }
26
- resolveFunc(friendList);
18
+ callback = function (err, data) {
19
+ if (err) return rejectFunc(err);
20
+ resolveFunc(data);
27
21
  };
28
22
  }
29
23
 
@@ -31,35 +25,23 @@ module.exports = function(defaultFuncs, api, ctx) {
31
25
  client: "mercury"
32
26
  };
33
27
 
34
- if (utils.getType(threadID) !== "Array") {
35
- threadID = [threadID];
36
- }
28
+ if (utils.getType(threadID) !== "Array") threadID = [threadID];
37
29
 
38
30
  var messageBox = accept ? "inbox" : "other";
39
-
40
- for (var i = 0; i < threadID.length; i++) {
41
- form[messageBox + "[" + i + "]"] = threadID[i];
42
- }
31
+ for (var i = 0; i < threadID.length; i++) form[messageBox + "[" + i + "]"] = threadID[i];
43
32
 
44
33
  defaultFuncs
45
- .post(
46
- "https://www.facebook.com/ajax/mercury/move_thread.php",
47
- ctx.jar,
48
- form
49
- )
34
+ .post("https://www.facebook.com/ajax/mercury/move_thread.php", ctx.jar, form)
50
35
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
51
- .then(function(resData) {
52
- if (resData.error) {
53
- throw resData;
54
- }
55
-
36
+ .then(function (resData) {
37
+ if (resData.error) throw resData;
56
38
  return callback();
57
39
  })
58
- .catch(function(err) {
40
+ .catch(function (err) {
59
41
  log.error("handleMessageRequest", err);
60
42
  return callback(err);
61
43
  });
62
-
44
+
63
45
  return returnPromise;
64
46
  };
65
47
  };
@@ -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 httpGet(url, form, callback, notAPI) {
8
- var resolveFunc = function(){};
9
- var rejectFunc = function(){};
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
10
 
11
11
  var returnPromise = new Promise(function (resolve, reject) {
12
12
  resolveFunc = resolve;
@@ -17,36 +17,31 @@ module.exports = function(defaultFuncs, api, ctx) {
17
17
  callback = form;
18
18
  form = {};
19
19
  }
20
-
21
20
  form = form || {};
22
21
 
23
- callback = callback || function(err, data) {
24
- if (err) return rejectFunc(err);
25
- resolveFunc(data);
22
+ callback = callback || function (err, data) {
23
+ if (err) return rejectFunc(err);
24
+ resolveFunc(data);
26
25
  };
27
26
 
28
27
  if (notAPI) {
29
28
  utils
30
29
  .get(url, ctx.jar, form, ctx.globalOptions)
31
- .then(function(resData) {
32
- callback(null, resData.body.toString());
33
- })
34
- .catch(function(err) {
30
+ .then(resData => callback(null, resData.body.toString()))
31
+ .catch(function (err) {
35
32
  log.error("httpGet", err);
36
33
  return callback(err);
37
34
  });
38
- } else {
35
+ }
36
+ else {
39
37
  defaultFuncs
40
38
  .get(url, ctx.jar, form)
41
- .then(function(resData) {
42
- callback(null, resData.body.toString());
43
- })
44
- .catch(function(err) {
39
+ .then(resData => callback(null, resData.body.toString()))
40
+ .catch(function (err) {
45
41
  log.error("httpGet", err);
46
42
  return callback(err);
47
43
  });
48
44
  }
49
-
50
45
  return returnPromise;
51
46
  };
52
47
  };
@@ -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 httpGet(url, form, callback, notAPI) {
8
- var resolveFunc = function(){};
9
- var rejectFunc = function(){};
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
10
 
11
11
  var returnPromise = new Promise(function (resolve, reject) {
12
12
  resolveFunc = resolve;
@@ -17,36 +17,31 @@ module.exports = function(defaultFuncs, api, ctx) {
17
17
  callback = form;
18
18
  form = {};
19
19
  }
20
-
21
20
  form = form || {};
22
21
 
23
- callback = callback || function(err, data) {
24
- if (err) return rejectFunc(err);
25
- resolveFunc(data);
22
+ callback = callback || function (err, data) {
23
+ if (err) return rejectFunc(err);
24
+ resolveFunc(data);
26
25
  };
27
26
 
28
27
  if (notAPI) {
29
28
  utils
30
29
  .post(url, ctx.jar, form, ctx.globalOptions)
31
- .then(function(resData) {
32
- callback(null, resData.body.toString());
33
- })
34
- .catch(function(err) {
30
+ .then(resData => callback(null, resData.body.toString()))
31
+ .catch(function (err) {
35
32
  log.error("httpPost", err);
36
33
  return callback(err);
37
34
  });
38
- } else {
35
+ }
36
+ else {
39
37
  defaultFuncs
40
38
  .post(url, ctx.jar, form, {})
41
- .then(function(resData) {
42
- callback(null, resData.body.toString());
43
- })
44
- .catch(function(err) {
39
+ .then(resData => callback(null, resData.body.toString()))
40
+ .catch(function (err) {
45
41
  log.error("httpPost", err);
46
42
  return callback(err);
47
43
  });
48
44
  }
49
-
50
45
  return returnPromise;
51
46
  };
52
47
  };