alicezetion 1.7.1 → 1.7.2
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/Extra/Database/index.js +399 -0
- package/Extra/Database/methods.js +286 -0
- package/Extra/ExtraAddons.js +213 -0
- package/Extra/ExtraGetThread.js +1 -0
- package/Extra/ExtraUptimeRobot.js +59 -0
- package/Extra/PM2/ecosystem.config.js +23 -0
- package/Extra/Src/Last-Run.js +48 -0
- package/Language/index.json +151 -0
- package/StateCrypt.js +22 -0
- package/broadcast.js +42 -0
- package/index.js +654 -119
- package/logger.js +21 -0
- package/package.json +37 -25
- package/replit.nix +3 -4
- package/src/addExternalModule.js +13 -5
- package/src/addUserToGroup.js +36 -12
- package/src/changeAdminStatus.js +85 -37
- package/src/changeArchivedStatus.js +15 -9
- package/src/changeAvt.js +91 -0
- package/src/changeBio.js +13 -8
- package/src/changeBlockedStatus.js +14 -8
- package/src/changeGroupImage.js +28 -13
- package/src/changeNickname.js +22 -11
- package/src/changeThreadColor.js +16 -10
- package/src/changeThreadEmoji.js +18 -9
- package/src/chat.js +401 -280
- package/src/createNewGroup.js +18 -10
- package/src/createPoll.js +17 -11
- package/src/deleteMessage.js +17 -10
- package/src/deleteThread.js +17 -10
- package/src/forwardAttachment.js +15 -9
- package/src/getAccessToken.js +32 -0
- package/src/getCurrentUserID.js +1 -1
- package/src/getEmojiUrl.js +3 -2
- package/src/getFriendsList.js +18 -10
- package/src/getMessage.js +84 -0
- package/src/getThreadHistory.js +156 -59
- package/src/getThreadHistoryDeprecated.js +26 -15
- package/src/getThreadInfo.js +68 -42
- 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 +9 -7
- package/src/getUserInfo.js +12 -10
- package/src/getUserInfoV2.js +35 -0
- package/src/handleFriendRequest.js +36 -35
- package/src/handleMessageRequest.js +18 -10
- package/src/httpGet.js +20 -13
- package/src/httpPost.js +19 -13
- package/src/httpPostFormData.js +46 -0
- package/src/listenMqtt.js +1224 -621
- package/src/logout.js +18 -13
- package/src/markAsDelivered.js +17 -10
- package/src/markAsRead.js +36 -24
- package/src/markAsSeen.js +22 -12
- package/src/muteThread.js +15 -9
- package/src/{setMessageReaction.js → react.js} +20 -9
- package/src/removeUserFromGroup.js +38 -11
- package/src/resolvePhotoUrl.js +9 -6
- package/src/searchForThread.js +14 -8
- package/src/{markAsReadAll.js → seen.js} +17 -10
- package/src/sendTypingIndicator.js +44 -19
- package/src/setPostReaction.js +63 -22
- package/src/setTitle.js +22 -12
- package/src/threadColors.js +17 -19
- package/src/unfriend.js +15 -9
- package/src/{unsendMessage.js → unsend.js} +9 -8
- package/utils.js +120 -27
- package/.travis.yml +0 -6
- package/src/forwardMessage.js +0 -0
- package/src/listen.js +0 -553
- package/src/listenMqtt-Test.js +0 -687
- package/src/sendMessage.js +0 -315
- package/test/data/shareAttach.js +0 -146
- package/test/data/something.mov +0 -0
- package/test/data/test.png +0 -0
- package/test/data/test.txt +0 -7
- package/test/example-config.json +0 -18
- package/test/test-page.js +0 -140
- package/test/test.js +0 -385
package/src/changeGroupImage.js
CHANGED
@@ -4,7 +4,7 @@ var utils = require("../utils");
|
|
4
4
|
var log = require("npmlog");
|
5
5
|
var bluebird = require("bluebird");
|
6
6
|
|
7
|
-
module.exports = function
|
7
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
8
8
|
function handleUpload(image, callback) {
|
9
9
|
var uploads = [];
|
10
10
|
|
@@ -15,10 +15,16 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
15
15
|
|
16
16
|
uploads.push(
|
17
17
|
defaultFuncs
|
18
|
-
.postFormData(
|
18
|
+
.postFormData(
|
19
|
+
"https://upload.facebook.com/ajax/mercury/upload.php",
|
20
|
+
ctx.jar,
|
21
|
+
form,
|
22
|
+
{}
|
23
|
+
)
|
19
24
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
20
|
-
.then(function
|
25
|
+
.then(function(resData) {
|
21
26
|
if (resData.error) throw resData;
|
27
|
+
|
22
28
|
return resData.payload.metadata[0];
|
23
29
|
})
|
24
30
|
);
|
@@ -27,24 +33,29 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
27
33
|
bluebird
|
28
34
|
.all(uploads)
|
29
35
|
.then(resData => callback(null, resData))
|
30
|
-
.catch(function
|
36
|
+
.catch(function(err) {
|
31
37
|
log.error("handleUpload", err);
|
32
38
|
return callback(err);
|
33
39
|
});
|
34
40
|
}
|
35
41
|
|
36
42
|
return function changeGroupImage(image, threadID, callback) {
|
37
|
-
if (
|
43
|
+
if (
|
44
|
+
!callback &&
|
45
|
+
(utils.getType(threadID) === "Function" ||
|
46
|
+
utils.getType(threadID) === "AsyncFunction")
|
47
|
+
)
|
48
|
+
throw { error: "please pass a threadID as a second argument." };
|
38
49
|
|
39
|
-
var resolveFunc = function
|
40
|
-
var rejectFunc = function
|
41
|
-
var returnPromise = new Promise(function
|
50
|
+
var resolveFunc = function() {};
|
51
|
+
var rejectFunc = function() {};
|
52
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
42
53
|
resolveFunc = resolve;
|
43
54
|
rejectFunc = reject;
|
44
55
|
});
|
45
56
|
|
46
57
|
if (!callback) {
|
47
|
-
callback = function
|
58
|
+
callback = function(err) {
|
48
59
|
if (err) return rejectFunc(err);
|
49
60
|
resolveFunc();
|
50
61
|
};
|
@@ -80,21 +91,25 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
80
91
|
timestamp_time_passed: "0"
|
81
92
|
};
|
82
93
|
|
83
|
-
handleUpload(image, function
|
94
|
+
handleUpload(image, function(err, payload) {
|
84
95
|
if (err) return callback(err);
|
85
96
|
|
86
97
|
form["thread_image_id"] = payload[0]["image_id"];
|
87
98
|
form["thread_id"] = threadID;
|
88
99
|
|
89
100
|
defaultFuncs
|
90
|
-
.post(
|
101
|
+
.post(
|
102
|
+
"https://www.facebook.com/messaging/set_thread_image/",
|
103
|
+
ctx.jar,
|
104
|
+
form
|
105
|
+
)
|
91
106
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
92
|
-
.then(function
|
107
|
+
.then(function(resData) {
|
93
108
|
// check for errors here
|
94
109
|
if (resData.error) throw resData;
|
95
110
|
return callback();
|
96
111
|
})
|
97
|
-
.catch(function
|
112
|
+
.catch(function(err) {
|
98
113
|
log.error("changeGroupImage", err);
|
99
114
|
return callback(err);
|
100
115
|
});
|
package/src/changeNickname.js
CHANGED
@@ -3,16 +3,16 @@
|
|
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 changeNickname(nickname, threadID, participantID, callback) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
10
|
-
var returnPromise = new Promise(function
|
8
|
+
var resolveFunc = function() {};
|
9
|
+
var rejectFunc = function() {};
|
10
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
11
11
|
resolveFunc = resolve;
|
12
12
|
rejectFunc = reject;
|
13
13
|
});
|
14
14
|
if (!callback) {
|
15
|
-
callback = function
|
15
|
+
callback = function(err) {
|
16
16
|
if (err) return rejectFunc(err);
|
17
17
|
resolveFunc();
|
18
18
|
};
|
@@ -25,16 +25,27 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
25
25
|
};
|
26
26
|
|
27
27
|
defaultFuncs
|
28
|
-
.post(
|
28
|
+
.post(
|
29
|
+
"https://www.facebook.com/messaging/save_thread_nickname/?source=thread_settings&dpr=1",
|
30
|
+
ctx.jar,
|
31
|
+
form
|
32
|
+
)
|
29
33
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
30
|
-
.then(function
|
31
|
-
if (resData.error === 1545014)
|
32
|
-
|
34
|
+
.then(function(resData) {
|
35
|
+
if (resData.error === 1545014)
|
36
|
+
throw { error: "Trying to change nickname of user isn't in thread" };
|
37
|
+
if (resData.error === 1357031)
|
38
|
+
throw {
|
39
|
+
error:
|
40
|
+
"Trying to change user nickname of a thread that doesn't exist. Have at least one message in the thread before trying to change the user nickname."
|
41
|
+
};
|
42
|
+
|
33
43
|
if (resData.error) throw resData;
|
44
|
+
|
34
45
|
return callback();
|
35
46
|
})
|
36
|
-
.catch(function
|
37
|
-
log.error("changeNickname",
|
47
|
+
.catch(function(err) {
|
48
|
+
log.error("changeNickname", err);
|
38
49
|
return callback(err);
|
39
50
|
});
|
40
51
|
|
package/src/changeThreadColor.js
CHANGED
@@ -3,27 +3,31 @@
|
|
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 changeThreadColor(color, threadID, callback) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
10
|
-
var returnPromise = new Promise(function
|
8
|
+
var resolveFunc = function() {};
|
9
|
+
var rejectFunc = function() {};
|
10
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
11
11
|
resolveFunc = resolve;
|
12
12
|
rejectFunc = reject;
|
13
13
|
});
|
14
14
|
|
15
15
|
if (!callback) {
|
16
|
-
callback = function
|
16
|
+
callback = function(err) {
|
17
17
|
if (err) return rejectFunc(err);
|
18
18
|
resolveFunc(err);
|
19
19
|
};
|
20
20
|
}
|
21
21
|
|
22
22
|
var validatedColor = color !== null ? color.toLowerCase() : color; // API only accepts lowercase letters in hex string
|
23
|
-
var colorList = Object.keys(api.threadColors).map(function
|
23
|
+
var colorList = Object.keys(api.threadColors).map(function(name) {
|
24
24
|
return api.threadColors[name];
|
25
25
|
});
|
26
|
-
if (!colorList.includes(validatedColor))
|
26
|
+
if (!colorList.includes(validatedColor))
|
27
|
+
throw {
|
28
|
+
error:
|
29
|
+
"The color you are trying to use is not a valid thread color. Use api.threadColors to find acceptable values."
|
30
|
+
};
|
27
31
|
|
28
32
|
var form = {
|
29
33
|
dpr: 1,
|
@@ -47,11 +51,13 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
47
51
|
defaultFuncs
|
48
52
|
.post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
|
49
53
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
50
|
-
.then(function
|
51
|
-
if (resData[resData.length - 1].error_results > 0)
|
54
|
+
.then(function(resData) {
|
55
|
+
if (resData[resData.length - 1].error_results > 0)
|
56
|
+
throw resData[0].o0.errors;
|
57
|
+
|
52
58
|
return callback();
|
53
59
|
})
|
54
|
-
.catch(function
|
60
|
+
.catch(function(err) {
|
55
61
|
log.error("changeThreadColor", err);
|
56
62
|
return callback(err);
|
57
63
|
});
|
package/src/changeThreadEmoji.js
CHANGED
@@ -3,17 +3,17 @@
|
|
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 changeThreadEmoji(emoji, threadID, callback) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
10
|
-
var returnPromise = new Promise(function
|
8
|
+
var resolveFunc = function() {};
|
9
|
+
var rejectFunc = function() {};
|
10
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
11
11
|
resolveFunc = resolve;
|
12
12
|
rejectFunc = reject;
|
13
13
|
});
|
14
14
|
|
15
15
|
if (!callback) {
|
16
|
-
callback = function
|
16
|
+
callback = function(err) {
|
17
17
|
if (err) return rejectFunc(err);
|
18
18
|
resolveFunc();
|
19
19
|
};
|
@@ -24,14 +24,23 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
24
24
|
};
|
25
25
|
|
26
26
|
defaultFuncs
|
27
|
-
.post(
|
27
|
+
.post(
|
28
|
+
"https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",
|
29
|
+
ctx.jar,
|
30
|
+
form
|
31
|
+
)
|
28
32
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
29
|
-
.then(function
|
30
|
-
if (resData.error === 1357031)
|
33
|
+
.then(function(resData) {
|
34
|
+
if (resData.error === 1357031)
|
35
|
+
throw {
|
36
|
+
error:
|
37
|
+
"Trying to change emoji of a chat that doesn't exist. Have at least one message in the thread before trying to change the emoji."
|
38
|
+
};
|
31
39
|
if (resData.error) throw resData;
|
40
|
+
|
32
41
|
return callback();
|
33
42
|
})
|
34
|
-
.catch(function
|
43
|
+
.catch(function(err) {
|
35
44
|
log.error("changeThreadEmoji", err);
|
36
45
|
return callback(err);
|
37
46
|
});
|