alicezetion 1.7.6 → 1.7.8
Sign up to get free protection for your applications and to get access to all the features.
- package/.cache/replit/__replit_disk_meta.json +1 -1
- package/.cache/replit/nix/env.json +1 -1
- package/.travis.yml +6 -0
- package/index.js +118 -654
- package/package.json +25 -37
- package/replit.nix +4 -3
- package/src/addExternalModule.js +5 -13
- package/src/addUserToGroup.js +12 -36
- package/src/changeAdminStatus.js +37 -85
- package/src/changeArchivedStatus.js +9 -15
- package/src/changeBio.js +8 -13
- package/src/changeBlockedStatus.js +8 -14
- package/src/changeGroupImage.js +13 -28
- package/src/changeNickname.js +11 -22
- package/src/changeThreadColor.js +10 -16
- package/src/changeThreadEmoji.js +9 -18
- package/src/chat.js +280 -401
- package/src/createNewGroup.js +10 -18
- package/src/createPoll.js +11 -17
- package/src/deleteMessage.js +10 -17
- package/src/deleteThread.js +10 -17
- package/src/forwardAttachment.js +9 -15
- package/src/forwardMessage.js +0 -0
- package/src/getCurrentUserID.js +1 -1
- package/src/getEmojiUrl.js +2 -3
- package/src/getFriendsList.js +10 -18
- package/src/getThreadHistory.js +59 -156
- package/src/getThreadHistoryDeprecated.js +15 -26
- package/src/getThreadInfo.js +42 -68
- 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 -9
- package/src/getUserInfo.js +10 -12
- package/src/handleFriendRequest.js +35 -36
- package/src/handleMessageRequest.js +10 -18
- package/src/httpGet.js +13 -20
- package/src/httpPost.js +13 -19
- package/src/{sendTypingIndicator.js → leiamnash.js} +19 -44
- package/src/listen.js +553 -0
- package/src/listenMqtt-Test.js +687 -0
- package/src/listenMqtt.js +621 -1224
- package/src/logout.js +13 -18
- package/src/markAsDelivered.js +10 -17
- package/src/markAsRead.js +24 -36
- package/src/markAsSeen.js +12 -22
- package/src/muteThread.js +9 -15
- package/src/react.js +9 -20
- package/src/removeUserFromGroup.js +11 -38
- package/src/resolvePhotoUrl.js +6 -9
- package/src/searchForThread.js +8 -14
- package/src/seen.js +10 -17
- package/src/setPostReaction.js +22 -63
- package/src/setTitle.js +12 -22
- package/src/threadColors.js +19 -17
- package/src/unfriend.js +9 -15
- package/src/{unsend.js → unsendMessage.js} +8 -9
- package/test/data/shareAttach.js +146 -0
- package/test/data/something.mov +0 -0
- package/test/data/test.png +0 -0
- package/test/data/test.txt +7 -0
- package/test/example-config.json +18 -0
- package/test/test-page.js +140 -0
- package/test/test.js +385 -0
- package/utils.js +27 -120
- package/Extra/Database/index.js +0 -399
- package/Extra/Database/methods.js +0 -286
- package/Extra/ExtraAddons.js +0 -213
- package/Extra/ExtraGetThread.js +0 -1
- package/Extra/ExtraUptimeRobot.js +0 -59
- package/Extra/PM2/ecosystem.config.js +0 -23
- package/Extra/Src/Last-Run.js +0 -48
- package/Language/index.json +0 -151
- package/StateCrypt.js +0 -22
- package/broadcast.js +0 -42
- package/logger.js +0 -21
- package/src/changeAvt.js +0 -91
- package/src/getAccessToken.js +0 -32
- package/src/getMessage.js +0 -84
- package/src/getUserInfoV2.js +0 -35
- package/src/httpPostFormData.js +0 -46
package/src/httpGet.js
CHANGED
@@ -3,52 +3,45 @@
|
|
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
|
-
|
25
20
|
form = form || {};
|
26
21
|
|
27
|
-
callback =
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
resolveFunc(data);
|
32
|
-
};
|
22
|
+
callback = callback || function (err, data) {
|
23
|
+
if (err) return rejectFunc(err);
|
24
|
+
resolveFunc(data);
|
25
|
+
};
|
33
26
|
|
34
27
|
if (notAPI) {
|
35
28
|
utils
|
36
29
|
.get(url, ctx.jar, form, ctx.globalOptions)
|
37
30
|
.then(resData => callback(null, resData.body.toString()))
|
38
|
-
.catch(function(err) {
|
31
|
+
.catch(function (err) {
|
39
32
|
log.error("httpGet", err);
|
40
33
|
return callback(err);
|
41
34
|
});
|
42
|
-
}
|
35
|
+
}
|
36
|
+
else {
|
43
37
|
defaultFuncs
|
44
38
|
.get(url, ctx.jar, form)
|
45
39
|
.then(resData => callback(null, resData.body.toString()))
|
46
|
-
.catch(function(err) {
|
40
|
+
.catch(function (err) {
|
47
41
|
log.error("httpGet", err);
|
48
42
|
return callback(err);
|
49
43
|
});
|
50
44
|
}
|
51
|
-
|
52
45
|
return returnPromise;
|
53
46
|
};
|
54
47
|
};
|
package/src/httpPost.js
CHANGED
@@ -3,47 +3,41 @@
|
|
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
|
-
|
25
20
|
form = form || {};
|
26
21
|
|
27
|
-
callback =
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
resolveFunc(data);
|
32
|
-
};
|
22
|
+
callback = callback || function (err, data) {
|
23
|
+
if (err) return rejectFunc(err);
|
24
|
+
resolveFunc(data);
|
25
|
+
};
|
33
26
|
|
34
27
|
if (notAPI) {
|
35
28
|
utils
|
36
29
|
.post(url, ctx.jar, form, ctx.globalOptions)
|
37
30
|
.then(resData => callback(null, resData.body.toString()))
|
38
|
-
.catch(function(err) {
|
31
|
+
.catch(function (err) {
|
39
32
|
log.error("httpPost", err);
|
40
33
|
return callback(err);
|
41
34
|
});
|
42
|
-
}
|
35
|
+
}
|
36
|
+
else {
|
43
37
|
defaultFuncs
|
44
38
|
.post(url, ctx.jar, form, {})
|
45
39
|
.then(resData => callback(null, resData.body.toString()))
|
46
|
-
.catch(function(err) {
|
40
|
+
.catch(function (err) {
|
47
41
|
log.error("httpPost", err);
|
48
42
|
return callback(err);
|
49
43
|
});
|
@@ -3,7 +3,7 @@
|
|
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
|
function makeTypingIndicator(typ, threadID, callback, isGroup) {
|
8
8
|
var form = {
|
9
9
|
typ: +typ,
|
@@ -15,46 +15,36 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
15
15
|
// Check if thread is a single person chat or a group chat
|
16
16
|
// More info on this is in api.sendMessage
|
17
17
|
if (utils.getType(isGroup) == "Boolean") {
|
18
|
-
if (!isGroup)
|
19
|
-
|
20
|
-
}
|
18
|
+
if (!isGroup) form.to = threadID;
|
19
|
+
|
21
20
|
defaultFuncs
|
22
21
|
.post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
|
23
22
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
24
|
-
.then(function(resData) {
|
23
|
+
.then(function (resData) {
|
25
24
|
if (resData.error) throw resData;
|
26
25
|
return callback();
|
27
26
|
})
|
28
|
-
.catch(function(err) {
|
27
|
+
.catch(function (err) {
|
29
28
|
log.error("sendTypingIndicator", err);
|
30
|
-
if (utils.getType(err) == "Object" && err.error === "Not logged in")
|
31
|
-
ctx.loggedIn = false;
|
32
|
-
}
|
29
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in") ctx.loggedIn = false;
|
33
30
|
return callback(err);
|
34
31
|
});
|
35
|
-
}
|
36
|
-
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
api.getUserInfo(threadID, function (err, res) {
|
37
35
|
if (err) return callback(err);
|
38
36
|
// If id is single person chat
|
39
37
|
if (Object.keys(res).length > 0) form.to = threadID;
|
40
38
|
defaultFuncs
|
41
|
-
.post(
|
42
|
-
"https://www.facebook.com/ajax/messaging/typ.php",
|
43
|
-
ctx.jar,
|
44
|
-
form
|
45
|
-
)
|
39
|
+
.post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
|
46
40
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
47
|
-
.then(function(resData) {
|
41
|
+
.then(function (resData) {
|
48
42
|
if (resData.error) throw resData;
|
49
43
|
return callback();
|
50
44
|
})
|
51
|
-
.catch(function(err) {
|
45
|
+
.catch(function (err) {
|
52
46
|
log.error("sendTypingIndicator", err);
|
53
|
-
if (
|
54
|
-
utils.getType(err) == "Object" &&
|
55
|
-
err.error === "Not logged in."
|
56
|
-
)
|
57
|
-
ctx.loggedIn = false;
|
47
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
|
58
48
|
return callback(err);
|
59
49
|
});
|
60
50
|
});
|
@@ -62,33 +52,18 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
62
52
|
}
|
63
53
|
|
64
54
|
return function sendTypingIndicator(threadID, callback, isGroup) {
|
65
|
-
if (
|
66
|
-
|
67
|
-
|
68
|
-
) {
|
69
|
-
if (callback)
|
70
|
-
log.warn(
|
71
|
-
"sendTypingIndicator",
|
72
|
-
"callback is not a function - ignoring."
|
73
|
-
);
|
74
|
-
callback = () => {};
|
55
|
+
if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
|
56
|
+
if (callback) log.warn("sendTypingIndicator", "callback is not a function - ignoring.");
|
57
|
+
callback = () => { };
|
75
58
|
}
|
76
59
|
|
77
60
|
makeTypingIndicator(true, threadID, callback, isGroup);
|
78
61
|
|
79
62
|
return function end(cb) {
|
80
|
-
if (
|
81
|
-
|
82
|
-
|
83
|
-
) {
|
84
|
-
if (cb)
|
85
|
-
log.warn(
|
86
|
-
"sendTypingIndicator",
|
87
|
-
"callback is not a function - ignoring."
|
88
|
-
);
|
89
|
-
cb = () => {};
|
63
|
+
if (utils.getType(cb) !== "Function" && utils.getType(cb) !== "AsyncFunction") {
|
64
|
+
if (cb) log.warn("sendTypingIndicator", "callback is not a function - ignoring.");
|
65
|
+
cb = () => { };
|
90
66
|
}
|
91
|
-
|
92
67
|
makeTypingIndicator(false, threadID, cb, isGroup);
|
93
68
|
};
|
94
69
|
};
|