node-ainzfb-new 1.6.1-test → 1.6.32-stable
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 +2 -3
- 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 +91 -0
- 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/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/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 +8 -7
- package/src/getUserInfo.js +12 -9
- 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 +18 -19
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
|
+
};
|