alicezetion 1.7.5 → 1.7.7

Sign up to get free protection for your applications and to get access to all the features.
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/.travis.yml +6 -0
  4. package/index.js +120 -655
  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/listen.js +553 -0
  41. package/src/listenMqtt-Test.js +687 -0
  42. package/src/listenMqtt.js +621 -1224
  43. package/src/logout.js +13 -18
  44. package/src/markAsDelivered.js +10 -17
  45. package/src/markAsRead.js +24 -36
  46. package/src/{seen.js → markAsReadAll.js} +10 -17
  47. package/src/markAsSeen.js +12 -22
  48. package/src/muteThread.js +9 -15
  49. package/src/removeUserFromGroup.js +11 -38
  50. package/src/resolvePhotoUrl.js +6 -9
  51. package/src/searchForThread.js +8 -14
  52. package/src/sendMessage.js +315 -0
  53. package/src/sendTypingIndicator.js +19 -44
  54. package/src/{react.js → setMessageReaction.js} +9 -20
  55. package/src/setPostReaction.js +22 -63
  56. package/src/setTitle.js +12 -22
  57. package/src/threadColors.js +19 -17
  58. package/src/unfriend.js +9 -15
  59. package/src/{unsend.js → unsendMessage.js} +8 -9
  60. package/test/data/shareAttach.js +146 -0
  61. package/test/data/something.mov +0 -0
  62. package/test/data/test.png +0 -0
  63. package/test/data/test.txt +7 -0
  64. package/test/example-config.json +18 -0
  65. package/test/test-page.js +140 -0
  66. package/test/test.js +385 -0
  67. package/utils.js +27 -120
  68. package/Extra/Database/index.js +0 -399
  69. package/Extra/Database/methods.js +0 -286
  70. package/Extra/ExtraAddons.js +0 -213
  71. package/Extra/ExtraGetThread.js +0 -1
  72. package/Extra/ExtraUptimeRobot.js +0 -59
  73. package/Extra/PM2/ecosystem.config.js +0 -23
  74. package/Extra/Src/Last-Run.js +0 -48
  75. package/Language/index.json +0 -151
  76. package/StateCrypt.js +0 -22
  77. package/broadcast.js +0 -42
  78. package/logger.js +0 -21
  79. package/src/changeAvt.js +0 -91
  80. package/src/getAccessToken.js +0 -32
  81. package/src/getMessage.js +0 -84
  82. package/src/getUserInfoV2.js +0 -35
  83. package/src/httpPostFormData.js +0 -46
@@ -3,31 +3,27 @@
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))
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
- };
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." };
31
27
 
32
28
  var form = {
33
29
  dpr: 1,
@@ -51,13 +47,11 @@ module.exports = function(defaultFuncs, api, ctx) {
51
47
  defaultFuncs
52
48
  .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
53
49
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
54
- .then(function(resData) {
55
- if (resData[resData.length - 1].error_results > 0)
56
- throw resData[0].o0.errors;
57
-
50
+ .then(function (resData) {
51
+ if (resData[resData.length - 1].error_results > 0) throw resData[0].o0.errors;
58
52
  return callback();
59
53
  })
60
- .catch(function(err) {
54
+ .catch(function (err) {
61
55
  log.error("changeThreadColor", err);
62
56
  return callback(err);
63
57
  });
@@ -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,23 +24,14 @@ module.exports = function(defaultFuncs, api, ctx) {
24
24
  };
25
25
 
26
26
  defaultFuncs
27
- .post(
28
- "https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",
29
- ctx.jar,
30
- form
31
- )
27
+ .post("https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg", ctx.jar, form)
32
28
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
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
- };
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." };
39
31
  if (resData.error) throw resData;
40
-
41
32
  return callback();
42
33
  })
43
- .catch(function(err) {
34
+ .catch(function (err) {
44
35
  log.error("changeThreadEmoji", err);
45
36
  return callback(err);
46
37
  });