alicezetion 1.6.7 → 1.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) 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 +804 -381
  4. package/leiamnash/addExternalModule.js +19 -19
  5. package/leiamnash/addUserToGroup.js +113 -113
  6. package/leiamnash/changeAdminStatus.js +79 -79
  7. package/leiamnash/changeApprovalMode.js +80 -0
  8. package/leiamnash/changeArchivedStatus.js +55 -55
  9. package/leiamnash/changeBio.js +77 -77
  10. package/leiamnash/changeBlockedStatus.js +47 -47
  11. package/leiamnash/changeGroupImage.js +129 -129
  12. package/leiamnash/changeNickname.js +59 -59
  13. package/leiamnash/changeThreadColor.js +71 -71
  14. package/leiamnash/changeThreadEmoji.js +55 -55
  15. package/leiamnash/chat.js +447 -459
  16. package/leiamnash/createNewGroup.js +86 -86
  17. package/leiamnash/createPoll.js +71 -71
  18. package/leiamnash/deleteMessage.js +56 -56
  19. package/leiamnash/deleteThread.js +56 -56
  20. package/leiamnash/forwardAttachment.js +60 -60
  21. package/leiamnash/getCurrentUserID.js +7 -7
  22. package/leiamnash/getEmojiUrl.js +29 -29
  23. package/leiamnash/getFriendsList.js +84 -84
  24. package/leiamnash/getThreadHistory.js +645 -645
  25. package/leiamnash/getThreadHistoryDeprecated.js +93 -93
  26. package/leiamnash/getThreadInfo.js +212 -206
  27. package/leiamnash/getThreadInfoDeprecated.js +80 -80
  28. package/leiamnash/getThreadList.js +238 -238
  29. package/leiamnash/getThreadListDeprecated.js +75 -75
  30. package/leiamnash/getThreadPictures.js +79 -79
  31. package/leiamnash/getUserID.js +66 -66
  32. package/leiamnash/getUserInfo.js +72 -72
  33. package/leiamnash/handleFriendRequest.js +61 -61
  34. package/leiamnash/handleMessageRequest.js +65 -65
  35. package/leiamnash/httpGet.js +52 -52
  36. package/leiamnash/httpPost.js +52 -52
  37. package/leiamnash/listenMqtt.js +1078 -509
  38. package/leiamnash/logout.js +75 -75
  39. package/leiamnash/markAsDelivered.js +58 -58
  40. package/leiamnash/markAsRead.js +80 -80
  41. package/leiamnash/markAsReadAll.js +49 -49
  42. package/leiamnash/markAsSeen.js +59 -59
  43. package/leiamnash/muteThread.js +52 -52
  44. package/leiamnash/removeUserFromGroup.js +79 -79
  45. package/leiamnash/resolvePhotoUrl.js +45 -45
  46. package/leiamnash/searchForThread.js +53 -53
  47. package/leiamnash/sendTypingIndicator.js +103 -103
  48. package/leiamnash/setMessageReaction.js +117 -117
  49. package/leiamnash/setPostReaction.js +76 -76
  50. package/leiamnash/setTitle.js +86 -86
  51. package/leiamnash/threadColors.js +57 -57
  52. package/leiamnash/unfriend.js +52 -52
  53. package/leiamnash/unsendMessage.js +49 -49
  54. package/package.json +72 -72
  55. package/replit.nix +3 -0
  56. package/utils.js +196 -71
  57. package/leiamnash/listen.js +0 -553
@@ -1,71 +1,71 @@
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 changeThreadColor(color, threadID, callback) {
8
- var resolveFunc = function(){};
9
- var rejectFunc = function(){};
10
- var returnPromise = new Promise(function (resolve, reject) {
11
- resolveFunc = resolve;
12
- rejectFunc = reject;
13
- });
14
-
15
- if (!callback) {
16
- callback = function(err) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc(err);
21
- };
22
- }
23
-
24
- var validatedColor = color !== null ? color.toLowerCase() : color; // API only accepts lowercase letters in hex string
25
- var colorList = Object.keys(api.threadColors).map(function(name) {
26
- return api.threadColors[name];
27
- });
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
- }
34
-
35
- var form = {
36
- dpr: 1,
37
- queries: JSON.stringify({
38
- o0: {
39
- //This doc_id is valid as of January 31, 2020
40
- doc_id: "1727493033983591",
41
- query_params: {
42
- data: {
43
- actor_id: ctx.userID,
44
- client_mutation_id: "0",
45
- source: "SETTINGS",
46
- theme_id: validatedColor,
47
- thread_id: threadID
48
- }
49
- }
50
- }
51
- })
52
- };
53
-
54
- defaultFuncs
55
- .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
56
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
57
- .then(function(resData) {
58
- if (resData[resData.length - 1].error_results > 0) {
59
- throw resData[0].o0.errors;
60
- }
61
-
62
- return callback();
63
- })
64
- .catch(function(err) {
65
- log.error("changeThreadColor", err);
66
- return callback(err);
67
- });
68
-
69
- return returnPromise;
70
- };
71
- };
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 changeThreadColor(color, threadID, callback) {
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
15
+ if (!callback) {
16
+ callback = function(err) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc(err);
21
+ };
22
+ }
23
+
24
+ var validatedColor = color !== null ? color.toLowerCase() : color; // API only accepts lowercase letters in hex string
25
+ var colorList = Object.keys(api.threadColors).map(function(name) {
26
+ return api.threadColors[name];
27
+ });
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
+ }
34
+
35
+ var form = {
36
+ dpr: 1,
37
+ queries: JSON.stringify({
38
+ o0: {
39
+ //This doc_id is valid as of January 31, 2020
40
+ doc_id: "1727493033983591",
41
+ query_params: {
42
+ data: {
43
+ actor_id: ctx.userID,
44
+ client_mutation_id: "0",
45
+ source: "SETTINGS",
46
+ theme_id: validatedColor,
47
+ thread_id: threadID
48
+ }
49
+ }
50
+ }
51
+ })
52
+ };
53
+
54
+ defaultFuncs
55
+ .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
56
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
57
+ .then(function(resData) {
58
+ if (resData[resData.length - 1].error_results > 0) {
59
+ throw resData[0].o0.errors;
60
+ }
61
+
62
+ return callback();
63
+ })
64
+ .catch(function(err) {
65
+ log.error("changeThreadColor", err);
66
+ return callback(err);
67
+ });
68
+
69
+ return returnPromise;
70
+ };
71
+ };
@@ -1,55 +1,55 @@
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 changeThreadEmoji(emoji, threadID, callback) {
8
- var resolveFunc = function(){};
9
- var rejectFunc = function(){};
10
- var returnPromise = new Promise(function (resolve, reject) {
11
- resolveFunc = resolve;
12
- rejectFunc = reject;
13
- });
14
-
15
- if (!callback) {
16
- callback = function(err) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc();
21
- };
22
- }
23
- var form = {
24
- emoji_choice: emoji,
25
- thread_or_other_fbid: threadID
26
- };
27
-
28
- defaultFuncs
29
- .post(
30
- "https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",
31
- ctx.jar,
32
- form
33
- )
34
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
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
-
46
- return callback();
47
- })
48
- .catch(function(err) {
49
- log.error("changeThreadEmoji", err);
50
- return callback(err);
51
- });
52
-
53
- return returnPromise;
54
- };
55
- };
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 changeThreadEmoji(emoji, threadID, callback) {
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
15
+ if (!callback) {
16
+ callback = function(err) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc();
21
+ };
22
+ }
23
+ var form = {
24
+ emoji_choice: emoji,
25
+ thread_or_other_fbid: threadID
26
+ };
27
+
28
+ defaultFuncs
29
+ .post(
30
+ "https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",
31
+ ctx.jar,
32
+ form
33
+ )
34
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
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
+
46
+ return callback();
47
+ })
48
+ .catch(function(err) {
49
+ log.error("changeThreadEmoji", err);
50
+ return callback(err);
51
+ });
52
+
53
+ return returnPromise;
54
+ };
55
+ };