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
@@ -3,7 +3,7 @@
|
|
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
|
function makeTypingIndicator(typ, threadID, callback, isGroup) {
|
8
8
|
var form = {
|
9
9
|
typ: +typ,
|
@@ -15,36 +15,46 @@ 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
|
-
|
18
|
+
if (!isGroup) {
|
19
|
+
form.to = threadID;
|
20
|
+
}
|
20
21
|
defaultFuncs
|
21
22
|
.post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
|
22
23
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
23
|
-
.then(function
|
24
|
+
.then(function(resData) {
|
24
25
|
if (resData.error) throw resData;
|
25
26
|
return callback();
|
26
27
|
})
|
27
|
-
.catch(function
|
28
|
+
.catch(function(err) {
|
28
29
|
log.error("sendTypingIndicator", err);
|
29
|
-
if (utils.getType(err) == "Object" && err.error === "Not logged in")
|
30
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in") {
|
31
|
+
ctx.loggedIn = false;
|
32
|
+
}
|
30
33
|
return callback(err);
|
31
34
|
});
|
32
|
-
}
|
33
|
-
|
34
|
-
api.getUserInfo(threadID, function (err, res) {
|
35
|
+
} else {
|
36
|
+
api.getUserInfo(threadID, function(err, res) {
|
35
37
|
if (err) return callback(err);
|
36
38
|
// If id is single person chat
|
37
39
|
if (Object.keys(res).length > 0) form.to = threadID;
|
38
40
|
defaultFuncs
|
39
|
-
.post(
|
41
|
+
.post(
|
42
|
+
"https://www.facebook.com/ajax/messaging/typ.php",
|
43
|
+
ctx.jar,
|
44
|
+
form
|
45
|
+
)
|
40
46
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
41
|
-
.then(function
|
47
|
+
.then(function(resData) {
|
42
48
|
if (resData.error) throw resData;
|
43
49
|
return callback();
|
44
50
|
})
|
45
|
-
.catch(function
|
51
|
+
.catch(function(err) {
|
46
52
|
log.error("sendTypingIndicator", err);
|
47
|
-
if (
|
53
|
+
if (
|
54
|
+
utils.getType(err) == "Object" &&
|
55
|
+
err.error === "Not logged in."
|
56
|
+
)
|
57
|
+
ctx.loggedIn = false;
|
48
58
|
return callback(err);
|
49
59
|
});
|
50
60
|
});
|
@@ -52,18 +62,33 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
52
62
|
}
|
53
63
|
|
54
64
|
return function sendTypingIndicator(threadID, callback, isGroup) {
|
55
|
-
if (
|
56
|
-
|
57
|
-
callback
|
65
|
+
if (
|
66
|
+
utils.getType(callback) !== "Function" &&
|
67
|
+
utils.getType(callback) !== "AsyncFunction"
|
68
|
+
) {
|
69
|
+
if (callback)
|
70
|
+
log.warn(
|
71
|
+
"sendTypingIndicator",
|
72
|
+
"callback is not a function - ignoring."
|
73
|
+
);
|
74
|
+
callback = () => {};
|
58
75
|
}
|
59
76
|
|
60
77
|
makeTypingIndicator(true, threadID, callback, isGroup);
|
61
78
|
|
62
79
|
return function end(cb) {
|
63
|
-
if (
|
64
|
-
|
65
|
-
cb
|
80
|
+
if (
|
81
|
+
utils.getType(cb) !== "Function" &&
|
82
|
+
utils.getType(cb) !== "AsyncFunction"
|
83
|
+
) {
|
84
|
+
if (cb)
|
85
|
+
log.warn(
|
86
|
+
"sendTypingIndicator",
|
87
|
+
"callback is not a function - ignoring."
|
88
|
+
);
|
89
|
+
cb = () => {};
|
66
90
|
}
|
91
|
+
|
67
92
|
makeTypingIndicator(false, threadID, cb, isGroup);
|
68
93
|
};
|
69
94
|
};
|
package/src/setPostReaction.js
CHANGED
@@ -1,63 +1,104 @@
|
|
1
|
+
/**
|
2
|
+
* @fix by NTKhang
|
3
|
+
* update as Thursday, 10 February 2022
|
4
|
+
* do not remove the author name to get more updates
|
5
|
+
*/
|
6
|
+
|
1
7
|
"use strict";
|
2
8
|
|
3
9
|
var utils = require("../utils");
|
4
10
|
var log = require("npmlog");
|
5
11
|
|
6
|
-
|
12
|
+
function formatData(resData) {
|
13
|
+
return {
|
14
|
+
viewer_feedback_reaction_info:
|
15
|
+
resData.feedback_react.feedback.viewer_feedback_reaction_info,
|
16
|
+
supported_reactions: resData.feedback_react.feedback.supported_reactions,
|
17
|
+
top_reactions: resData.feedback_react.feedback.top_reactions.edges,
|
18
|
+
reaction_count: resData.feedback_react.feedback.reaction_count
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
23
|
return function setPostReaction(postID, type, callback) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
10
|
-
var returnPromise = new Promise(function
|
24
|
+
var resolveFunc = function() {};
|
25
|
+
var rejectFunc = function() {};
|
26
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
11
27
|
resolveFunc = resolve;
|
12
28
|
rejectFunc = reject;
|
13
29
|
});
|
14
30
|
|
15
31
|
if (!callback) {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
32
|
+
if (
|
33
|
+
utils.getType(type) === "Function" ||
|
34
|
+
utils.getType(type) === "AsyncFunction"
|
35
|
+
) {
|
36
|
+
callback = type;
|
37
|
+
type = 0;
|
38
|
+
} else {
|
39
|
+
callback = function(err, data) {
|
40
|
+
if (err) {
|
41
|
+
return rejectFunc(err);
|
42
|
+
}
|
43
|
+
resolveFunc(data);
|
44
|
+
};
|
45
|
+
}
|
20
46
|
}
|
21
47
|
|
22
48
|
var map = {
|
49
|
+
unlike: 0,
|
23
50
|
like: 1,
|
24
51
|
heart: 2,
|
25
|
-
|
52
|
+
love: 16,
|
26
53
|
haha: 4,
|
54
|
+
wow: 3,
|
27
55
|
sad: 7,
|
28
56
|
angry: 8
|
29
57
|
};
|
30
|
-
|
31
|
-
|
32
|
-
|
58
|
+
|
59
|
+
if (utils.getType(type) !== "Number" && utils.getType(type) === "String") {
|
60
|
+
type = map[type.toLowerCase()];
|
61
|
+
} else {
|
62
|
+
throw {
|
63
|
+
error: "setPostReaction: Invalid reaction type"
|
64
|
+
};
|
33
65
|
}
|
66
|
+
|
34
67
|
var form = {
|
35
68
|
av: ctx.userID,
|
36
69
|
fb_api_caller_class: "RelayModern",
|
37
|
-
fb_api_req_friendly_name: "
|
38
|
-
|
39
|
-
doc_id: "2580813318646067",
|
70
|
+
fb_api_req_friendly_name: "CometUFIFeedbackReactMutation",
|
71
|
+
doc_id: "4769042373179384",
|
40
72
|
variables: JSON.stringify({
|
41
73
|
input: {
|
42
|
-
client_mutation_id: "7",
|
43
74
|
actor_id: ctx.userID,
|
44
|
-
|
75
|
+
feedback_id: new Buffer.from("feedback:" + postID).toString("base64"),
|
76
|
+
feedback_reaction: type,
|
77
|
+
feedback_source: "OBJECT",
|
78
|
+
is_tracking_encrypted: true,
|
79
|
+
tracking: [],
|
80
|
+
session_id: "f7dd50dd-db6e-4598-8cd9-561d5002b423",
|
81
|
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
45
82
|
},
|
46
|
-
useDefaultActor:
|
83
|
+
useDefaultActor: false,
|
84
|
+
scale: 3
|
47
85
|
})
|
48
86
|
};
|
49
87
|
|
50
88
|
defaultFuncs
|
51
89
|
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
52
90
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
53
|
-
.then(function
|
54
|
-
if (resData.
|
55
|
-
|
91
|
+
.then(function(resData) {
|
92
|
+
if (resData.errors) {
|
93
|
+
throw resData;
|
94
|
+
}
|
95
|
+
return callback(null, formatData(resData.data));
|
56
96
|
})
|
57
|
-
.catch(function
|
97
|
+
.catch(function(err) {
|
58
98
|
log.error("setPostReaction", err);
|
59
99
|
return callback(err);
|
60
100
|
});
|
101
|
+
|
61
102
|
return returnPromise;
|
62
103
|
};
|
63
104
|
};
|
package/src/setTitle.js
CHANGED
@@ -3,21 +3,24 @@
|
|
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 setTitle(newTitle, threadID, callback) {
|
8
|
-
if (
|
8
|
+
if (
|
9
|
+
!callback &&
|
10
|
+
(utils.getType(threadID) === "Function" ||
|
11
|
+
utils.getType(threadID) === "AsyncFunction")
|
12
|
+
)
|
9
13
|
throw { error: "please pass a threadID as a second argument." };
|
10
14
|
|
11
|
-
|
12
|
-
var
|
13
|
-
var
|
14
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
15
|
+
var resolveFunc = function() {};
|
16
|
+
var rejectFunc = function() {};
|
17
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
15
18
|
resolveFunc = resolve;
|
16
19
|
rejectFunc = reject;
|
17
20
|
});
|
18
21
|
|
19
22
|
if (!callback) {
|
20
|
-
callback = function
|
23
|
+
callback = function(err, data) {
|
21
24
|
if (err) return rejectFunc(err);
|
22
25
|
resolveFunc(data);
|
23
26
|
};
|
@@ -53,18 +56,25 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
53
56
|
};
|
54
57
|
|
55
58
|
defaultFuncs
|
56
|
-
.post(
|
59
|
+
.post(
|
60
|
+
"https://www.facebook.com/messaging/set_thread_name/",
|
61
|
+
ctx.jar,
|
62
|
+
form
|
63
|
+
)
|
57
64
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
58
|
-
.then(function
|
59
|
-
if (resData.error && resData.error === 1545012)
|
60
|
-
|
65
|
+
.then(function(resData) {
|
66
|
+
if (resData.error && resData.error === 1545012)
|
67
|
+
throw { error: "Cannot change chat title: Not member of chat." };
|
68
|
+
if (resData.error && resData.error === 1545003)
|
69
|
+
throw { error: "Cannot set title of single-user chat." };
|
61
70
|
if (resData.error) throw resData;
|
62
71
|
return callback();
|
63
72
|
})
|
64
|
-
.catch(function
|
73
|
+
.catch(function(err) {
|
65
74
|
log.error("setTitle", err);
|
66
75
|
return callback(err);
|
67
76
|
});
|
77
|
+
|
68
78
|
return returnPromise;
|
69
79
|
};
|
70
80
|
};
|
package/src/threadColors.js
CHANGED
@@ -1,25 +1,23 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
module.exports = function
|
3
|
+
module.exports = function(_defaultFuncs, _api, _ctx) {
|
4
4
|
// Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more
|
5
5
|
return {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
BrilliantRose: "
|
20
|
-
|
21
|
-
//#endregion
|
22
|
-
|
6
|
+
////MessengerBlue: null,
|
7
|
+
////Viking: "#44bec7",
|
8
|
+
////GoldenPoppy: "#ffc300",
|
9
|
+
////RadicalRed: "#fa3c4c",
|
10
|
+
////Shocking: "#d696bb",
|
11
|
+
////PictonBlue: "#6699cc",
|
12
|
+
////FreeSpeechGreen: "#13cf13",
|
13
|
+
////Pumpkin: "#ff7e29",
|
14
|
+
////LightCoral: "#e68585",
|
15
|
+
////MediumSlateBlue: "#7646ff",
|
16
|
+
////DeepSkyBlue: "#20cef5",
|
17
|
+
////Fern: "#67b868",
|
18
|
+
////Cameo: "#d4a88c",
|
19
|
+
////BrilliantRose: "#ff5ca1",
|
20
|
+
////BilobaFlower: "#a695c7"
|
23
21
|
DefaultBlue: "196241301102133",
|
24
22
|
HotPink: "169463077092846",
|
25
23
|
AquaBlue: "2442142322678320",
|
@@ -36,6 +34,6 @@ module.exports = function (_defaultFuncs, _api, _ctx) {
|
|
36
34
|
Berry: "164535220883264",
|
37
35
|
Citrus: "370940413392601",
|
38
36
|
Candy: "205488546921017",
|
39
|
-
|
37
|
+
StarWars: "809305022860427"
|
40
38
|
};
|
41
39
|
};
|
package/src/unfriend.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 unfriend(userID, 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, friendList) {
|
17
17
|
if (err) return rejectFunc(err);
|
18
18
|
resolveFunc(friendList);
|
19
19
|
};
|
@@ -23,20 +23,26 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
23
23
|
uid: userID,
|
24
24
|
unref: "bd_friends_tab",
|
25
25
|
floc: "friends_tab",
|
26
|
-
"nctr[_mod]":
|
26
|
+
"nctr[_mod]":
|
27
|
+
"pagelet_timeline_app_collection_" + ctx.userID + ":2356318349:2"
|
27
28
|
};
|
28
29
|
|
29
30
|
defaultFuncs
|
30
|
-
.post(
|
31
|
+
.post(
|
32
|
+
"https://www.facebook.com/ajax/profile/removefriendconfirm.php",
|
33
|
+
ctx.jar,
|
34
|
+
form
|
35
|
+
)
|
31
36
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
32
|
-
.then(function
|
37
|
+
.then(function(resData) {
|
33
38
|
if (resData.error) throw resData;
|
34
39
|
return callback();
|
35
40
|
})
|
36
|
-
.catch(function
|
41
|
+
.catch(function(err) {
|
37
42
|
log.error("unfriend", err);
|
38
43
|
return callback(err);
|
39
44
|
});
|
45
|
+
|
40
46
|
return returnPromise;
|
41
47
|
};
|
42
48
|
};
|
@@ -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 unsendMessage(messageID, 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, friendList) {
|
17
17
|
if (err) return rejectFunc(err);
|
18
18
|
resolveFunc(friendList);
|
19
19
|
};
|
@@ -26,14 +26,15 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
26
26
|
defaultFuncs
|
27
27
|
.post("https://www.facebook.com/messaging/unsend_message/", ctx.jar, form)
|
28
28
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
29
|
-
.then(function
|
29
|
+
.then(function(resData) {
|
30
30
|
if (resData.error) throw resData;
|
31
31
|
return callback();
|
32
32
|
})
|
33
|
-
.catch(function
|
34
|
-
log.error("unsendMessage",
|
33
|
+
.catch(function(err) {
|
34
|
+
log.error("unsendMessage", err);
|
35
35
|
return callback(err);
|
36
36
|
});
|
37
|
+
|
37
38
|
return returnPromise;
|
38
39
|
};
|
39
40
|
};
|