alicezetion 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) 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 +488 -560
  4. package/package.json +25 -25
  5. package/replit.nix +5 -0
  6. package/src/addExternalModule.js +15 -0
  7. package/{alice → src}/addUserToGroup.js +16 -52
  8. package/src/changeAdminStatus.js +47 -0
  9. package/src/changeArchivedStatus.js +41 -0
  10. package/{alice → src}/changeBio.js +6 -19
  11. package/{alice → src}/changeBlockedStatus.js +3 -14
  12. package/{alice → src}/changeGroupImage.js +16 -40
  13. package/src/changeNickname.js +43 -0
  14. package/{alice → src}/changeThreadColor.js +10 -20
  15. package/src/changeThreadEmoji.js +41 -0
  16. package/src/chat.js +315 -0
  17. package/{alice → src}/createNewGroup.js +12 -28
  18. package/{alice → src}/createPoll.js +13 -25
  19. package/src/deleteMessage.js +44 -0
  20. package/src/deleteThread.js +42 -0
  21. package/src/forwardAttachment.js +47 -0
  22. package/src/forwardMessage.js +0 -0
  23. package/{alice → src}/getCurrentUserID.js +1 -1
  24. package/{alice → src}/getEmojiUrl.js +2 -4
  25. package/{alice → src}/getFriendsList.js +10 -21
  26. package/{alice → src}/getThreadHistory.js +58 -166
  27. package/{alice → src}/getThreadHistoryDeprecated.js +20 -42
  28. package/{alice → src}/getThreadInfo.js +25 -60
  29. package/src/getThreadInfoDeprecated.js +56 -0
  30. package/{alice → src}/getThreadList.js +41 -66
  31. package/src/getThreadListDeprecated.js +46 -0
  32. package/src/getThreadPictures.js +59 -0
  33. package/{alice → src}/getUserID.js +9 -14
  34. package/{alice → src}/getUserInfo.js +13 -19
  35. package/src/handleFriendRequest.js +46 -0
  36. package/src/handleMessageRequest.js +47 -0
  37. package/{alice → src}/httpGet.js +12 -17
  38. package/{alice → src}/httpPost.js +12 -17
  39. package/src/listen.js +553 -0
  40. package/src/listenMqtt-Test.js +687 -0
  41. package/src/listenMqtt.js +677 -0
  42. package/{alice → src}/logout.js +13 -20
  43. package/{alice → src}/markAsDelivered.js +11 -22
  44. package/{alice → src}/markAsRead.js +11 -21
  45. package/{alice → src}/markAsReadAll.js +10 -20
  46. package/{alice → src}/markAsSeen.js +7 -18
  47. package/{alice → src}/muteThread.js +11 -18
  48. package/src/removeUserFromGroup.js +45 -0
  49. package/{alice → src}/resolvePhotoUrl.js +8 -17
  50. package/{alice → src}/searchForThread.js +10 -21
  51. package/{alice → src}/sendTypingIndicator.js +14 -47
  52. package/{alice → src}/setMessageReaction.js +12 -26
  53. package/{alice → src}/setPostReaction.js +13 -26
  54. package/{alice → src}/setTitle.js +13 -29
  55. package/src/threadColors.js +41 -0
  56. package/{alice → src}/unfriend.js +9 -19
  57. package/{alice → src}/unsendMessage.js +9 -19
  58. package/utils.js +1021 -1190
  59. package/alice/addExternalModule.js +0 -19
  60. package/alice/changeAdminStatus.js +0 -79
  61. package/alice/changeArchivedStatus.js +0 -55
  62. package/alice/changeNickname.js +0 -59
  63. package/alice/changeThreadEmoji.js +0 -55
  64. package/alice/deleteMessage.js +0 -56
  65. package/alice/deleteThread.js +0 -56
  66. package/alice/forwardAttachment.js +0 -60
  67. package/alice/getThreadInfoDeprecated.js +0 -80
  68. package/alice/getThreadListDeprecated.js +0 -75
  69. package/alice/getThreadPictures.js +0 -79
  70. package/alice/handleFriendRequest.js +0 -61
  71. package/alice/handleMessageRequest.js +0 -65
  72. package/alice/listenMqtt.js +0 -789
  73. package/alice/removeUserFromGroup.js +0 -79
  74. package/alice/sendMessage.js +0 -459
  75. package/alice/threadColors.js +0 -57
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function(defaultFuncs, api, ctx) {
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
+ };
22
+ }
23
+
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;
45
+ };
46
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function handleMessageRequest(threadID, 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
+ };
22
+ }
23
+
24
+ var form = {
25
+ client: "mercury"
26
+ };
27
+
28
+ if (utils.getType(threadID) !== "Array") threadID = [threadID];
29
+
30
+ var messageBox = accept ? "inbox" : "other";
31
+ for (var i = 0; i < threadID.length; i++) form[messageBox + "[" + i + "]"] = threadID[i];
32
+
33
+ defaultFuncs
34
+ .post("https://www.facebook.com/ajax/mercury/move_thread.php", ctx.jar, form)
35
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
+ .then(function (resData) {
37
+ if (resData.error) throw resData;
38
+ return callback();
39
+ })
40
+ .catch(function (err) {
41
+ log.error("handleMessageRequest", err);
42
+ return callback(err);
43
+ });
44
+
45
+ return returnPromise;
46
+ };
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
  };