alicezetion 1.8.4 → 1.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) 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 +375 -210
  5. package/leiamnash/addExternalModule.js +15 -0
  6. package/leiamnash/addUserToGroup.js +77 -0
  7. package/leiamnash/changeAdminStatus.js +47 -0
  8. package/leiamnash/changeArchivedStatus.js +41 -0
  9. package/leiamnash/changeAvatar.js +127 -0
  10. package/leiamnash/changeBio.js +64 -0
  11. package/leiamnash/changeBlockedStatus.js +36 -0
  12. package/leiamnash/changeGroupImage.js +105 -0
  13. package/leiamnash/changeNickname.js +43 -0
  14. package/leiamnash/changeThreadColor.js +61 -0
  15. package/leiamnash/changeThreadEmoji.js +41 -0
  16. package/{src → leiamnash}/chat.js +3 -28
  17. package/leiamnash/createNewGroup.js +70 -0
  18. package/leiamnash/createPoll.js +59 -0
  19. package/leiamnash/deleteMessage.js +44 -0
  20. package/leiamnash/deleteThread.js +42 -0
  21. package/leiamnash/forwardAttachment.js +47 -0
  22. package/leiamnash/forwardMessage.js +0 -0
  23. package/leiamnash/getCurrentUserID.js +7 -0
  24. package/leiamnash/getEmojiUrl.js +27 -0
  25. package/leiamnash/getFriendsList.js +73 -0
  26. package/leiamnash/getInfoVideo.js +134 -0
  27. package/leiamnash/getThreadHistory.js +537 -0
  28. package/leiamnash/getThreadHistoryDeprecated.js +71 -0
  29. package/{src → leiamnash}/getThreadInfo.js +54 -70
  30. package/leiamnash/getThreadInfoDeprecated.js +56 -0
  31. package/leiamnash/getThreadList.js +213 -0
  32. package/leiamnash/getThreadListDeprecated.js +46 -0
  33. package/leiamnash/getThreadPictures.js +59 -0
  34. package/leiamnash/getUserID.js +61 -0
  35. package/leiamnash/getUserInfo.js +66 -0
  36. package/leiamnash/handleFriendRequest.js +46 -0
  37. package/leiamnash/handleMessageRequest.js +47 -0
  38. package/leiamnash/httpGet.js +47 -0
  39. package/leiamnash/httpPost.js +47 -0
  40. package/leiamnash/httpPostFormData.js +42 -0
  41. package/{src → leiamnash}/listenMqtt.js +6 -16
  42. package/leiamnash/logout.js +68 -0
  43. package/leiamnash/markAsDelivered.js +47 -0
  44. package/leiamnash/markAsRead.js +70 -0
  45. package/leiamnash/markAsReadAll.js +40 -0
  46. package/leiamnash/markAsSeen.js +48 -0
  47. package/leiamnash/muteThread.js +45 -0
  48. package/leiamnash/react.js +109 -0
  49. package/{src → leiamnash}/refreshFb_dtsg.js +1 -1
  50. package/leiamnash/removeUserFromGroup.js +45 -0
  51. package/leiamnash/resolvePhotoUrl.js +36 -0
  52. package/leiamnash/searchForThread.js +42 -0
  53. package/leiamnash/seen.js +40 -0
  54. package/leiamnash/sendMessage.js +315 -0
  55. package/leiamnash/sendTypingIndicator.js +70 -0
  56. package/leiamnash/setMessageReaction.js +103 -0
  57. package/leiamnash/setPostReaction.js +63 -0
  58. package/leiamnash/setTitle.js +70 -0
  59. package/leiamnash/threadColors.js +41 -0
  60. package/leiamnash/unfriend.js +42 -0
  61. package/leiamnash/unsendMessage.js +39 -0
  62. package/leiamnash/uploadAttachment.js +96 -0
  63. package/package.json +3 -6
  64. package/replit.nix +4 -4
  65. package/utils.js +176 -135
  66. package/src/addExternalModule.js +0 -17
  67. package/src/addUserToGroup.js +0 -113
  68. package/src/changeAdminStatus.js +0 -79
  69. package/src/changeArchivedStatus.js +0 -55
  70. package/src/changeAvatar.js +0 -93
  71. package/src/changeBio.js +0 -77
  72. package/src/changeBlockedStatus.js +0 -47
  73. package/src/changeCover.js +0 -73
  74. package/src/changeGroupImage.js +0 -132
  75. package/src/changeName.js +0 -79
  76. package/src/changeNickname.js +0 -59
  77. package/src/changeThreadColor.js +0 -65
  78. package/src/changeThreadEmoji.js +0 -55
  79. package/src/createNewGroup.js +0 -86
  80. package/src/createPoll.js +0 -71
  81. package/src/data/getThreadInfo.json +0 -1
  82. package/src/deleteMessage.js +0 -56
  83. package/src/deleteThread.js +0 -56
  84. package/src/forwardAttachment.js +0 -60
  85. package/src/getAccess.js +0 -112
  86. package/src/getAvatarUser.js +0 -78
  87. package/src/getCurrentUserID.js +0 -7
  88. package/src/getEmojiUrl.js +0 -29
  89. package/src/getFriendsList.js +0 -83
  90. package/src/getThreadHistory.js +0 -666
  91. package/src/getThreadList.js +0 -237
  92. package/src/getThreadPictures.js +0 -79
  93. package/src/getUserID.js +0 -66
  94. package/src/getUserInfo.js +0 -163
  95. package/src/handleFriendRequest.js +0 -61
  96. package/src/handleMessageRequest.js +0 -65
  97. package/src/httpGet.js +0 -57
  98. package/src/httpPost.js +0 -57
  99. package/src/httpPostFormData.js +0 -63
  100. package/src/listenNotification.js +0 -88
  101. package/src/logout.js +0 -275
  102. package/src/markAsDelivered.js +0 -58
  103. package/src/markAsRead.js +0 -80
  104. package/src/markAsReadAll.js +0 -50
  105. package/src/markAsSeen.js +0 -59
  106. package/src/muteThread.js +0 -52
  107. package/src/react.js +0 -117
  108. package/src/removeUserFromGroup.js +0 -79
  109. package/src/resolvePhotoUrl.js +0 -45
  110. package/src/searchForThread.js +0 -53
  111. package/src/searchStickers.js +0 -52
  112. package/src/seen.js +0 -50
  113. package/src/sendMessage.js +0 -477
  114. package/src/sendMessageMqtt.js +0 -316
  115. package/src/sendTypingIndicator.js +0 -103
  116. package/src/setMessageReaction.js +0 -117
  117. package/src/setPostReaction.js +0 -109
  118. package/src/setTitle.js +0 -86
  119. package/src/threadColors.js +0 -131
  120. package/src/unfriend.js +0 -52
  121. package/src/unsendMessage.js +0 -49
  122. /package/{src → leiamnash}/getMessage.js +0 -0
@@ -0,0 +1,103 @@
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 setMessageReaction(reaction, messageID, callback, forceCustomReaction) {
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
+ switch (reaction) {
23
+ case "\uD83D\uDE0D": //:heart_eyes:
24
+ case "\uD83D\uDE06": //:laughing:
25
+ case "\uD83D\uDE2E": //:open_mouth:
26
+ case "\uD83D\uDE22": //:cry:
27
+ case "\uD83D\uDE20": //:angry:
28
+ case "\uD83D\uDC4D": //:thumbsup:
29
+ case "\uD83D\uDC4E": //:thumbsdown:
30
+ case "\u2764": //:heart:
31
+ case "\uD83D\uDC97": //:glowingheart:
32
+ case "":
33
+ //valid
34
+ break;
35
+ case ":heart_eyes:":
36
+ case ":love:":
37
+ reaction = "\uD83D\uDE0D";
38
+ break;
39
+ case ":laughing:":
40
+ case ":haha:":
41
+ reaction = "\uD83D\uDE06";
42
+ break;
43
+ case ":open_mouth:":
44
+ case ":wow:":
45
+ reaction = "\uD83D\uDE2E";
46
+ break;
47
+ case ":cry:":
48
+ case ":sad:":
49
+ reaction = "\uD83D\uDE22";
50
+ break;
51
+ case ":angry:":
52
+ reaction = "\uD83D\uDE20";
53
+ break;
54
+ case ":thumbsup:":
55
+ case ":like:":
56
+ reaction = "\uD83D\uDC4D";
57
+ break;
58
+ case ":thumbsdown:":
59
+ case ":dislike:":
60
+ reaction = "\uD83D\uDC4E";
61
+ break;
62
+ case ":heart:":
63
+ reaction = "\u2764";
64
+ break;
65
+ case ":glowingheart:":
66
+ reaction = "\uD83D\uDC97";
67
+ break;
68
+ default:
69
+ if (forceCustomReaction) break;
70
+ return callback({ error: "Reaction is not a valid emoji." });
71
+ }
72
+
73
+ var variables = {
74
+ data: {
75
+ client_mutation_id: ctx.clientMutationId++,
76
+ actor_id: ctx.userID,
77
+ action: reaction == "" ? "REMOVE_REACTION" : "ADD_REACTION",
78
+ message_id: messageID,
79
+ reaction: reaction
80
+ }
81
+ };
82
+
83
+ var qs = {
84
+ doc_id: "1491398900900362",
85
+ variables: JSON.stringify(variables),
86
+ dpr: 1
87
+ };
88
+
89
+ defaultFuncs
90
+ .postFormData("https://www.facebook.com/webgraphql/mutation/", ctx.jar, {}, qs)
91
+ .then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
92
+ .then(function (resData) {
93
+ if (!resData) throw { error: "setReaction returned empty object." };
94
+ if (resData.error) throw resData;
95
+ callback(null);
96
+ })
97
+ .catch(function (err) {
98
+ log.error("setReaction", err);
99
+ return callback(err);
100
+ });
101
+ return returnPromise;
102
+ };
103
+ };
@@ -0,0 +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 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
+ };
@@ -0,0 +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 (!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
+ };
@@ -0,0 +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 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
+ };
@@ -0,0 +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) 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
+ };
@@ -0,0 +1,96 @@
1
+ const utils = require("../utils");
2
+ const log = require("npmlog");
3
+ const bluebird = require("bluebird");
4
+
5
+ module.exports = function (defaultFuncs, api, ctx) {
6
+ function upload(attachments, callback) {
7
+ callback = callback || function () { };
8
+ const uploads = [];
9
+
10
+ // create an array of promises
11
+ for (let i = 0; i < attachments.length; i++) {
12
+ if (!utils.isReadableStream(attachments[i])) {
13
+ throw {
14
+ error:
15
+ "Attachment should be a readable stream and not " +
16
+ utils.getType(attachments[i]) +
17
+ "."
18
+ };
19
+ }
20
+
21
+ const form = {
22
+ upload_1024: attachments[i],
23
+ voice_clip: "true"
24
+ };
25
+
26
+ uploads.push(
27
+ defaultFuncs
28
+ .postFormData(
29
+ "https://upload.facebook.com/ajax/mercury/upload.php",
30
+ ctx.jar,
31
+ form,
32
+ {}
33
+ )
34
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
+ .then(function (resData) {
36
+ if (resData.error) {
37
+ throw resData;
38
+ }
39
+
40
+ // We have to return the data unformatted unless we want to change it
41
+ // back in sendMessage.
42
+ return resData.payload.metadata[0];
43
+ })
44
+ );
45
+ }
46
+
47
+ // resolve all promises
48
+ bluebird
49
+ .all(uploads)
50
+ .then(function (resData) {
51
+ callback(null, resData);
52
+ })
53
+ .catch(function (err) {
54
+ log.error("uploadAttachment", err);
55
+ return callback(err);
56
+ });
57
+ }
58
+
59
+ return function uploadAttachment(attachments, callback) {
60
+ if (
61
+ !attachments &&
62
+ !utils.isReadableStream(attachments) &&
63
+ !utils.getType(attachments) === "Array" &&
64
+ (utils.getType(attachments) === "Array" && !attachments.length)
65
+ )
66
+ throw { error: "Please pass an attachment or an array of attachments." };
67
+
68
+ let resolveFunc = function () { };
69
+ let rejectFunc = function () { };
70
+ const returnPromise = new Promise(function (resolve, reject) {
71
+ resolveFunc = resolve;
72
+ rejectFunc = reject;
73
+ });
74
+
75
+ if (!callback) {
76
+ callback = function (err, info) {
77
+ if (err) {
78
+ return rejectFunc(err);
79
+ }
80
+ resolveFunc(info);
81
+ };
82
+ }
83
+
84
+ if (utils.getType(attachments) !== "Array")
85
+ attachments = [attachments];
86
+
87
+ upload(attachments, (err, info) => {
88
+ if (err) {
89
+ return callback(err);
90
+ }
91
+ callback(null, info);
92
+ });
93
+
94
+ return returnPromise;
95
+ };
96
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alicezetion",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "start": "node index.js"
@@ -19,15 +19,12 @@
19
19
  "author": "LeiamNash",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "bluebird": "^3.7.2",
22
+ "bluebird": "^2.11.0",
23
23
  "cheerio": "^1.0.0-rc.12",
24
- "https-proxy-agent": "^7.0.2",
24
+ "https-proxy-agent": "^5.0.1",
25
25
  "mqtt": "^4.3.7",
26
26
  "npmlog": "^7.0.1",
27
- "querystring": "^0.2.1",
28
27
  "request": "^2.88.2",
29
- "stream": "^0.0.2",
30
- "url": "^0.11.3",
31
28
  "websocket-stream": "^5.5.2"
32
29
  }
33
30
  }
package/replit.nix CHANGED
@@ -1,6 +1,6 @@
1
1
  { pkgs }: {
2
- deps = [
3
- pkgs.nodejs-16_x
4
- pkgs.unzip
5
- ];
2
+ deps = [
3
+ pkgs.nodejs-16_x
4
+ pkgs.cowsay
5
+ ];
6
6
  }