alicezetion 1.9.2 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. package/package.json +1 -1
  2. package/src/addExternalModule.js +19 -0
  3. package/src/addUserToGroup.js +113 -0
  4. package/src/changeAdminStatus.js +79 -0
  5. package/src/changeArchivedStatus.js +55 -0
  6. package/{leiamnash → src}/changeAvatar.js +2 -3
  7. package/src/changeBio.js +77 -0
  8. package/src/changeBlockedStatus.js +47 -0
  9. package/src/changeGroupImage.js +132 -0
  10. package/src/changeNickname.js +59 -0
  11. package/src/changeThreadColor.js +65 -0
  12. package/src/changeThreadEmoji.js +55 -0
  13. package/{leiamnash → src}/chat.js +29 -4
  14. package/src/createNewGroup.js +86 -0
  15. package/src/createPoll.js +71 -0
  16. package/src/deleteMessage.js +56 -0
  17. package/src/deleteThread.js +56 -0
  18. package/src/edit.js +66 -0
  19. package/src/forwardAttachment.js +60 -0
  20. package/src/getCurrentUserID.js +7 -0
  21. package/src/getEmojiUrl.js +29 -0
  22. package/src/getFriendsList.js +83 -0
  23. package/src/getThreadHistory.js +666 -0
  24. package/src/getThreadInfo.js +232 -0
  25. package/src/getThreadList.js +241 -0
  26. package/src/getThreadPictures.js +79 -0
  27. package/src/getUserID.js +66 -0
  28. package/src/getUserInfo.js +74 -0
  29. package/src/handleFriendRequest.js +61 -0
  30. package/src/handleMessageRequest.js +65 -0
  31. package/src/httpGet.js +57 -0
  32. package/src/httpPost.js +57 -0
  33. package/src/httpPostFormData.js +63 -0
  34. package/src/listenMqtt.js +853 -0
  35. package/src/logout.js +75 -0
  36. package/src/markAsDelivered.js +58 -0
  37. package/src/markAsRead.js +80 -0
  38. package/src/markAsReadAll.js +50 -0
  39. package/src/markAsSeen.js +59 -0
  40. package/src/muteThread.js +52 -0
  41. package/src/react.js +109 -0
  42. package/{leiamnash → src}/refreshFb_dtsg.js +1 -1
  43. package/src/removeUserFromGroup.js +79 -0
  44. package/src/resolvePhotoUrl.js +45 -0
  45. package/src/searchForThread.js +53 -0
  46. package/src/seen.js +50 -0
  47. package/src/sendMessage.js +477 -0
  48. package/src/sendTypingIndicator.js +103 -0
  49. package/src/setMessageReaction.js +121 -0
  50. package/src/setPostReaction.js +109 -0
  51. package/src/setTitle.js +86 -0
  52. package/src/threadColors.js +131 -0
  53. package/src/unfriend.js +52 -0
  54. package/src/unsendMessage.js +49 -0
  55. package/{leiamnash → src}/uploadAttachment.js +1 -2
  56. package/leiamnash/addExternalModule.js +0 -15
  57. package/leiamnash/addUserToGroup.js +0 -77
  58. package/leiamnash/changeAdminStatus.js +0 -47
  59. package/leiamnash/changeArchivedStatus.js +0 -41
  60. package/leiamnash/changeBio.js +0 -64
  61. package/leiamnash/changeBlockedStatus.js +0 -36
  62. package/leiamnash/changeGroupImage.js +0 -105
  63. package/leiamnash/changeNickname.js +0 -43
  64. package/leiamnash/changeThreadColor.js +0 -61
  65. package/leiamnash/changeThreadEmoji.js +0 -41
  66. package/leiamnash/createNewGroup.js +0 -70
  67. package/leiamnash/createPoll.js +0 -59
  68. package/leiamnash/deleteMessage.js +0 -44
  69. package/leiamnash/deleteThread.js +0 -42
  70. package/leiamnash/edit.js +0 -59
  71. package/leiamnash/forwardAttachment.js +0 -47
  72. package/leiamnash/forwardMessage.js +0 -0
  73. package/leiamnash/getCurrentUserID.js +0 -7
  74. package/leiamnash/getEmojiUrl.js +0 -27
  75. package/leiamnash/getFriendsList.js +0 -73
  76. package/leiamnash/getInfoVideo.js +0 -134
  77. package/leiamnash/getThreadHistory.js +0 -537
  78. package/leiamnash/getThreadHistoryDeprecated.js +0 -71
  79. package/leiamnash/getThreadInfo.js +0 -171
  80. package/leiamnash/getThreadInfoDeprecated.js +0 -56
  81. package/leiamnash/getThreadList.js +0 -213
  82. package/leiamnash/getThreadListDeprecated.js +0 -46
  83. package/leiamnash/getThreadPictures.js +0 -59
  84. package/leiamnash/getUserID.js +0 -61
  85. package/leiamnash/getUserInfo.js +0 -66
  86. package/leiamnash/handleFriendRequest.js +0 -46
  87. package/leiamnash/handleMessageRequest.js +0 -47
  88. package/leiamnash/httpGet.js +0 -47
  89. package/leiamnash/httpPost.js +0 -47
  90. package/leiamnash/httpPostFormData.js +0 -42
  91. package/leiamnash/listenMqtt.js +0 -853
  92. package/leiamnash/logout.js +0 -68
  93. package/leiamnash/markAsDelivered.js +0 -47
  94. package/leiamnash/markAsRead.js +0 -70
  95. package/leiamnash/markAsReadAll.js +0 -40
  96. package/leiamnash/markAsSeen.js +0 -48
  97. package/leiamnash/muteThread.js +0 -45
  98. package/leiamnash/react.js +0 -109
  99. package/leiamnash/removeUserFromGroup.js +0 -45
  100. package/leiamnash/resolvePhotoUrl.js +0 -36
  101. package/leiamnash/searchForThread.js +0 -42
  102. package/leiamnash/seen.js +0 -40
  103. package/leiamnash/sendMessage.js +0 -315
  104. package/leiamnash/sendTypingIndicator.js +0 -70
  105. package/leiamnash/setMessageReaction.js +0 -103
  106. package/leiamnash/setPostReaction.js +0 -63
  107. package/leiamnash/setTitle.js +0 -70
  108. package/leiamnash/threadColors.js +0 -41
  109. package/leiamnash/unfriend.js +0 -42
  110. package/leiamnash/unsendMessage.js +0 -39
  111. /package/{leiamnash → src}/getMessage.js +0 -0
@@ -0,0 +1,61 @@
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 handleFriendRequest(userID, accept, callback) {
8
+ if (utils.getType(accept) !== "Boolean") {
9
+ throw {
10
+ error: "Please pass a boolean as a second argument."
11
+ };
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
+ viewer_id: ctx.i_userID || ctx.userID,
32
+ "frefs[0]": "jwl",
33
+ floc: "friend_center_requests",
34
+ ref: "/reqs.php",
35
+ action: (accept ? "confirm" : "reject")
36
+ };
37
+
38
+ defaultFuncs
39
+ .post(
40
+ "https://www.facebook.com/requests/friends/ajax/",
41
+ ctx.jar,
42
+ form
43
+ )
44
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
45
+ .then(function (resData) {
46
+ if (resData.payload.err) {
47
+ throw {
48
+ err: resData.payload.err
49
+ };
50
+ }
51
+
52
+ return callback();
53
+ })
54
+ .catch(function (err) {
55
+ log.error("handleFriendRequest", err);
56
+ return callback(err);
57
+ });
58
+
59
+ return returnPromise;
60
+ };
61
+ };
@@ -0,0 +1,65 @@
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 handleMessageRequest(threadID, accept, callback) {
8
+ if (utils.getType(accept) !== "Boolean") {
9
+ throw {
10
+ error: "Please pass a boolean as a second argument."
11
+ };
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
+ client: "mercury"
32
+ };
33
+
34
+ if (utils.getType(threadID) !== "Array") {
35
+ threadID = [threadID];
36
+ }
37
+
38
+ const messageBox = accept ? "inbox" : "other";
39
+
40
+ for (let i = 0; i < threadID.length; i++) {
41
+ form[messageBox + "[" + i + "]"] = threadID[i];
42
+ }
43
+
44
+ defaultFuncs
45
+ .post(
46
+ "https://www.facebook.com/ajax/mercury/move_thread.php",
47
+ ctx.jar,
48
+ form
49
+ )
50
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
51
+ .then(function (resData) {
52
+ if (resData.error) {
53
+ throw resData;
54
+ }
55
+
56
+ return callback();
57
+ })
58
+ .catch(function (err) {
59
+ log.error("handleMessageRequest", err);
60
+ return callback(err);
61
+ });
62
+
63
+ return returnPromise;
64
+ };
65
+ };
package/src/httpGet.js ADDED
@@ -0,0 +1,57 @@
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 httpGet(url, form, customHeader, callback, notAPI) {
8
+ let resolveFunc = function () { };
9
+ let rejectFunc = function () { };
10
+
11
+ const returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
16
+ if (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction") {
17
+ callback = form;
18
+ form = {};
19
+ }
20
+
21
+ if (utils.getType(customHeader) == "Function" || utils.getType(customHeader) == "AsyncFunction") {
22
+ callback = customHeader;
23
+ customHeader = {};
24
+ }
25
+
26
+ customHeader = customHeader || {};
27
+
28
+ callback = callback || function (err, data) {
29
+ if (err) return rejectFunc(err);
30
+ resolveFunc(data);
31
+ };
32
+
33
+ if (notAPI) {
34
+ utils
35
+ .get(url, ctx.jar, form, ctx.globalOptions, ctx, customHeader)
36
+ .then(function (resData) {
37
+ callback(null, resData.body.toString());
38
+ })
39
+ .catch(function (err) {
40
+ log.error("httpGet", err);
41
+ return callback(err);
42
+ });
43
+ } else {
44
+ defaultFuncs
45
+ .get(url, ctx.jar, form, null, customHeader)
46
+ .then(function (resData) {
47
+ callback(null, resData.body.toString());
48
+ })
49
+ .catch(function (err) {
50
+ log.error("httpGet", err);
51
+ return callback(err);
52
+ });
53
+ }
54
+
55
+ return returnPromise;
56
+ };
57
+ };
@@ -0,0 +1,57 @@
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 httpPost(url, form, customHeader, callback, notAPI) {
8
+ let resolveFunc = function () { };
9
+ let rejectFunc = function () { };
10
+
11
+ const returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
16
+ if (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction") {
17
+ callback = form;
18
+ form = {};
19
+ }
20
+
21
+ if (utils.getType(customHeader) == "Function" || utils.getType(customHeader) == "AsyncFunction") {
22
+ callback = customHeader;
23
+ customHeader = {};
24
+ }
25
+
26
+ customHeader = customHeader || {};
27
+
28
+ callback = callback || function (err, data) {
29
+ if (err) return rejectFunc(err);
30
+ resolveFunc(data);
31
+ };
32
+
33
+ if (notAPI) {
34
+ utils
35
+ .post(url, ctx.jar, form, ctx.globalOptions, ctx, customHeader)
36
+ .then(function (resData) {
37
+ callback(null, resData.body.toString());
38
+ })
39
+ .catch(function (err) {
40
+ log.error("httpPost", err);
41
+ return callback(err);
42
+ });
43
+ } else {
44
+ defaultFuncs
45
+ .post(url, ctx.jar, form, {}, customHeader)
46
+ .then(function (resData) {
47
+ callback(null, resData.body.toString());
48
+ })
49
+ .catch(function (err) {
50
+ log.error("httpPost", err);
51
+ return callback(err);
52
+ });
53
+ }
54
+
55
+ return returnPromise;
56
+ };
57
+ };
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+ const log = require("npmlog");
5
+
6
+
7
+ module.exports = function (defaultFuncs, api, ctx) {
8
+ return function httpPostFormData(url, form, customHeader, callback, notAPI) {
9
+ let resolveFunc = function () { };
10
+ let rejectFunc = function () { };
11
+
12
+ const returnPromise = new Promise(function (resolve, reject) {
13
+ resolveFunc = resolve;
14
+ rejectFunc = reject;
15
+ });
16
+
17
+ if (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction") {
18
+ callback = form;
19
+ form = {};
20
+ }
21
+
22
+ if (utils.getType(customHeader) == "Function" || utils.getType(customHeader) == "AsyncFunction") {
23
+ callback = customHeader;
24
+ customHeader = {};
25
+ }
26
+
27
+ customHeader = customHeader || {};
28
+
29
+ if (utils.getType(callback) == "Boolean") {
30
+ notAPI = callback;
31
+ callback = null;
32
+ }
33
+
34
+ callback = callback || function (err, data) {
35
+ if (err) return rejectFunc(err);
36
+ resolveFunc(data);
37
+ };
38
+
39
+ if (notAPI) {
40
+ utils
41
+ .postFormData(url, ctx.jar, form, ctx.globalOptions, ctx, customHeader)
42
+ .then(function (resData) {
43
+ callback(null, resData.body.toString());
44
+ })
45
+ .catch(function (err) {
46
+ log.error("httpPostFormData", err);
47
+ return callback(err);
48
+ });
49
+ } else {
50
+ defaultFuncs
51
+ .postFormData(url, ctx.jar, form, null, customHeader)
52
+ .then(function (resData) {
53
+ callback(null, resData.body.toString());
54
+ })
55
+ .catch(function (err) {
56
+ log.error("httpPostFormData", err);
57
+ return callback(err);
58
+ });
59
+ }
60
+
61
+ return returnPromise;
62
+ };
63
+ };