alicezetion 1.7.6 → 1.7.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -1
  2. package/.cache/replit/nix/env.json +1 -1
  3. package/.travis.yml +6 -0
  4. package/index.js +118 -654
  5. package/package.json +25 -37
  6. package/replit.nix +4 -3
  7. package/src/addExternalModule.js +5 -13
  8. package/src/addUserToGroup.js +12 -36
  9. package/src/changeAdminStatus.js +37 -85
  10. package/src/changeArchivedStatus.js +9 -15
  11. package/src/changeBio.js +8 -13
  12. package/src/changeBlockedStatus.js +8 -14
  13. package/src/changeGroupImage.js +13 -28
  14. package/src/changeNickname.js +11 -22
  15. package/src/changeThreadColor.js +10 -16
  16. package/src/changeThreadEmoji.js +9 -18
  17. package/src/chat.js +280 -401
  18. package/src/createNewGroup.js +10 -18
  19. package/src/createPoll.js +11 -17
  20. package/src/deleteMessage.js +10 -17
  21. package/src/deleteThread.js +10 -17
  22. package/src/forwardAttachment.js +9 -15
  23. package/src/forwardMessage.js +0 -0
  24. package/src/getCurrentUserID.js +1 -1
  25. package/src/getEmojiUrl.js +2 -3
  26. package/src/getFriendsList.js +10 -18
  27. package/src/getThreadHistory.js +59 -156
  28. package/src/getThreadHistoryDeprecated.js +15 -26
  29. package/src/getThreadInfo.js +42 -68
  30. package/src/getThreadInfoDeprecated.js +13 -25
  31. package/src/getThreadList.js +53 -112
  32. package/src/getThreadListDeprecated.js +12 -30
  33. package/src/getThreadPictures.js +13 -25
  34. package/src/getUserID.js +7 -9
  35. package/src/getUserInfo.js +10 -12
  36. package/src/handleFriendRequest.js +35 -36
  37. package/src/handleMessageRequest.js +10 -18
  38. package/src/httpGet.js +13 -20
  39. package/src/httpPost.js +13 -19
  40. package/src/{sendTypingIndicator.js → leiamnash.js} +19 -44
  41. package/src/listen.js +553 -0
  42. package/src/listenMqtt-Test.js +687 -0
  43. package/src/listenMqtt.js +621 -1224
  44. package/src/logout.js +13 -18
  45. package/src/markAsDelivered.js +10 -17
  46. package/src/markAsRead.js +24 -36
  47. package/src/markAsSeen.js +12 -22
  48. package/src/muteThread.js +9 -15
  49. package/src/react.js +9 -20
  50. package/src/removeUserFromGroup.js +11 -38
  51. package/src/resolvePhotoUrl.js +6 -9
  52. package/src/searchForThread.js +8 -14
  53. package/src/seen.js +10 -17
  54. package/src/setPostReaction.js +22 -63
  55. package/src/setTitle.js +12 -22
  56. package/src/threadColors.js +19 -17
  57. package/src/unfriend.js +9 -15
  58. package/src/{unsend.js → unsendMessage.js} +8 -9
  59. package/test/data/shareAttach.js +146 -0
  60. package/test/data/something.mov +0 -0
  61. package/test/data/test.png +0 -0
  62. package/test/data/test.txt +7 -0
  63. package/test/example-config.json +18 -0
  64. package/test/test-page.js +140 -0
  65. package/test/test.js +385 -0
  66. package/utils.js +27 -120
  67. package/Extra/Database/index.js +0 -399
  68. package/Extra/Database/methods.js +0 -286
  69. package/Extra/ExtraAddons.js +0 -213
  70. package/Extra/ExtraGetThread.js +0 -1
  71. package/Extra/ExtraUptimeRobot.js +0 -59
  72. package/Extra/PM2/ecosystem.config.js +0 -23
  73. package/Extra/Src/Last-Run.js +0 -48
  74. package/Language/index.json +0 -151
  75. package/StateCrypt.js +0 -22
  76. package/broadcast.js +0 -42
  77. package/logger.js +0 -21
  78. package/src/changeAvt.js +0 -91
  79. package/src/getAccessToken.js +0 -32
  80. package/src/getMessage.js +0 -84
  81. package/src/getUserInfoV2.js +0 -35
  82. package/src/httpPostFormData.js +0 -46
package/src/httpGet.js CHANGED
@@ -3,52 +3,45 @@
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
- var returnPromise = new Promise(function(resolve, reject) {
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
12
  resolveFunc = resolve;
13
13
  rejectFunc = reject;
14
14
  });
15
15
 
16
- if (
17
- !callback &&
18
- (utils.getType(form) == "Function" ||
19
- utils.getType(form) == "AsyncFunction")
20
- ) {
16
+ if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
21
17
  callback = form;
22
18
  form = {};
23
19
  }
24
-
25
20
  form = form || {};
26
21
 
27
- callback =
28
- callback ||
29
- function(err, data) {
30
- if (err) return rejectFunc(err);
31
- resolveFunc(data);
32
- };
22
+ callback = callback || function (err, data) {
23
+ if (err) return rejectFunc(err);
24
+ resolveFunc(data);
25
+ };
33
26
 
34
27
  if (notAPI) {
35
28
  utils
36
29
  .get(url, ctx.jar, form, ctx.globalOptions)
37
30
  .then(resData => callback(null, resData.body.toString()))
38
- .catch(function(err) {
31
+ .catch(function (err) {
39
32
  log.error("httpGet", err);
40
33
  return callback(err);
41
34
  });
42
- } else {
35
+ }
36
+ else {
43
37
  defaultFuncs
44
38
  .get(url, ctx.jar, form)
45
39
  .then(resData => callback(null, resData.body.toString()))
46
- .catch(function(err) {
40
+ .catch(function (err) {
47
41
  log.error("httpGet", err);
48
42
  return callback(err);
49
43
  });
50
44
  }
51
-
52
45
  return returnPromise;
53
46
  };
54
47
  };
package/src/httpPost.js CHANGED
@@ -3,47 +3,41 @@
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
- var returnPromise = new Promise(function(resolve, reject) {
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
12
  resolveFunc = resolve;
13
13
  rejectFunc = reject;
14
14
  });
15
15
 
16
- if (
17
- !callback &&
18
- (utils.getType(form) == "Function" ||
19
- utils.getType(form) == "AsyncFunction")
20
- ) {
16
+ if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
21
17
  callback = form;
22
18
  form = {};
23
19
  }
24
-
25
20
  form = form || {};
26
21
 
27
- callback =
28
- callback ||
29
- function(err, data) {
30
- if (err) return rejectFunc(err);
31
- resolveFunc(data);
32
- };
22
+ callback = callback || function (err, data) {
23
+ if (err) return rejectFunc(err);
24
+ resolveFunc(data);
25
+ };
33
26
 
34
27
  if (notAPI) {
35
28
  utils
36
29
  .post(url, ctx.jar, form, ctx.globalOptions)
37
30
  .then(resData => callback(null, resData.body.toString()))
38
- .catch(function(err) {
31
+ .catch(function (err) {
39
32
  log.error("httpPost", err);
40
33
  return callback(err);
41
34
  });
42
- } else {
35
+ }
36
+ else {
43
37
  defaultFuncs
44
38
  .post(url, ctx.jar, form, {})
45
39
  .then(resData => callback(null, resData.body.toString()))
46
- .catch(function(err) {
40
+ .catch(function (err) {
47
41
  log.error("httpPost", err);
48
42
  return callback(err);
49
43
  });
@@ -3,7 +3,7 @@
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
  function makeTypingIndicator(typ, threadID, callback, isGroup) {
8
8
  var form = {
9
9
  typ: +typ,
@@ -15,46 +15,36 @@ 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) {
19
- form.to = threadID;
20
- }
18
+ if (!isGroup) form.to = threadID;
19
+
21
20
  defaultFuncs
22
21
  .post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
23
22
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
24
- .then(function(resData) {
23
+ .then(function (resData) {
25
24
  if (resData.error) throw resData;
26
25
  return callback();
27
26
  })
28
- .catch(function(err) {
27
+ .catch(function (err) {
29
28
  log.error("sendTypingIndicator", err);
30
- if (utils.getType(err) == "Object" && err.error === "Not logged in") {
31
- ctx.loggedIn = false;
32
- }
29
+ if (utils.getType(err) == "Object" && err.error === "Not logged in") ctx.loggedIn = false;
33
30
  return callback(err);
34
31
  });
35
- } else {
36
- api.getUserInfo(threadID, function(err, res) {
32
+ }
33
+ else {
34
+ api.getUserInfo(threadID, function (err, res) {
37
35
  if (err) return callback(err);
38
36
  // If id is single person chat
39
37
  if (Object.keys(res).length > 0) form.to = threadID;
40
38
  defaultFuncs
41
- .post(
42
- "https://www.facebook.com/ajax/messaging/typ.php",
43
- ctx.jar,
44
- form
45
- )
39
+ .post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
46
40
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
47
- .then(function(resData) {
41
+ .then(function (resData) {
48
42
  if (resData.error) throw resData;
49
43
  return callback();
50
44
  })
51
- .catch(function(err) {
45
+ .catch(function (err) {
52
46
  log.error("sendTypingIndicator", err);
53
- if (
54
- utils.getType(err) == "Object" &&
55
- err.error === "Not logged in."
56
- )
57
- ctx.loggedIn = false;
47
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
58
48
  return callback(err);
59
49
  });
60
50
  });
@@ -62,33 +52,18 @@ module.exports = function(defaultFuncs, api, ctx) {
62
52
  }
63
53
 
64
54
  return function sendTypingIndicator(threadID, callback, isGroup) {
65
- if (
66
- utils.getType(callback) !== "Function" &&
67
- utils.getType(callback) !== "AsyncFunction"
68
- ) {
69
- if (callback)
70
- log.warn(
71
- "sendTypingIndicator",
72
- "callback is not a function - ignoring."
73
- );
74
- callback = () => {};
55
+ if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
56
+ if (callback) log.warn("sendTypingIndicator", "callback is not a function - ignoring.");
57
+ callback = () => { };
75
58
  }
76
59
 
77
60
  makeTypingIndicator(true, threadID, callback, isGroup);
78
61
 
79
62
  return function end(cb) {
80
- if (
81
- utils.getType(cb) !== "Function" &&
82
- utils.getType(cb) !== "AsyncFunction"
83
- ) {
84
- if (cb)
85
- log.warn(
86
- "sendTypingIndicator",
87
- "callback is not a function - ignoring."
88
- );
89
- cb = () => {};
63
+ if (utils.getType(cb) !== "Function" && utils.getType(cb) !== "AsyncFunction") {
64
+ if (cb) log.warn("sendTypingIndicator", "callback is not a function - ignoring.");
65
+ cb = () => { };
90
66
  }
91
-
92
67
  makeTypingIndicator(false, threadID, cb, isGroup);
93
68
  };
94
69
  };