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
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
-
6
- module.exports = function (defaultFuncs, api, ctx) {
7
- return function markAsReadAll(callback) {
8
- let resolveFunc = function () { };
9
- let rejectFunc = function () { };
10
- const 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
- const form = {
25
- folder: 'inbox'
26
- };
27
-
28
- defaultFuncs
29
- .post(
30
- "https://www.facebook.com/ajax/mercury/mark_folder_as_read.php",
31
- ctx.jar,
32
- form
33
- )
34
- .then(utils.saveCookies(ctx.jar))
35
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
- .then(function (resData) {
37
- if (resData.error) {
38
- throw resData;
39
- }
40
-
41
- return callback();
42
- })
43
- .catch(function (err) {
44
- log.error("markAsReadAll", err);
45
- return callback(err);
46
- });
47
-
48
- return returnPromise;
49
- };
50
- };
package/src/markAsSeen.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
-
6
- module.exports = function (defaultFuncs, api, ctx) {
7
- return function markAsRead(seen_timestamp, callback) {
8
- if (utils.getType(seen_timestamp) == "Function" ||
9
- utils.getType(seen_timestamp) == "AsyncFunction") {
10
- callback = seen_timestamp;
11
- seen_timestamp = Date.now();
12
- }
13
-
14
- let resolveFunc = function () { };
15
- let rejectFunc = function () { };
16
- const returnPromise = new Promise(function (resolve, reject) {
17
- resolveFunc = resolve;
18
- rejectFunc = reject;
19
- });
20
-
21
- if (!callback) {
22
- callback = function (err, friendList) {
23
- if (err) {
24
- return rejectFunc(err);
25
- }
26
- resolveFunc(friendList);
27
- };
28
- }
29
-
30
- const form = {
31
- seen_timestamp: seen_timestamp
32
- };
33
-
34
- defaultFuncs
35
- .post(
36
- "https://www.facebook.com/ajax/mercury/mark_seen.php",
37
- ctx.jar,
38
- form
39
- )
40
- .then(utils.saveCookies(ctx.jar))
41
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
42
- .then(function (resData) {
43
- if (resData.error) {
44
- throw resData;
45
- }
46
-
47
- return callback();
48
- })
49
- .catch(function (err) {
50
- log.error("markAsSeen", err);
51
- if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
52
- ctx.loggedIn = false;
53
- }
54
- return callback(err);
55
- });
56
-
57
- return returnPromise;
58
- };
59
- };
package/src/muteThread.js DELETED
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
-
6
- module.exports = function (defaultFuncs, api, ctx) {
7
- // muteSecond: -1=permanent mute, 0=unmute, 60=one minute, 3600=one hour, etc.
8
- return function muteThread(threadID, muteSeconds, callback) {
9
- let resolveFunc = function () { };
10
- let rejectFunc = function () { };
11
- const returnPromise = new Promise(function (resolve, reject) {
12
- resolveFunc = resolve;
13
- rejectFunc = reject;
14
- });
15
-
16
- if (!callback) {
17
- callback = function (err, friendList) {
18
- if (err) {
19
- return rejectFunc(err);
20
- }
21
- resolveFunc(friendList);
22
- };
23
- }
24
-
25
- const form = {
26
- thread_fbid: threadID,
27
- mute_settings: muteSeconds
28
- };
29
-
30
- defaultFuncs
31
- .post(
32
- "https://www.facebook.com/ajax/mercury/change_mute_thread.php",
33
- ctx.jar,
34
- form
35
- )
36
- .then(utils.saveCookies(ctx.jar))
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("muteThread", err);
47
- return callback(err);
48
- });
49
-
50
- return returnPromise;
51
- };
52
- };
package/src/react.js DELETED
@@ -1,117 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
-
6
- module.exports = function (defaultFuncs, api, ctx) {
7
- return function setMessageReaction(reaction, messageID, callback, forceCustomReaction) {
8
- let resolveFunc = function () { };
9
- let rejectFunc = function () { };
10
- const 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
- switch (reaction) {
25
- case "\uD83D\uDE0D": //:heart_eyes:
26
- case "\uD83D\uDE06": //:laughing:
27
- case "\uD83D\uDE2E": //:open_mouth:
28
- case "\uD83D\uDE22": //:cry:
29
- case "\uD83D\uDE20": //:angry:
30
- case "\uD83D\uDC4D": //:thumbsup:
31
- case "\uD83D\uDC4E": //:thumbsdown:
32
- case "\u2764": //:heart:
33
- case "\uD83D\uDC97": //:glowingheart:
34
- case "":
35
- //valid
36
- break;
37
- case ":heart_eyes:":
38
- case ":love:":
39
- reaction = "\uD83D\uDE0D";
40
- break;
41
- case ":laughing:":
42
- case ":haha:":
43
- reaction = "\uD83D\uDE06";
44
- break;
45
- case ":open_mouth:":
46
- case ":wow:":
47
- reaction = "\uD83D\uDE2E";
48
- break;
49
- case ":cry:":
50
- case ":sad:":
51
- reaction = "\uD83D\uDE22";
52
- break;
53
- case ":angry:":
54
- reaction = "\uD83D\uDE20";
55
- break;
56
- case ":thumbsup:":
57
- case ":like:":
58
- reaction = "\uD83D\uDC4D";
59
- break;
60
- case ":thumbsdown:":
61
- case ":dislike:":
62
- reaction = "\uD83D\uDC4E";
63
- break;
64
- case ":heart:":
65
- reaction = "\u2764";
66
- break;
67
- case ":glowingheart:":
68
- reaction = "\uD83D\uDC97";
69
- break;
70
- default:
71
- if (forceCustomReaction) {
72
- break;
73
- }
74
- return callback({ error: "Reaction is not a valid emoji." });
75
- }
76
-
77
- const variables = {
78
- data: {
79
- client_mutation_id: ctx.clientMutationId++,
80
- actor_id: ctx.i_userID || ctx.userID,
81
- action: reaction == "" ? "REMOVE_REACTION" : "ADD_REACTION",
82
- message_id: messageID,
83
- reaction: reaction
84
- }
85
- };
86
-
87
- const qs = {
88
- doc_id: "1491398900900362",
89
- variables: JSON.stringify(variables),
90
- dpr: 1
91
- };
92
-
93
- defaultFuncs
94
- .postFormData(
95
- "https://www.facebook.com/webgraphql/mutation/",
96
- ctx.jar,
97
- {},
98
- qs
99
- )
100
- .then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
101
- .then(function (resData) {
102
- if (!resData) {
103
- throw { error: "setReaction returned empty object." };
104
- }
105
- if (resData.error) {
106
- throw resData;
107
- }
108
- callback(null);
109
- })
110
- .catch(function (err) {
111
- log.error("setReaction", err);
112
- return callback(err);
113
- });
114
-
115
- return returnPromise;
116
- };
117
- };
@@ -1,79 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
-
6
- module.exports = function (defaultFuncs, api, ctx) {
7
- return function removeUserFromGroup(userID, 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
- if (
16
- utils.getType(threadID) !== "Number" &&
17
- utils.getType(threadID) !== "String"
18
- ) {
19
- throw {
20
- error:
21
- "threadID should be of type Number or String and not " +
22
- utils.getType(threadID) +
23
- "."
24
- };
25
- }
26
- if (
27
- utils.getType(userID) !== "Number" &&
28
- utils.getType(userID) !== "String"
29
- ) {
30
- throw {
31
- error:
32
- "userID should be of type Number or String and not " +
33
- utils.getType(userID) +
34
- "."
35
- };
36
- }
37
-
38
- let resolveFunc = function () { };
39
- let rejectFunc = function () { };
40
- const returnPromise = new Promise(function (resolve, reject) {
41
- resolveFunc = resolve;
42
- rejectFunc = reject;
43
- });
44
-
45
- if (!callback) {
46
- callback = function (err, friendList) {
47
- if (err) {
48
- return rejectFunc(err);
49
- }
50
- resolveFunc(friendList);
51
- };
52
- }
53
-
54
- const form = {
55
- uid: userID,
56
- tid: threadID
57
- };
58
-
59
- defaultFuncs
60
- .post("https://www.facebook.com/chat/remove_participants", ctx.jar, form)
61
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
62
- .then(function (resData) {
63
- if (!resData) {
64
- throw { error: "Remove from group failed." };
65
- }
66
- if (resData.error) {
67
- throw resData;
68
- }
69
-
70
- return callback();
71
- })
72
- .catch(function (err) {
73
- log.error("removeUserFromGroup", err);
74
- return callback(err);
75
- });
76
-
77
- return returnPromise;
78
- };
79
- };
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
-
6
- module.exports = function (defaultFuncs, api, ctx) {
7
- return function resolvePhotoUrl(photoID, callback) {
8
- let resolveFunc = function () { };
9
- let rejectFunc = function () { };
10
- const 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
- defaultFuncs
25
- .get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, {
26
- photo_id: photoID
27
- })
28
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
29
- .then(resData => {
30
- if (resData.error) {
31
- throw resData;
32
- }
33
-
34
- const photoUrl = resData.jsmods.require[0][3][0];
35
-
36
- return callback(null, photoUrl);
37
- })
38
- .catch(err => {
39
- log.error("resolvePhotoUrl", err);
40
- return callback(err);
41
- });
42
-
43
- return returnPromise;
44
- };
45
- };
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
-
5
- module.exports = function (defaultFuncs, api, ctx) {
6
- return function searchForThread(name, callback) {
7
- let resolveFunc = function () { };
8
- let rejectFunc = function () { };
9
- const returnPromise = new Promise(function (resolve, reject) {
10
- resolveFunc = resolve;
11
- rejectFunc = reject;
12
- });
13
-
14
- if (!callback) {
15
- callback = function (err, friendList) {
16
- if (err) {
17
- return rejectFunc(err);
18
- }
19
- resolveFunc(friendList);
20
- };
21
- }
22
-
23
- const tmpForm = {
24
- client: "web_messenger",
25
- query: name,
26
- offset: 0,
27
- limit: 21,
28
- index: "fbid"
29
- };
30
-
31
- defaultFuncs
32
- .post(
33
- "https://www.facebook.com/ajax/mercury/search_threads.php",
34
- ctx.jar,
35
- tmpForm
36
- )
37
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
38
- .then(function (resData) {
39
- if (resData.error) {
40
- throw resData;
41
- }
42
- if (!resData.payload.mercury_payload.threads) {
43
- return callback({ error: "Could not find thread `" + name + "`." });
44
- }
45
- return callback(
46
- null,
47
- resData.payload.mercury_payload.threads.map(utils.formatThread)
48
- );
49
- });
50
-
51
- return returnPromise;
52
- };
53
- };
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('../utils.js');
4
- var log = require('npmlog');
5
-
6
- module.exports = function (http, api, ctx) {
7
- function formatData(res) {
8
- return {
9
- id: res.node.id,
10
- image: res.node.image,
11
- package: res.node.pack != null ? {
12
- name: res.node.pack.name,
13
- id: res.node.pack.id
14
- } : {},
15
- label: res.node.label
16
- };
17
- }
18
-
19
- return function searchStickers(query = '', callback) {
20
- var cb;
21
- var rtPromise = new Promise(function (resolve, reject) {
22
- cb = function (error, data) {
23
- data ? resolve(data) : reject(error);
24
- }
25
- });
26
-
27
- if (typeof callback == 'function') cb = callback;
28
-
29
- var form = {
30
- fb_api_req_friendly_name: 'StickersFlyoutTagSelectorQuery',
31
- variables: JSON.stringify({
32
- stickerWidth: 64,
33
- stickerHeight: 64,
34
- stickerInterface: 'messages',
35
- query
36
- }),
37
- doc_id: '4642836929159953'
38
- }
39
- http
40
- .post('https://www.facebook.com/api/graphql/', ctx.jar, form)
41
- .then(utils.parseAndCheckLogin(ctx, http))
42
- .then(function (res) {
43
- return cb(null, res.data.sticker_search.sticker_results.edges.map(formatData));
44
- })
45
- .catch(function (err) {
46
- log.error('searchStickers', err);
47
- return cb(err);
48
- });
49
-
50
- return rtPromise;
51
- }
52
- }
package/src/seen.js DELETED
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
-
6
- module.exports = function (defaultFuncs, api, ctx) {
7
- return function markAsReadAll(callback) {
8
- let resolveFunc = function () { };
9
- let rejectFunc = function () { };
10
- const 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
- const form = {
25
- folder: 'inbox'
26
- };
27
-
28
- defaultFuncs
29
- .post(
30
- "https://www.facebook.com/ajax/mercury/mark_folder_as_read.php",
31
- ctx.jar,
32
- form
33
- )
34
- .then(utils.saveCookies(ctx.jar))
35
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
- .then(function (resData) {
37
- if (resData.error) {
38
- throw resData;
39
- }
40
-
41
- return callback();
42
- })
43
- .catch(function (err) {
44
- log.error("markAsReadAll", err);
45
- return callback(err);
46
- });
47
-
48
- return returnPromise;
49
- };
50
- };