alicezetion 1.0.3 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -1
  2. package/.cache/replit/modules.stamp +1 -0
  3. package/.cache/replit/nix/env.json +1 -1
  4. package/index.js +536 -604
  5. package/package.json +78 -75
  6. package/replit.nix +6 -0
  7. package/src/addExternalModule.js +15 -0
  8. package/{alice → src}/addUserToGroup.js +77 -113
  9. package/src/changeAdminStatus.js +47 -0
  10. package/src/changeArchivedStatus.js +41 -0
  11. package/{alice → src}/changeBio.js +64 -77
  12. package/{alice → src}/changeBlockedStatus.js +36 -47
  13. package/{alice → src}/changeGroupImage.js +105 -129
  14. package/src/changeNickname.js +43 -0
  15. package/{alice → src}/changeThreadColor.js +61 -71
  16. package/src/changeThreadEmoji.js +41 -0
  17. package/src/chat.js +315 -0
  18. package/{alice → src}/createNewGroup.js +70 -86
  19. package/{alice → src}/createPoll.js +59 -71
  20. package/src/deleteMessage.js +44 -0
  21. package/src/deleteThread.js +42 -0
  22. package/src/forwardAttachment.js +47 -0
  23. package/src/forwardMessage.js +0 -0
  24. package/{alice → src}/getCurrentUserID.js +7 -7
  25. package/{alice → src}/getEmojiUrl.js +27 -29
  26. package/{alice → src}/getFriendsList.js +73 -84
  27. package/{alice → src}/getThreadHistory.js +537 -645
  28. package/src/getThreadHistoryDeprecated.js +71 -0
  29. package/{alice → src}/getThreadInfo.js +171 -206
  30. package/src/getThreadInfoDeprecated.js +56 -0
  31. package/{alice → src}/getThreadList.js +213 -238
  32. package/src/getThreadListDeprecated.js +46 -0
  33. package/src/getThreadPictures.js +59 -0
  34. package/{alice → src}/getUserID.js +61 -66
  35. package/{alice → src}/getUserInfo.js +66 -72
  36. package/src/handleFriendRequest.js +46 -0
  37. package/src/handleMessageRequest.js +47 -0
  38. package/{alice → src}/httpGet.js +47 -52
  39. package/{alice → src}/httpPost.js +47 -52
  40. package/src/listen.js +553 -0
  41. package/src/listenMqtt-Test.js +687 -0
  42. package/src/listenMqtt.js +677 -0
  43. package/{alice → src}/logout.js +68 -75
  44. package/{alice → src}/markAsDelivered.js +47 -58
  45. package/{alice → src}/markAsRead.js +70 -80
  46. package/{alice/seen.js → src/markAsReadAll.js} +39 -49
  47. package/{alice → src}/markAsSeen.js +48 -59
  48. package/{alice → src}/muteThread.js +45 -52
  49. package/src/removeUserFromGroup.js +45 -0
  50. package/{alice → src}/resolvePhotoUrl.js +36 -45
  51. package/src/searchForThread.js +42 -0
  52. package/{alice → src}/sendTypingIndicator.js +70 -103
  53. package/{alice/react.js → src/setMessageReaction.js} +103 -117
  54. package/{alice → src}/setPostReaction.js +63 -76
  55. package/{alice → src}/setTitle.js +70 -86
  56. package/src/threadColors.js +41 -0
  57. package/{alice → src}/unfriend.js +42 -52
  58. package/{alice → src}/unsendMessage.js +39 -49
  59. package/utils.js +1193 -1357
  60. package/alice/addExternalModule.js +0 -19
  61. package/alice/changeAdminStatus.js +0 -79
  62. package/alice/changeArchivedStatus.js +0 -55
  63. package/alice/changeNickname.js +0 -59
  64. package/alice/changeThreadEmoji.js +0 -55
  65. package/alice/chat.js +0 -459
  66. package/alice/deleteMessage.js +0 -56
  67. package/alice/deleteThread.js +0 -56
  68. package/alice/forwardAttachment.js +0 -60
  69. package/alice/getThreadHistoryDeprecated.js +0 -93
  70. package/alice/getThreadInfoDeprecated.js +0 -80
  71. package/alice/getThreadListDeprecated.js +0 -75
  72. package/alice/getThreadPictures.js +0 -79
  73. package/alice/handleFriendRequest.js +0 -61
  74. package/alice/handleMessageRequest.js +0 -65
  75. package/alice/listenMqtt.js +0 -789
  76. package/alice/removeUserFromGroup.js +0 -79
  77. package/alice/searchForThread.js +0 -53
  78. package/alice/threadColors.js +0 -57
  79. package/test/data/shareAttach.js +0 -146
  80. package/test/data/something.mov +0 -0
  81. package/test/data/test.png +0 -0
  82. package/test/data/test.txt +0 -7
  83. package/test/example-config.json +0 -18
  84. package/test/test-page.js +0 -140
  85. package/test/test.js +0 -385
@@ -1,76 +1,63 @@
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 unsendMessage(postID, type, 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, friendList) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc(friendList);
21
- };
22
- }
23
-
24
- var map = {
25
- like: 1,
26
- heart: 2,
27
- wow: 3,
28
- haha: 4,
29
- sad: 7,
30
- angry: 8
31
- };
32
- if (typeof type != "number") {
33
- type = map[type.toLocaleLowerCase()];
34
- if (!type) {
35
- type = 1;
36
- }
37
- }
38
- var form = {
39
- av: ctx.userID,
40
- fb_api_caller_class: "RelayModern",
41
- fb_api_req_friendly_name: "UFI2FeedbackReactMutation",
42
- //This doc_id is valid as of January 17th, 2020
43
- doc_id: "2580813318646067",
44
- variables: JSON.stringify({
45
- input: {
46
- client_mutation_id: "7",
47
- actor_id: ctx.userID,
48
- feedback_reaction: type,
49
-
50
- },
51
- useDefaultActor: true
52
- })
53
- };
54
-
55
- defaultFuncs
56
- .post(
57
- "https://www.facebook.com/api/graphql/",
58
- ctx.jar,
59
- form
60
- )
61
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
62
- .then(function(resData) {
63
- if (resData.error) {
64
- throw resData;
65
- }
66
-
67
- return callback();
68
- })
69
- .catch(function(err) {
70
- log.error("setPostReaction", err);
71
- return callback(err);
72
- });
73
-
74
- return returnPromise;
75
- };
76
- };
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 setPostReaction(postID, type, 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, data) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc(data);
19
+ };
20
+ }
21
+
22
+ var map = {
23
+ like: 1,
24
+ heart: 2,
25
+ wow: 3,
26
+ haha: 4,
27
+ sad: 7,
28
+ angry: 8
29
+ };
30
+ if (typeof type != "number") {
31
+ type = map[type.toLocaleLowerCase()];
32
+ if (!type) type = 1;
33
+ }
34
+ var form = {
35
+ av: ctx.userID,
36
+ fb_api_caller_class: "RelayModern",
37
+ fb_api_req_friendly_name: "UFI2FeedbackReactMutation",
38
+ //This doc_id is valid as of January 17th, 2020
39
+ doc_id: "2580813318646067",
40
+ variables: JSON.stringify({
41
+ input: {
42
+ client_mutation_id: "7",
43
+ actor_id: ctx.userID,
44
+ feedback_reaction: type
45
+ },
46
+ useDefaultActor: true
47
+ })
48
+ };
49
+
50
+ defaultFuncs
51
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
52
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
53
+ .then(function (resData) {
54
+ if (resData.error) throw resData;
55
+ return callback();
56
+ })
57
+ .catch(function (err) {
58
+ log.error("setPostReaction", err);
59
+ return callback(err);
60
+ });
61
+ return returnPromise;
62
+ };
63
+ };
@@ -1,86 +1,70 @@
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 setTitle(newTitle, threadID, callback) {
8
- if (
9
- !callback &&
10
- (utils.getType(threadID) === "Function" ||
11
- utils.getType(threadID) === "AsyncFunction")
12
- ) {
13
- throw { error: "please pass a threadID as a second argument." };
14
- }
15
-
16
- var resolveFunc = function(){};
17
- var rejectFunc = function(){};
18
- var returnPromise = new Promise(function (resolve, reject) {
19
- resolveFunc = resolve;
20
- rejectFunc = reject;
21
- });
22
-
23
- if (!callback) {
24
- callback = function (err, friendList) {
25
- if (err) {
26
- return rejectFunc(err);
27
- }
28
- resolveFunc(friendList);
29
- };
30
- }
31
-
32
- var messageAndOTID = utils.generateOfflineThreadingID();
33
- var form = {
34
- client: "mercury",
35
- action_type: "ma-type:log-message",
36
- author: "fbid:" + ctx.userID,
37
- author_email: "",
38
- coordinates: "",
39
- timestamp: Date.now(),
40
- timestamp_absolute: "Today",
41
- timestamp_relative: utils.generateTimestampRelative(),
42
- timestamp_time_passed: "0",
43
- is_unread: false,
44
- is_cleared: false,
45
- is_forward: false,
46
- is_filtered_content: false,
47
- is_spoof_warning: false,
48
- source: "source:chat:web",
49
- "source_tags[0]": "source:chat",
50
- status: "0",
51
- offline_threading_id: messageAndOTID,
52
- message_id: messageAndOTID,
53
- threading_id: utils.generateThreadingID(ctx.clientID),
54
- manual_retry_cnt: "0",
55
- thread_fbid: threadID,
56
- thread_name: newTitle,
57
- thread_id: threadID,
58
- log_message_type: "log:thread-name"
59
- };
60
-
61
- defaultFuncs
62
- .post("https://www.facebook.com/messaging/set_thread_name/", ctx.jar, form)
63
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
64
- .then(function(resData) {
65
- if (resData.error && resData.error === 1545012) {
66
- throw { error: "Cannot change chat title: Not member of chat." };
67
- }
68
-
69
- if (resData.error && resData.error === 1545003) {
70
- throw { error: "Cannot set title of single-user chat." };
71
- }
72
-
73
- if (resData.error) {
74
- throw resData;
75
- }
76
-
77
- return callback();
78
- })
79
- .catch(function(err) {
80
- log.error("setTitle", err);
81
- return callback(err);
82
- });
83
-
84
- return returnPromise;
85
- };
86
- };
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 setTitle(newTitle, threadID, callback) {
8
+ if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction"))
9
+ throw { error: "please pass a threadID as a second argument." };
10
+
11
+
12
+ var resolveFunc = function () { };
13
+ var rejectFunc = function () { };
14
+ var returnPromise = new Promise(function (resolve, reject) {
15
+ resolveFunc = resolve;
16
+ rejectFunc = reject;
17
+ });
18
+
19
+ if (!callback) {
20
+ callback = function (err, data) {
21
+ if (err) return rejectFunc(err);
22
+ resolveFunc(data);
23
+ };
24
+ }
25
+
26
+ var messageAndOTID = utils.generateOfflineThreadingID();
27
+ var form = {
28
+ client: "mercury",
29
+ action_type: "ma-type:log-message",
30
+ author: "fbid:" + ctx.userID,
31
+ author_email: "",
32
+ coordinates: "",
33
+ timestamp: Date.now(),
34
+ timestamp_absolute: "Today",
35
+ timestamp_relative: utils.generateTimestampRelative(),
36
+ timestamp_time_passed: "0",
37
+ is_unread: false,
38
+ is_cleared: false,
39
+ is_forward: false,
40
+ is_filtered_content: false,
41
+ is_spoof_warning: false,
42
+ source: "source:chat:web",
43
+ "source_tags[0]": "source:chat",
44
+ status: "0",
45
+ offline_threading_id: messageAndOTID,
46
+ message_id: messageAndOTID,
47
+ threading_id: utils.generateThreadingID(ctx.clientID),
48
+ manual_retry_cnt: "0",
49
+ thread_fbid: threadID,
50
+ thread_name: newTitle,
51
+ thread_id: threadID,
52
+ log_message_type: "log:thread-name"
53
+ };
54
+
55
+ defaultFuncs
56
+ .post("https://www.facebook.com/messaging/set_thread_name/", ctx.jar, form)
57
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
58
+ .then(function (resData) {
59
+ if (resData.error && resData.error === 1545012) throw { error: "Cannot change chat title: Not member of chat." };
60
+ if (resData.error && resData.error === 1545003) throw { error: "Cannot set title of single-user chat." };
61
+ if (resData.error) throw resData;
62
+ return callback();
63
+ })
64
+ .catch(function (err) {
65
+ log.error("setTitle", err);
66
+ return callback(err);
67
+ });
68
+ return returnPromise;
69
+ };
70
+ };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ module.exports = function (_defaultFuncs, _api, _ctx) {
4
+ // Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more
5
+ return {
6
+
7
+ //#region This part is for backward compatibly
8
+ //trying to match the color one-by-one. kill me plz
9
+ MessengerBlue: "196241301102133", //DefaultBlue
10
+ Viking: "1928399724138152", //TealBlue
11
+ GoldenPoppy: "174636906462322", //Yellow
12
+ RadicalRed: "2129984390566328", //Red
13
+ Shocking: "2058653964378557", //LavenderPurple
14
+ FreeSpeechGreen: "2136751179887052", //Green
15
+ Pumpkin: "175615189761153", //Orange
16
+ LightCoral: "980963458735625", //CoralPink
17
+ MediumSlateBlue: "234137870477637", //BrightPurple
18
+ DeepSkyBlue: "2442142322678320", //AquaBlue
19
+ BrilliantRose: "169463077092846", //HotPink
20
+ //i've tried my best, everything else can't be mapped. (or is it?) -UIRI 2020
21
+ //#endregion
22
+
23
+ DefaultBlue: "196241301102133",
24
+ HotPink: "169463077092846",
25
+ AquaBlue: "2442142322678320",
26
+ BrightPurple: "234137870477637",
27
+ CoralPink: "980963458735625",
28
+ Orange: "175615189761153",
29
+ Green: "2136751179887052",
30
+ LavenderPurple: "2058653964378557",
31
+ Red: "2129984390566328",
32
+ Yellow: "174636906462322",
33
+ TealBlue: "1928399724138152",
34
+ Aqua: "417639218648241",
35
+ Mango: "930060997172551",
36
+ Berry: "164535220883264",
37
+ Citrus: "370940413392601",
38
+ Candy: "205488546921017",
39
+ //StarWars: "809305022860427" Removed.
40
+ };
41
+ };
@@ -1,52 +1,42 @@
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 unsendMessage(userID, 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, friendList) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc(friendList);
21
- };
22
- }
23
-
24
- var form = {
25
- uid: userID,
26
- unref: "bd_friends_tab",
27
- floc: "friends_tab",
28
- "nctr[_mod]": "pagelet_timeline_app_collection_" + ctx.userID + ":2356318349:2"
29
- };
30
-
31
- defaultFuncs
32
- .post(
33
- "https://www.facebook.com/ajax/profile/removefriendconfirm.php",
34
- ctx.jar,
35
- form
36
- )
37
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
38
- .then(function(resData) {
39
- if (resData.error) {
40
- throw resData;
41
- }
42
-
43
- return callback();
44
- })
45
- .catch(function(err) {
46
- log.error("unfriend", err);
47
- return callback(err);
48
- });
49
-
50
- return returnPromise;
51
- };
52
- };
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 unfriend(userID, 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, friendList) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc(friendList);
19
+ };
20
+ }
21
+
22
+ var form = {
23
+ uid: userID,
24
+ unref: "bd_friends_tab",
25
+ floc: "friends_tab",
26
+ "nctr[_mod]": "pagelet_timeline_app_collection_" + ctx.userID + ":2356318349:2"
27
+ };
28
+
29
+ defaultFuncs
30
+ .post("https://www.facebook.com/ajax/profile/removefriendconfirm.php", ctx.jar, form)
31
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
32
+ .then(function (resData) {
33
+ if (resData.error) throw resData;
34
+ return callback();
35
+ })
36
+ .catch(function (err) {
37
+ log.error("unfriend", err);
38
+ return callback(err);
39
+ });
40
+ return returnPromise;
41
+ };
42
+ };
@@ -1,49 +1,39 @@
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 unsendMessage(messageID, 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, friendList) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc(friendList);
21
- };
22
- }
23
-
24
- var form = {
25
- message_id: messageID
26
- };
27
-
28
- defaultFuncs
29
- .post(
30
- "https://www.facebook.com/messaging/unsend_message/",
31
- ctx.jar,
32
- form
33
- )
34
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
- .then(function(resData) {
36
- if (resData.error) {
37
- throw resData;
38
- }
39
-
40
- return callback();
41
- })
42
- .catch(function(err) {
43
- log.error("unsendMessage", err);
44
- return callback(err);
45
- });
46
-
47
- return returnPromise;
48
- };
49
- };
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 unsendMessage(messageID, 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, friendList) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc(friendList);
19
+ };
20
+ }
21
+
22
+ var form = {
23
+ message_id: messageID
24
+ };
25
+
26
+ defaultFuncs
27
+ .post("https://www.facebook.com/messaging/unsend_message/", ctx.jar, form)
28
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
29
+ .then(function (resData) {
30
+ if (resData.error) throw resData;
31
+ return callback();
32
+ })
33
+ .catch(function (err) {
34
+ log.error("unsendMessage", "» ParseAndCheckLogin got status code: 404. Bailing out of trying to parse response.");
35
+ return callback(err);
36
+ });
37
+ return returnPromise;
38
+ };
39
+ };