node-ainzfb-new 1.6.2902-test → 1.6.2911-test
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +7 -7
- package/src/addExternalModule.js +13 -6
- package/src/addUserToGroup.js +35 -12
- package/src/changeAdminStatus.js +32 -16
- package/src/changeArchivedStatus.js +15 -9
- package/src/changeAvt.js +75 -69
- package/src/changeBio.js +12 -8
- package/src/changeBlockedStatus.js +14 -8
- package/src/changeGroupImage.js +27 -13
- package/src/changeNickname.js +19 -10
- package/src/changeThreadColor.js +15 -10
- package/src/changeThreadEmoji.js +17 -9
- package/src/createNewGroup.js +18 -10
- package/src/createPoll.js +16 -11
- package/src/deleteMessage.js +16 -10
- package/src/deleteThread.js +16 -10
- package/src/forwardAttachment.js +14 -9
- package/src/getAccessToken.js +21 -21
- package/src/getCurrentUserID.js +1 -1
- package/src/getEmojiUrl.js +3 -2
- package/src/getFriendsList.js +18 -10
- package/src/getMessage.js +52 -48
- package/src/getThreadHistory.js +156 -59
- package/src/getThreadHistoryDeprecated.js +26 -15
- package/src/getThreadInfo.js +3423 -18
- package/src/getThreadInfoDeprecated.js +25 -13
- package/src/getThreadList.js +112 -53
- package/src/getThreadListDeprecated.js +30 -12
- package/src/getThreadPictures.js +25 -13
- package/src/getUserID.js +7 -7
- package/src/getUserInfo.js +12 -9
- package/src/getUserInfoV2.js +19 -22
- package/src/handleFriendRequest.js +10 -9
- package/src/handleMessageRequest.js +16 -10
- package/src/httpGet.js +18 -13
- package/src/httpPost.js +18 -13
- package/src/httpPostFormData.js +14 -9
- package/src/listenMqtt.js +1218 -571
- package/src/logout.js +18 -13
- package/src/markAsDelivered.js +16 -10
- package/src/markAsRead.js +36 -24
- package/src/markAsReadAll.js +14 -10
- package/src/markAsSeen.js +18 -11
- package/src/muteThread.js +12 -8
- package/src/removeUserFromGroup.js +33 -10
- package/src/resolvePhotoUrl.js +8 -6
- package/src/searchForThread.js +13 -8
- package/src/sendMessage.js +172 -78
- package/src/sendTypingIndicator.js +29 -14
- package/src/setMessageReaction.js +13 -8
- package/src/setPostReaction.js +97 -95
- package/src/setTitle.js +18 -12
- package/src/threadColors.js +17 -17
- package/src/unfriend.js +14 -9
- package/src/unsendMessage.js +7 -7
- package/utils.js +2 -2
@@ -3,19 +3,20 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
7
|
return function handleFriendRequest(userID, accept, callback) {
|
8
|
-
if (utils.getType(accept) !== "Boolean")
|
8
|
+
if (utils.getType(accept) !== "Boolean")
|
9
|
+
throw { error: "Please pass a boolean as a second argument." };
|
9
10
|
|
10
|
-
var resolveFunc = function
|
11
|
-
var rejectFunc = function
|
12
|
-
var returnPromise = new Promise(function
|
11
|
+
var resolveFunc = function() {};
|
12
|
+
var rejectFunc = function() {};
|
13
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
13
14
|
resolveFunc = resolve;
|
14
15
|
rejectFunc = reject;
|
15
16
|
});
|
16
17
|
|
17
18
|
if (!callback) {
|
18
|
-
callback = function
|
19
|
+
callback = function(err, data) {
|
19
20
|
if (err) return rejectFunc(err);
|
20
21
|
resolveFunc(data);
|
21
22
|
};
|
@@ -26,17 +27,17 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
26
27
|
"frefs[0]": "jwl",
|
27
28
|
floc: "friend_center_requests",
|
28
29
|
ref: "/reqs.php",
|
29
|
-
action:
|
30
|
+
action: accept ? "confirm" : "reject"
|
30
31
|
};
|
31
32
|
|
32
33
|
defaultFuncs
|
33
34
|
.post("https://www.facebook.com/requests/friends/ajax/", ctx.jar, form)
|
34
35
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
35
|
-
.then(function
|
36
|
+
.then(function(resData) {
|
36
37
|
if (resData.payload.err) throw { err: resData.payload.err };
|
37
38
|
return callback();
|
38
39
|
})
|
39
|
-
.catch(function
|
40
|
+
.catch(function(err) {
|
40
41
|
log.error("handleFriendRequest", err);
|
41
42
|
return callback(err);
|
42
43
|
});
|
@@ -3,19 +3,20 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
7
|
return function handleMessageRequest(threadID, accept, callback) {
|
8
|
-
if (utils.getType(accept) !== "Boolean")
|
8
|
+
if (utils.getType(accept) !== "Boolean")
|
9
|
+
throw { error: "Please pass a boolean as a second argument." };
|
9
10
|
|
10
|
-
var resolveFunc = function
|
11
|
-
var rejectFunc = function
|
12
|
-
var returnPromise = new Promise(function
|
11
|
+
var resolveFunc = function() {};
|
12
|
+
var rejectFunc = function() {};
|
13
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
13
14
|
resolveFunc = resolve;
|
14
15
|
rejectFunc = reject;
|
15
16
|
});
|
16
17
|
|
17
18
|
if (!callback) {
|
18
|
-
callback = function
|
19
|
+
callback = function(err, data) {
|
19
20
|
if (err) return rejectFunc(err);
|
20
21
|
resolveFunc(data);
|
21
22
|
};
|
@@ -29,17 +30,22 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
29
30
|
|
30
31
|
var messageBox = accept ? "inbox" : "other";
|
31
32
|
|
32
|
-
for (var i = 0; i < threadID.length; i++)
|
33
|
+
for (var i = 0; i < threadID.length; i++)
|
34
|
+
form[messageBox + "[" + i + "]"] = threadID[i];
|
33
35
|
|
34
36
|
defaultFuncs
|
35
|
-
.post(
|
37
|
+
.post(
|
38
|
+
"https://www.facebook.com/ajax/mercury/move_thread.php",
|
39
|
+
ctx.jar,
|
40
|
+
form
|
41
|
+
)
|
36
42
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
37
|
-
.then(function
|
43
|
+
.then(function(resData) {
|
38
44
|
if (resData.error) throw resData;
|
39
45
|
|
40
46
|
return callback();
|
41
47
|
})
|
42
|
-
.catch(function
|
48
|
+
.catch(function(err) {
|
43
49
|
log.error("handleMessageRequest", err);
|
44
50
|
return callback(err);
|
45
51
|
});
|
package/src/httpGet.js
CHANGED
@@ -3,42 +3,47 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
7
|
return function httpGet(url, form, callback, notAPI) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
8
|
+
var resolveFunc = function() {};
|
9
|
+
var rejectFunc = function() {};
|
10
10
|
|
11
|
-
var returnPromise = new Promise(function
|
11
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
13
13
|
rejectFunc = reject;
|
14
14
|
});
|
15
15
|
|
16
|
-
if (
|
16
|
+
if (
|
17
|
+
!callback &&
|
18
|
+
(utils.getType(form) == "Function" ||
|
19
|
+
utils.getType(form) == "AsyncFunction")
|
20
|
+
) {
|
17
21
|
callback = form;
|
18
22
|
form = {};
|
19
23
|
}
|
20
24
|
|
21
25
|
form = form || {};
|
22
26
|
|
23
|
-
callback =
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
callback =
|
28
|
+
callback ||
|
29
|
+
function(err, data) {
|
30
|
+
if (err) return rejectFunc(err);
|
31
|
+
resolveFunc(data);
|
32
|
+
};
|
27
33
|
|
28
34
|
if (notAPI) {
|
29
35
|
utils
|
30
36
|
.get(url, ctx.jar, form, ctx.globalOptions)
|
31
37
|
.then(resData => callback(null, resData.body.toString()))
|
32
|
-
.catch(function
|
38
|
+
.catch(function(err) {
|
33
39
|
log.error("httpGet", err);
|
34
40
|
return callback(err);
|
35
41
|
});
|
36
|
-
}
|
37
|
-
else {
|
42
|
+
} else {
|
38
43
|
defaultFuncs
|
39
44
|
.get(url, ctx.jar, form)
|
40
45
|
.then(resData => callback(null, resData.body.toString()))
|
41
|
-
.catch(function
|
46
|
+
.catch(function(err) {
|
42
47
|
log.error("httpGet", err);
|
43
48
|
return callback(err);
|
44
49
|
});
|
package/src/httpPost.js
CHANGED
@@ -3,42 +3,47 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
7
|
return function httpGet(url, form, callback, notAPI) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
8
|
+
var resolveFunc = function() {};
|
9
|
+
var rejectFunc = function() {};
|
10
10
|
|
11
|
-
var returnPromise = new Promise(function
|
11
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
13
13
|
rejectFunc = reject;
|
14
14
|
});
|
15
15
|
|
16
|
-
if (
|
16
|
+
if (
|
17
|
+
!callback &&
|
18
|
+
(utils.getType(form) == "Function" ||
|
19
|
+
utils.getType(form) == "AsyncFunction")
|
20
|
+
) {
|
17
21
|
callback = form;
|
18
22
|
form = {};
|
19
23
|
}
|
20
24
|
|
21
25
|
form = form || {};
|
22
26
|
|
23
|
-
callback =
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
callback =
|
28
|
+
callback ||
|
29
|
+
function(err, data) {
|
30
|
+
if (err) return rejectFunc(err);
|
31
|
+
resolveFunc(data);
|
32
|
+
};
|
27
33
|
|
28
34
|
if (notAPI) {
|
29
35
|
utils
|
30
36
|
.post(url, ctx.jar, form, ctx.globalOptions)
|
31
37
|
.then(resData => callback(null, resData.body.toString()))
|
32
|
-
.catch(function
|
38
|
+
.catch(function(err) {
|
33
39
|
log.error("httpPost", err);
|
34
40
|
return callback(err);
|
35
41
|
});
|
36
|
-
}
|
37
|
-
else {
|
42
|
+
} else {
|
38
43
|
defaultFuncs
|
39
44
|
.post(url, ctx.jar, form, {})
|
40
45
|
.then(resData => callback(null, resData.body.toString()))
|
41
|
-
.catch(function
|
46
|
+
.catch(function(err) {
|
42
47
|
log.error("httpPost", err);
|
43
48
|
return callback(err);
|
44
49
|
});
|
package/src/httpPostFormData.js
CHANGED
@@ -5,26 +5,31 @@ var log = require("npmlog");
|
|
5
5
|
|
6
6
|
module.exports = function(defaultFuncs, api, ctx) {
|
7
7
|
return function httpPostFormData(url, form, callback) {
|
8
|
-
var resolveFunc = function(){};
|
9
|
-
var rejectFunc = function(){};
|
8
|
+
var resolveFunc = function() {};
|
9
|
+
var rejectFunc = function() {};
|
10
10
|
|
11
|
-
var returnPromise = new Promise(function
|
11
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
13
13
|
rejectFunc = reject;
|
14
14
|
});
|
15
15
|
|
16
|
-
if (
|
16
|
+
if (
|
17
|
+
!callback &&
|
18
|
+
(utils.getType(form) == "Function" ||
|
19
|
+
utils.getType(form) == "AsyncFunction")
|
20
|
+
) {
|
17
21
|
callback = form;
|
18
22
|
form = {};
|
19
23
|
}
|
20
24
|
|
21
25
|
form = form || {};
|
22
|
-
|
23
|
-
|
24
|
-
|
26
|
+
|
27
|
+
callback =
|
28
|
+
callback ||
|
29
|
+
function(err, data) {
|
25
30
|
if (err) return rejectFunc(err);
|
26
31
|
resolveFunc(data);
|
27
|
-
|
32
|
+
};
|
28
33
|
|
29
34
|
defaultFuncs
|
30
35
|
.postFormData(url, ctx.jar, form)
|
@@ -38,4 +43,4 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
38
43
|
|
39
44
|
return returnPromise;
|
40
45
|
};
|
41
|
-
};
|
46
|
+
};
|