alicezetion 1.0.9 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) 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 +558 -490
  4. package/leiamnash/addExternalModule.js +19 -0
  5. package/{src → leiamnash}/addUserToGroup.js +52 -16
  6. package/leiamnash/changeAdminStatus.js +79 -0
  7. package/leiamnash/changeArchivedStatus.js +55 -0
  8. package/{src → leiamnash}/changeBio.js +19 -6
  9. package/{src → leiamnash}/changeBlockedStatus.js +14 -3
  10. package/{src → leiamnash}/changeGroupImage.js +40 -16
  11. package/leiamnash/changeNickname.js +59 -0
  12. package/{src → leiamnash}/changeThreadColor.js +20 -10
  13. package/leiamnash/changeThreadEmoji.js +55 -0
  14. package/leiamnash/chat.js +459 -0
  15. package/{src → leiamnash}/createNewGroup.js +28 -12
  16. package/{src → leiamnash}/createPoll.js +25 -13
  17. package/leiamnash/deleteMessage.js +56 -0
  18. package/leiamnash/deleteThread.js +56 -0
  19. package/leiamnash/forwardAttachment.js +60 -0
  20. package/{src → leiamnash}/getCurrentUserID.js +1 -1
  21. package/{src → leiamnash}/getEmojiUrl.js +4 -2
  22. package/{src → leiamnash}/getFriendsList.js +21 -10
  23. package/{src → leiamnash}/getThreadHistory.js +166 -58
  24. package/{src → leiamnash}/getThreadHistoryDeprecated.js +42 -20
  25. package/{src → leiamnash}/getThreadInfo.js +60 -25
  26. package/leiamnash/getThreadInfoDeprecated.js +80 -0
  27. package/{src → leiamnash}/getThreadList.js +66 -41
  28. package/leiamnash/getThreadListDeprecated.js +75 -0
  29. package/leiamnash/getThreadPictures.js +79 -0
  30. package/{src → leiamnash}/getUserID.js +14 -9
  31. package/{src → leiamnash}/getUserInfo.js +18 -12
  32. package/leiamnash/handleFriendRequest.js +61 -0
  33. package/leiamnash/handleMessageRequest.js +65 -0
  34. package/{src → leiamnash}/httpGet.js +17 -12
  35. package/{src → leiamnash}/httpPost.js +17 -12
  36. package/leiamnash/listenMqtt.js +687 -0
  37. package/{src → leiamnash}/logout.js +20 -13
  38. package/{src → leiamnash}/markAsDelivered.js +22 -11
  39. package/{src → leiamnash}/markAsRead.js +21 -11
  40. package/{src → leiamnash}/markAsReadAll.js +20 -10
  41. package/{src → leiamnash}/markAsSeen.js +18 -7
  42. package/{src → leiamnash}/muteThread.js +18 -11
  43. package/leiamnash/removeUserFromGroup.js +79 -0
  44. package/{src → leiamnash}/resolvePhotoUrl.js +17 -8
  45. package/{src → leiamnash}/searchForThread.js +21 -10
  46. package/{src → leiamnash}/sendTypingIndicator.js +47 -14
  47. package/{src → leiamnash}/setMessageReaction.js +26 -12
  48. package/{src → leiamnash}/setPostReaction.js +26 -13
  49. package/{src → leiamnash}/setTitle.js +29 -13
  50. package/leiamnash/threadColors.js +57 -0
  51. package/{src → leiamnash}/unfriend.js +19 -9
  52. package/{src → leiamnash}/unsendMessage.js +19 -9
  53. package/package.json +9 -14
  54. package/replit.nix +0 -1
  55. package/utils.js +1193 -1023
  56. package/src/addExternalModule.js +0 -15
  57. package/src/changeAdminStatus.js +0 -47
  58. package/src/changeArchivedStatus.js +0 -41
  59. package/src/changeNickname.js +0 -43
  60. package/src/changeThreadEmoji.js +0 -41
  61. package/src/chat.js +0 -315
  62. package/src/deleteMessage.js +0 -44
  63. package/src/deleteThread.js +0 -42
  64. package/src/forwardAttachment.js +0 -47
  65. package/src/forwardMessage.js +0 -0
  66. package/src/getThreadInfoDeprecated.js +0 -56
  67. package/src/getThreadListDeprecated.js +0 -46
  68. package/src/getThreadPictures.js +0 -59
  69. package/src/handleFriendRequest.js +0 -46
  70. package/src/handleMessageRequest.js +0 -47
  71. package/src/listen.js +0 -553
  72. package/src/listenMqtt-Test.js +0 -687
  73. package/src/listenMqtt.js +0 -677
  74. package/src/removeUserFromGroup.js +0 -45
  75. package/src/threadColors.js +0 -41
@@ -1,56 +0,0 @@
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 getThreadInfo(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, data) {
17
- if (err) return rejectFunc(err);
18
- resolveFunc(data);
19
- };
20
- }
21
-
22
- var form = {
23
- client: "mercury"
24
- };
25
-
26
- api.getUserInfo(threadID, function (err, userRes) {
27
- if (err) return callback(err);
28
- var key = Object.keys(userRes).length > 0 ? "user_ids" : "thread_fbids";
29
- form["threads[" + key + "][0]"] = threadID;
30
-
31
- if (ctx.globalOptions.pageId) form.request_user_id = ctx.globalOptions.pageId;
32
-
33
- defaultFuncs
34
- .post("https://www.facebook.com/ajax/mercury/thread_info.php", ctx.jar, form)
35
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
- .then(function (resData) {
37
- if (resData.error) throw resData;
38
- else if (!resData.payload) throw { error: "Could not retrieve thread Info." };
39
-
40
- var threadData = resData.payload.threads[0];
41
- var userData = userRes[threadID];
42
-
43
- if (threadData == null) throw { error: "ThreadData is null" };
44
-
45
- threadData.name = userData != null && userData.name != null ? userData.name : threadData.name;
46
- threadData.image_src = userData != null && userData.thumbSrc != null ? userData.thumbSrc : threadData.image_src;
47
- callback(null, utils.formatThread(threadData));
48
- })
49
- .catch(function (err) {
50
- log.error("getThreadInfo", err);
51
- return callback(err);
52
- });
53
- });
54
- return returnPromise;
55
- };
56
- };
@@ -1,46 +0,0 @@
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 getThreadList(start, end, type, callback) {
8
- if (utils.getType(callback) === "Undefined") {
9
- if (utils.getType(end) !== "Number") throw { error: "Please pass a number as a second argument." };
10
- else if (utils.getType(type) === "Function" || utils.getType(type) === "AsyncFunction") {
11
- callback = type;
12
- type = "inbox"; //default to inbox
13
- }
14
- else if (utils.getType(type) !== "String") throw { error: "Please pass a String as a third argument. Your options are: inbox, pending, and archived" };
15
- else throw { error: "getThreadList: need callback" };
16
- }
17
-
18
- if (type === "archived") type = "action:archived";
19
- else if (type !== "inbox" && type !== "pending" && type !== "other") throw { error: "type can only be one of the following: inbox, pending, archived, other" };
20
-
21
-
22
- if (end <= start) end = start + 20;
23
-
24
- var form = {
25
- client: "mercury"
26
- };
27
-
28
- form[type + "[offset]"] = start;
29
- form[type + "[limit]"] = end - start;
30
-
31
- if (ctx.globalOptions.pageID) form.request_user_id = ctx.globalOptions.pageID;
32
-
33
- defaultFuncs
34
- .post("https://www.facebook.com/ajax/mercury/threadlist_info.php", ctx.jar, form)
35
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
- .then(function (resData) {
37
- if (resData.error) throw resData;
38
- log.verbose("getThreadList", JSON.stringify(resData.payload.threads));
39
- return callback(null, (resData.payload.threads || []).map(utils.formatThread));
40
- })
41
- .catch(function (err) {
42
- log.error("getThreadList", err);
43
- return callback(err);
44
- });
45
- };
46
- };
@@ -1,59 +0,0 @@
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 getThreadPictures(threadID, offset, limit, 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 form = {
23
- thread_id: threadID,
24
- offset: offset,
25
- limit: limit
26
- };
27
-
28
- defaultFuncs
29
- .post("https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php", ctx.jar, form)
30
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
31
- .then(function (resData) {
32
- if (resData.error) throw resData;
33
- return Promise.all(
34
- resData.payload.imagesData.map(function (image) {
35
- form = {
36
- thread_id: threadID,
37
- image_id: image.fbid
38
- };
39
- return defaultFuncs
40
- .post("https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php", ctx.jar, form)
41
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
42
- .then(function (resData) {
43
- if (resData.error) throw resData;
44
- // the response is pretty messy
45
- var queryThreadID = resData.jsmods.require[0][3][1].query_metadata.query_path[0].message_thread;
46
- var imageData = resData.jsmods.require[0][3][1].query_results[queryThreadID].message_images.edges[0].node.image2;
47
- return imageData;
48
- });
49
- })
50
- );
51
- })
52
- .then(resData => callback(null, resData))
53
- .catch(function (err) {
54
- log.error("Error in getThreadPictures", err);
55
- callback(err);
56
- });
57
- return returnPromise;
58
- };
59
- };
@@ -1,46 +0,0 @@
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 handleFriendRequest(userID, accept, callback) {
8
- if (utils.getType(accept) !== "Boolean") throw { error: "Please pass a boolean as a second argument." };
9
-
10
- var resolveFunc = function() {};
11
- var rejectFunc = function() {};
12
- var returnPromise = new Promise(function(resolve, reject) {
13
- resolveFunc = resolve;
14
- rejectFunc = reject;
15
- });
16
-
17
- if (!callback) {
18
- callback = function(err, data) {
19
- if (err) return rejectFunc(err);
20
- resolveFunc(data);
21
- };
22
- }
23
-
24
- var form = {
25
- viewer_id: userID,
26
- "frefs[0]": "jwl",
27
- floc: "friend_center_requests",
28
- ref: "/reqs.php",
29
- action: (accept ? "confirm" : "reject")
30
- };
31
-
32
- defaultFuncs
33
- .post("https://www.facebook.com/requests/friends/ajax/", ctx.jar, form)
34
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
- .then(function(resData) {
36
- if (resData.payload.err) throw { err: resData.payload.err };
37
- return callback();
38
- })
39
- .catch(function(err) {
40
- log.error("handleFriendRequest", err);
41
- return callback(err);
42
- });
43
-
44
- return returnPromise;
45
- };
46
- };
@@ -1,47 +0,0 @@
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 handleMessageRequest(threadID, accept, callback) {
8
- if (utils.getType(accept) !== "Boolean") throw { error: "Please pass a boolean as a second argument." };
9
-
10
- var resolveFunc = function () { };
11
- var rejectFunc = function () { };
12
- var returnPromise = new Promise(function (resolve, reject) {
13
- resolveFunc = resolve;
14
- rejectFunc = reject;
15
- });
16
-
17
- if (!callback) {
18
- callback = function (err, data) {
19
- if (err) return rejectFunc(err);
20
- resolveFunc(data);
21
- };
22
- }
23
-
24
- var form = {
25
- client: "mercury"
26
- };
27
-
28
- if (utils.getType(threadID) !== "Array") threadID = [threadID];
29
-
30
- var messageBox = accept ? "inbox" : "other";
31
- for (var i = 0; i < threadID.length; i++) form[messageBox + "[" + i + "]"] = threadID[i];
32
-
33
- defaultFuncs
34
- .post("https://www.facebook.com/ajax/mercury/move_thread.php", ctx.jar, form)
35
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
- .then(function (resData) {
37
- if (resData.error) throw resData;
38
- return callback();
39
- })
40
- .catch(function (err) {
41
- log.error("handleMessageRequest", err);
42
- return callback(err);
43
- });
44
-
45
- return returnPromise;
46
- };
47
- };