node-ainzfb-new 1.6.32-stable → 1.6.2431-test
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +1 -1
- package/package.json +3 -4
- package/src/addExternalModule.js +6 -13
- package/src/addUserToGroup.js +12 -35
- package/src/changeAdminStatus.js +16 -32
- package/src/changeArchivedStatus.js +9 -15
- package/src/changeAvt.js +34 -40
- package/src/changeBio.js +8 -12
- package/src/changeBlockedStatus.js +8 -14
- package/src/changeGroupImage.js +13 -27
- package/src/changeNickname.js +10 -19
- package/src/changeThreadColor.js +10 -15
- package/src/changeThreadEmoji.js +9 -17
- package/src/createNewGroup.js +10 -18
- package/src/createPoll.js +11 -16
- package/src/deleteMessage.js +10 -16
- package/src/deleteThread.js +10 -16
- package/src/forwardAttachment.js +9 -14
- package/src/getCurrentUserID.js +1 -1
- package/src/getEmojiUrl.js +2 -3
- package/src/getFriendsList.js +10 -18
- package/src/getMessage.js +48 -52
- package/src/getThreadHistory.js +59 -156
- package/src/getThreadHistoryDeprecated.js +15 -26
- package/src/getThreadInfoDeprecated.js +13 -25
- package/src/getThreadList.js +53 -112
- package/src/getThreadListDeprecated.js +12 -30
- package/src/getThreadPictures.js +13 -25
- package/src/getUserID.js +7 -8
- package/src/getUserInfo.js +9 -12
- package/src/handleFriendRequest.js +9 -10
- package/src/handleMessageRequest.js +10 -16
- package/src/httpGet.js +13 -18
- package/src/httpPost.js +13 -18
- package/src/httpPostFormData.js +9 -14
- package/src/listenMqtt.js +571 -1218
- package/src/logout.js +13 -18
- package/src/markAsDelivered.js +10 -16
- package/src/markAsRead.js +24 -36
- package/src/markAsReadAll.js +10 -14
- package/src/markAsSeen.js +11 -18
- package/src/muteThread.js +8 -12
- package/src/removeUserFromGroup.js +10 -33
- package/src/resolvePhotoUrl.js +6 -8
- package/src/searchForThread.js +8 -13
- package/src/sendMessage.js +78 -172
- package/src/sendTypingIndicator.js +14 -29
- package/src/setMessageReaction.js +8 -13
- package/src/setPostReaction.js +95 -97
- package/src/setTitle.js +12 -18
- package/src/threadColors.js +17 -17
- package/src/unfriend.js +9 -14
- package/src/unsendMessage.js +7 -7
- package/utils.js +19 -18
package/src/httpGet.js
CHANGED
@@ -3,47 +3,42 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
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(resolve, reject) {
|
11
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
13
13
|
rejectFunc = reject;
|
14
14
|
});
|
15
15
|
|
16
|
-
if (
|
17
|
-
!callback &&
|
18
|
-
(utils.getType(form) == "Function" ||
|
19
|
-
utils.getType(form) == "AsyncFunction")
|
20
|
-
) {
|
16
|
+
if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
|
21
17
|
callback = form;
|
22
18
|
form = {};
|
23
19
|
}
|
24
20
|
|
25
21
|
form = form || {};
|
26
22
|
|
27
|
-
callback =
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
resolveFunc(data);
|
32
|
-
};
|
23
|
+
callback = callback || function (err, data) {
|
24
|
+
if (err) return rejectFunc(err);
|
25
|
+
resolveFunc(data);
|
26
|
+
};
|
33
27
|
|
34
28
|
if (notAPI) {
|
35
29
|
utils
|
36
30
|
.get(url, ctx.jar, form, ctx.globalOptions)
|
37
31
|
.then(resData => callback(null, resData.body.toString()))
|
38
|
-
.catch(function(err) {
|
32
|
+
.catch(function (err) {
|
39
33
|
log.error("httpGet", err);
|
40
34
|
return callback(err);
|
41
35
|
});
|
42
|
-
}
|
36
|
+
}
|
37
|
+
else {
|
43
38
|
defaultFuncs
|
44
39
|
.get(url, ctx.jar, form)
|
45
40
|
.then(resData => callback(null, resData.body.toString()))
|
46
|
-
.catch(function(err) {
|
41
|
+
.catch(function (err) {
|
47
42
|
log.error("httpGet", err);
|
48
43
|
return callback(err);
|
49
44
|
});
|
package/src/httpPost.js
CHANGED
@@ -3,47 +3,42 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
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(resolve, reject) {
|
11
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
13
13
|
rejectFunc = reject;
|
14
14
|
});
|
15
15
|
|
16
|
-
if (
|
17
|
-
!callback &&
|
18
|
-
(utils.getType(form) == "Function" ||
|
19
|
-
utils.getType(form) == "AsyncFunction")
|
20
|
-
) {
|
16
|
+
if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
|
21
17
|
callback = form;
|
22
18
|
form = {};
|
23
19
|
}
|
24
20
|
|
25
21
|
form = form || {};
|
26
22
|
|
27
|
-
callback =
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
resolveFunc(data);
|
32
|
-
};
|
23
|
+
callback = callback || function (err, data) {
|
24
|
+
if (err) return rejectFunc(err);
|
25
|
+
resolveFunc(data);
|
26
|
+
};
|
33
27
|
|
34
28
|
if (notAPI) {
|
35
29
|
utils
|
36
30
|
.post(url, ctx.jar, form, ctx.globalOptions)
|
37
31
|
.then(resData => callback(null, resData.body.toString()))
|
38
|
-
.catch(function(err) {
|
32
|
+
.catch(function (err) {
|
39
33
|
log.error("httpPost", err);
|
40
34
|
return callback(err);
|
41
35
|
});
|
42
|
-
}
|
36
|
+
}
|
37
|
+
else {
|
43
38
|
defaultFuncs
|
44
39
|
.post(url, ctx.jar, form, {})
|
45
40
|
.then(resData => callback(null, resData.body.toString()))
|
46
|
-
.catch(function(err) {
|
41
|
+
.catch(function (err) {
|
47
42
|
log.error("httpPost", err);
|
48
43
|
return callback(err);
|
49
44
|
});
|
package/src/httpPostFormData.js
CHANGED
@@ -5,31 +5,26 @@ 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(resolve, reject) {
|
11
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
13
13
|
rejectFunc = reject;
|
14
14
|
});
|
15
15
|
|
16
|
-
if (
|
17
|
-
!callback &&
|
18
|
-
(utils.getType(form) == "Function" ||
|
19
|
-
utils.getType(form) == "AsyncFunction")
|
20
|
-
) {
|
16
|
+
if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
|
21
17
|
callback = form;
|
22
18
|
form = {};
|
23
19
|
}
|
24
20
|
|
25
21
|
form = form || {};
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
function(err, data) {
|
22
|
+
|
23
|
+
|
24
|
+
callback = callback || function(err, data) {
|
30
25
|
if (err) return rejectFunc(err);
|
31
26
|
resolveFunc(data);
|
32
|
-
|
27
|
+
};
|
33
28
|
|
34
29
|
defaultFuncs
|
35
30
|
.postFormData(url, ctx.jar, form)
|
@@ -43,4 +38,4 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
43
38
|
|
44
39
|
return returnPromise;
|
45
40
|
};
|
46
|
-
};
|
41
|
+
};
|