alicezetion 1.7.1 → 1.7.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 (83) 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 +399 -0
  4. package/Extra/Database/methods.js +286 -0
  5. package/Extra/ExtraAddons.js +213 -0
  6. package/Extra/ExtraGetThread.js +1 -0
  7. package/Extra/ExtraUptimeRobot.js +59 -0
  8. package/Extra/PM2/ecosystem.config.js +23 -0
  9. package/Extra/Src/Last-Run.js +48 -0
  10. package/Language/index.json +151 -0
  11. package/StateCrypt.js +22 -0
  12. package/broadcast.js +42 -0
  13. package/index.js +654 -119
  14. package/logger.js +21 -0
  15. package/package.json +37 -25
  16. package/replit.nix +3 -4
  17. package/src/addExternalModule.js +13 -5
  18. package/src/addUserToGroup.js +36 -12
  19. package/src/changeAdminStatus.js +85 -37
  20. package/src/changeArchivedStatus.js +15 -9
  21. package/src/changeAvt.js +91 -0
  22. package/src/changeBio.js +13 -8
  23. package/src/changeBlockedStatus.js +14 -8
  24. package/src/changeGroupImage.js +28 -13
  25. package/src/changeNickname.js +22 -11
  26. package/src/changeThreadColor.js +16 -10
  27. package/src/changeThreadEmoji.js +18 -9
  28. package/src/chat.js +401 -280
  29. package/src/createNewGroup.js +18 -10
  30. package/src/createPoll.js +17 -11
  31. package/src/deleteMessage.js +17 -10
  32. package/src/deleteThread.js +17 -10
  33. package/src/forwardAttachment.js +15 -9
  34. package/src/getAccessToken.js +32 -0
  35. package/src/getCurrentUserID.js +1 -1
  36. package/src/getEmojiUrl.js +3 -2
  37. package/src/getFriendsList.js +18 -10
  38. package/src/getMessage.js +84 -0
  39. package/src/getThreadHistory.js +156 -59
  40. package/src/getThreadHistoryDeprecated.js +26 -15
  41. package/src/getThreadInfo.js +68 -42
  42. package/src/getThreadInfoDeprecated.js +25 -13
  43. package/src/getThreadList.js +112 -53
  44. package/src/getThreadListDeprecated.js +30 -12
  45. package/src/getThreadPictures.js +25 -13
  46. package/src/getUserID.js +9 -7
  47. package/src/getUserInfo.js +12 -10
  48. package/src/getUserInfoV2.js +35 -0
  49. package/src/handleFriendRequest.js +36 -35
  50. package/src/handleMessageRequest.js +18 -10
  51. package/src/httpGet.js +20 -13
  52. package/src/httpPost.js +19 -13
  53. package/src/httpPostFormData.js +46 -0
  54. package/src/listenMqtt.js +1224 -621
  55. package/src/logout.js +18 -13
  56. package/src/markAsDelivered.js +17 -10
  57. package/src/markAsRead.js +36 -24
  58. package/src/markAsSeen.js +22 -12
  59. package/src/muteThread.js +15 -9
  60. package/src/{setMessageReaction.js → react.js} +20 -9
  61. package/src/removeUserFromGroup.js +38 -11
  62. package/src/resolvePhotoUrl.js +9 -6
  63. package/src/searchForThread.js +14 -8
  64. package/src/{markAsReadAll.js → seen.js} +17 -10
  65. package/src/sendTypingIndicator.js +44 -19
  66. package/src/setPostReaction.js +63 -22
  67. package/src/setTitle.js +22 -12
  68. package/src/threadColors.js +17 -19
  69. package/src/unfriend.js +15 -9
  70. package/src/{unsendMessage.js → unsend.js} +9 -8
  71. package/utils.js +120 -27
  72. package/.travis.yml +0 -6
  73. package/src/forwardMessage.js +0 -0
  74. package/src/listen.js +0 -553
  75. package/src/listenMqtt-Test.js +0 -687
  76. package/src/sendMessage.js +0 -315
  77. package/test/data/shareAttach.js +0 -146
  78. package/test/data/something.mov +0 -0
  79. package/test/data/test.png +0 -0
  80. package/test/data/test.txt +0 -7
  81. package/test/example-config.json +0 -18
  82. package/test/test-page.js +0 -140
  83. package/test/test.js +0 -385
@@ -4,7 +4,7 @@ var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
  var bluebird = require("bluebird");
6
6
 
7
- module.exports = function (defaultFuncs, api, ctx) {
7
+ module.exports = function(defaultFuncs, api, ctx) {
8
8
  function handleUpload(image, callback) {
9
9
  var uploads = [];
10
10
 
@@ -15,10 +15,16 @@ module.exports = function (defaultFuncs, api, ctx) {
15
15
 
16
16
  uploads.push(
17
17
  defaultFuncs
18
- .postFormData("https://upload.facebook.com/ajax/mercury/upload.php", ctx.jar, form, {})
18
+ .postFormData(
19
+ "https://upload.facebook.com/ajax/mercury/upload.php",
20
+ ctx.jar,
21
+ form,
22
+ {}
23
+ )
19
24
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
20
- .then(function (resData) {
25
+ .then(function(resData) {
21
26
  if (resData.error) throw resData;
27
+
22
28
  return resData.payload.metadata[0];
23
29
  })
24
30
  );
@@ -27,24 +33,29 @@ module.exports = function (defaultFuncs, api, ctx) {
27
33
  bluebird
28
34
  .all(uploads)
29
35
  .then(resData => callback(null, resData))
30
- .catch(function (err) {
36
+ .catch(function(err) {
31
37
  log.error("handleUpload", err);
32
38
  return callback(err);
33
39
  });
34
40
  }
35
41
 
36
42
  return function changeGroupImage(image, threadID, callback) {
37
- if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction")) throw { error: "please pass a threadID as a second argument." };
43
+ if (
44
+ !callback &&
45
+ (utils.getType(threadID) === "Function" ||
46
+ utils.getType(threadID) === "AsyncFunction")
47
+ )
48
+ throw { error: "please pass a threadID as a second argument." };
38
49
 
39
- var resolveFunc = function () { };
40
- var rejectFunc = function () { };
41
- var returnPromise = new Promise(function (resolve, reject) {
50
+ var resolveFunc = function() {};
51
+ var rejectFunc = function() {};
52
+ var returnPromise = new Promise(function(resolve, reject) {
42
53
  resolveFunc = resolve;
43
54
  rejectFunc = reject;
44
55
  });
45
56
 
46
57
  if (!callback) {
47
- callback = function (err) {
58
+ callback = function(err) {
48
59
  if (err) return rejectFunc(err);
49
60
  resolveFunc();
50
61
  };
@@ -80,21 +91,25 @@ module.exports = function (defaultFuncs, api, ctx) {
80
91
  timestamp_time_passed: "0"
81
92
  };
82
93
 
83
- handleUpload(image, function (err, payload) {
94
+ handleUpload(image, function(err, payload) {
84
95
  if (err) return callback(err);
85
96
 
86
97
  form["thread_image_id"] = payload[0]["image_id"];
87
98
  form["thread_id"] = threadID;
88
99
 
89
100
  defaultFuncs
90
- .post("https://www.facebook.com/messaging/set_thread_image/", ctx.jar, form)
101
+ .post(
102
+ "https://www.facebook.com/messaging/set_thread_image/",
103
+ ctx.jar,
104
+ form
105
+ )
91
106
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
92
- .then(function (resData) {
107
+ .then(function(resData) {
93
108
  // check for errors here
94
109
  if (resData.error) throw resData;
95
110
  return callback();
96
111
  })
97
- .catch(function (err) {
112
+ .catch(function(err) {
98
113
  log.error("changeGroupImage", err);
99
114
  return callback(err);
100
115
  });
@@ -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 changeNickname(nickname, threadID, participantID, 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
  };
@@ -25,16 +25,27 @@ module.exports = function (defaultFuncs, api, ctx) {
25
25
  };
26
26
 
27
27
  defaultFuncs
28
- .post("https://www.facebook.com/messaging/save_thread_nickname/?source=thread_settings&dpr=1", ctx.jar, form)
28
+ .post(
29
+ "https://www.facebook.com/messaging/save_thread_nickname/?source=thread_settings&dpr=1",
30
+ ctx.jar,
31
+ form
32
+ )
29
33
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
30
- .then(function (resData) {
31
- if (resData.error === 1545014) throw { error: "Trying to change nickname of user isn't in thread" };
32
- if (resData.error === 1357031) throw { error: "Trying to change user nickname of a thread that doesn't exist. Have at least one message in the thread before trying to change the user nickname." };
34
+ .then(function(resData) {
35
+ if (resData.error === 1545014)
36
+ throw { error: "Trying to change nickname of user isn't in thread" };
37
+ if (resData.error === 1357031)
38
+ throw {
39
+ error:
40
+ "Trying to change user nickname of a thread that doesn't exist. Have at least one message in the thread before trying to change the user nickname."
41
+ };
42
+
33
43
  if (resData.error) throw resData;
44
+
34
45
  return callback();
35
46
  })
36
- .catch(function (err) {
37
- log.error("changeNickname", "Trying to change user nickname of a thread that doesn't exist. Have at least one message in the thread before trying to change the user nickname.");
47
+ .catch(function(err) {
48
+ log.error("changeNickname", err);
38
49
  return callback(err);
39
50
  });
40
51
 
@@ -3,27 +3,31 @@
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)) throw { error: "The color you are trying to use is not a valid thread color. Use api.threadColors to find acceptable values." };
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
+ };
27
31
 
28
32
  var form = {
29
33
  dpr: 1,
@@ -47,11 +51,13 @@ module.exports = function (defaultFuncs, api, ctx) {
47
51
  defaultFuncs
48
52
  .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
49
53
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
50
- .then(function (resData) {
51
- if (resData[resData.length - 1].error_results > 0) throw resData[0].o0.errors;
54
+ .then(function(resData) {
55
+ if (resData[resData.length - 1].error_results > 0)
56
+ throw resData[0].o0.errors;
57
+
52
58
  return callback();
53
59
  })
54
- .catch(function (err) {
60
+ .catch(function(err) {
55
61
  log.error("changeThreadColor", err);
56
62
  return callback(err);
57
63
  });
@@ -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,14 +24,23 @@ module.exports = function (defaultFuncs, api, ctx) {
24
24
  };
25
25
 
26
26
  defaultFuncs
27
- .post("https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg", ctx.jar, form)
27
+ .post(
28
+ "https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",
29
+ ctx.jar,
30
+ form
31
+ )
28
32
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
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." };
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
+ };
31
39
  if (resData.error) throw resData;
40
+
32
41
  return callback();
33
42
  })
34
- .catch(function (err) {
43
+ .catch(function(err) {
35
44
  log.error("changeThreadEmoji", err);
36
45
  return callback(err);
37
46
  });