alicezetion 1.2.6 → 1.2.8

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 +3 -6
  4. package/leiamnash/addExternalModule.js +10 -6
  5. package/leiamnash/addUserToGroup.js +52 -16
  6. package/leiamnash/changeAdminStatus.js +69 -37
  7. package/leiamnash/changeArchivedStatus.js +26 -12
  8. package/leiamnash/changeBio.js +19 -6
  9. package/leiamnash/changeBlockedStatus.js +14 -3
  10. package/leiamnash/changeGroupImage.js +40 -16
  11. package/leiamnash/changeNickname.js +27 -11
  12. package/leiamnash/changeThreadColor.js +20 -10
  13. package/leiamnash/changeThreadEmoji.js +24 -10
  14. package/leiamnash/chat.js +414 -279
  15. package/leiamnash/createNewGroup.js +28 -12
  16. package/leiamnash/createPoll.js +25 -13
  17. package/leiamnash/deleteMessage.js +24 -12
  18. package/leiamnash/deleteThread.js +25 -11
  19. package/leiamnash/forwardAttachment.js +26 -13
  20. package/leiamnash/getCurrentUserID.js +1 -1
  21. package/leiamnash/getEmojiUrl.js +4 -2
  22. package/leiamnash/getFriendsList.js +21 -10
  23. package/leiamnash/getThreadHistory.js +166 -58
  24. package/leiamnash/getThreadHistoryDeprecated.js +42 -20
  25. package/leiamnash/getThreadInfo.js +60 -25
  26. package/leiamnash/getThreadInfoDeprecated.js +42 -18
  27. package/leiamnash/getThreadList.js +66 -41
  28. package/leiamnash/getThreadListDeprecated.js +43 -14
  29. package/leiamnash/getThreadPictures.js +37 -17
  30. package/leiamnash/getUserID.js +14 -9
  31. package/leiamnash/getUserInfo.js +18 -12
  32. package/leiamnash/handleFriendRequest.js +52 -37
  33. package/leiamnash/handleMessageRequest.js +32 -14
  34. package/leiamnash/httpGet.js +17 -12
  35. package/leiamnash/httpPost.js +17 -12
  36. package/leiamnash/listenMqtt.js +2 -1
  37. package/leiamnash/logout.js +20 -13
  38. package/leiamnash/markAsDelivered.js +22 -11
  39. package/leiamnash/markAsRead.js +21 -11
  40. package/leiamnash/markAsReadAll.js +20 -10
  41. package/leiamnash/markAsSeen.js +18 -7
  42. package/leiamnash/muteThread.js +18 -11
  43. package/leiamnash/removeUserFromGroup.js +48 -14
  44. package/leiamnash/resolvePhotoUrl.js +17 -8
  45. package/leiamnash/searchForThread.js +21 -10
  46. package/leiamnash/sendTypingIndicator.js +47 -14
  47. package/leiamnash/setMessageReaction.js +26 -12
  48. package/leiamnash/setPostReaction.js +26 -13
  49. package/leiamnash/setTitle.js +29 -13
  50. package/leiamnash/threadColors.js +44 -28
  51. package/leiamnash/unfriend.js +19 -9
  52. package/leiamnash/unsendMessage.js +19 -9
  53. package/package.json +1 -1
  54. package/replit.nix +3 -1
  55. package/utils.js +0 -0
  56. package/leiamnash/forwardMessage.js +0 -0
  57. package/leiamnash/listen.js +0 -553
  58. package/leiamnash/listenMqtt-Test.js +0 -687
@@ -3,27 +3,34 @@
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 () { };
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
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) {
17
- if (err) return rejectFunc(err);
16
+ callback = function(err) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
18
20
  resolveFunc(err);
19
21
  };
20
22
  }
21
23
 
22
24
  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) {
25
+ var colorList = Object.keys(api.threadColors).map(function(name) {
24
26
  return api.threadColors[name];
25
27
  });
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." };
28
+ if (!colorList.includes(validatedColor)) {
29
+ throw {
30
+ error:
31
+ "The color you are trying to use is not a valid thread color. Use api.threadColors to find acceptable values."
32
+ };
33
+ }
27
34
 
28
35
  var form = {
29
36
  dpr: 1,
@@ -47,11 +54,14 @@ module.exports = function (defaultFuncs, api, ctx) {
47
54
  defaultFuncs
48
55
  .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
49
56
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
50
- .then(function (resData) {
51
- if (resData[resData.length - 1].error_results > 0) throw resData[0].o0.errors;
57
+ .then(function(resData) {
58
+ if (resData[resData.length - 1].error_results > 0) {
59
+ throw resData[0].o0.errors;
60
+ }
61
+
52
62
  return callback();
53
63
  })
54
- .catch(function (err) {
64
+ .catch(function(err) {
55
65
  log.error("changeThreadColor", err);
56
66
  return callback(err);
57
67
  });
@@ -3,18 +3,20 @@
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 () { };
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
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) {
17
- if (err) return rejectFunc(err);
16
+ callback = function(err) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
18
20
  resolveFunc();
19
21
  };
20
22
  }
@@ -24,14 +26,26 @@ module.exports = function (defaultFuncs, api, ctx) {
24
26
  };
25
27
 
26
28
  defaultFuncs
27
- .post("https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg", ctx.jar, form)
29
+ .post(
30
+ "https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",
31
+ ctx.jar,
32
+ form
33
+ )
28
34
  .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." };
31
- if (resData.error) throw resData;
35
+ .then(function(resData) {
36
+ if (resData.error === 1357031) {
37
+ throw {
38
+ error:
39
+ "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."
40
+ };
41
+ }
42
+ if (resData.error) {
43
+ throw resData;
44
+ }
45
+
32
46
  return callback();
33
47
  })
34
- .catch(function (err) {
48
+ .catch(function(err) {
35
49
  log.error("changeThreadEmoji", err);
36
50
  return callback(err);
37
51
  });