alicezetion 1.7.5 → 1.7.7
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 +120 -655
- 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/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/{seen.js → markAsReadAll.js} +10 -17
- package/src/markAsSeen.js +12 -22
- package/src/muteThread.js +9 -15
- package/src/removeUserFromGroup.js +11 -38
- package/src/resolvePhotoUrl.js +6 -9
- package/src/searchForThread.js +8 -14
- package/src/sendMessage.js +315 -0
- package/src/sendTypingIndicator.js +19 -44
- package/src/{react.js → setMessageReaction.js} +9 -20
- 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/createNewGroup.js
CHANGED
@@ -3,30 +3,26 @@
|
|
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 createNewGroup(participantIDs, groupTitle, callback) {
|
8
8
|
if (utils.getType(groupTitle) == "Function") {
|
9
9
|
callback = groupTitle;
|
10
10
|
groupTitle = null;
|
11
11
|
}
|
12
12
|
|
13
|
-
if (utils.getType(participantIDs) !== "Array")
|
14
|
-
throw { error: "createNewGroup: participantIDs should be an array." };
|
13
|
+
if (utils.getType(participantIDs) !== "Array") throw { error: "createNewGroup: participantIDs should be an array." };
|
15
14
|
|
16
|
-
if (participantIDs.length < 2)
|
17
|
-
throw {
|
18
|
-
error: "createNewGroup: participantIDs should have at least 2 IDs."
|
19
|
-
};
|
15
|
+
if (participantIDs.length < 2) throw { error: "createNewGroup: participantIDs should have at least 2 IDs." };
|
20
16
|
|
21
|
-
var resolveFunc = function() {};
|
22
|
-
var rejectFunc = function() {};
|
23
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
17
|
+
var resolveFunc = function () { };
|
18
|
+
var rejectFunc = function () { };
|
19
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
24
20
|
resolveFunc = resolve;
|
25
21
|
rejectFunc = reject;
|
26
22
|
});
|
27
23
|
|
28
24
|
if (!callback) {
|
29
|
-
callback = function(err, threadID) {
|
25
|
+
callback = function (err, threadID) {
|
30
26
|
if (err) return rejectFunc(err);
|
31
27
|
resolveFunc(threadID);
|
32
28
|
};
|
@@ -60,15 +56,11 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
60
56
|
defaultFuncs
|
61
57
|
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
62
58
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
63
|
-
.then(function(resData) {
|
59
|
+
.then(function (resData) {
|
64
60
|
if (resData.errors) throw resData;
|
65
|
-
return callback(
|
66
|
-
null,
|
67
|
-
resData.data.messenger_group_thread_create.thread.thread_key
|
68
|
-
.thread_fbid
|
69
|
-
);
|
61
|
+
return callback(null, resData.data.messenger_group_thread_create.thread.thread_key.thread_fbid);
|
70
62
|
})
|
71
|
-
.catch(function(err) {
|
63
|
+
.catch(function (err) {
|
72
64
|
log.error("createNewGroup", err);
|
73
65
|
return callback(err);
|
74
66
|
});
|
package/src/createPoll.js
CHANGED
@@ -3,11 +3,11 @@
|
|
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 createPoll(title, threadID, options, callback) {
|
8
|
-
var resolveFunc = function() {};
|
9
|
-
var rejectFunc = function() {};
|
10
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
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
|
});
|
@@ -16,8 +16,9 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
16
16
|
if (utils.getType(options) == "Function") {
|
17
17
|
callback = options;
|
18
18
|
options = null;
|
19
|
-
}
|
20
|
-
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
callback = function (err) {
|
21
22
|
if (err) return rejectFunc(err);
|
22
23
|
resolveFunc();
|
23
24
|
};
|
@@ -36,26 +37,19 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
36
37
|
// eslint-disable-next-line no-prototype-builtins
|
37
38
|
if (options.hasOwnProperty(opt)) {
|
38
39
|
form["option_text_array[" + ind + "]"] = opt;
|
39
|
-
form["option_is_selected_array[" + ind + "]"] = options[opt]
|
40
|
-
? "1"
|
41
|
-
: "0";
|
40
|
+
form["option_is_selected_array[" + ind + "]"] = options[opt] ? "1" : "0";
|
42
41
|
ind++;
|
43
42
|
}
|
44
43
|
}
|
45
44
|
|
46
45
|
defaultFuncs
|
47
|
-
.post(
|
48
|
-
"https://www.facebook.com/messaging/group_polling/create_poll/?dpr=1",
|
49
|
-
ctx.jar,
|
50
|
-
form
|
51
|
-
)
|
46
|
+
.post("https://www.facebook.com/messaging/group_polling/create_poll/?dpr=1", ctx.jar, form)
|
52
47
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
53
|
-
.then(function(resData) {
|
48
|
+
.then(function (resData) {
|
54
49
|
if (resData.payload.status != "success") throw resData;
|
55
|
-
|
56
50
|
return callback();
|
57
51
|
})
|
58
|
-
.catch(function(err) {
|
52
|
+
.catch(function (err) {
|
59
53
|
log.error("createPoll", err);
|
60
54
|
return callback(err);
|
61
55
|
});
|
package/src/deleteMessage.js
CHANGED
@@ -3,16 +3,16 @@
|
|
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 deleteMessage(messageOrMessages, callback) {
|
8
|
-
var resolveFunc = function() {};
|
9
|
-
var rejectFunc = function() {};
|
10
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
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(err) {
|
15
|
+
callback = function (err) {
|
16
16
|
if (err) return rejectFunc(err);
|
17
17
|
|
18
18
|
resolveFunc();
|
@@ -23,25 +23,18 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
23
23
|
client: "mercury"
|
24
24
|
};
|
25
25
|
|
26
|
-
if (utils.getType(messageOrMessages) !== "Array")
|
27
|
-
messageOrMessages = [messageOrMessages];
|
26
|
+
if (utils.getType(messageOrMessages) !== "Array") messageOrMessages = [messageOrMessages];
|
28
27
|
|
29
|
-
for (var i = 0; i < messageOrMessages.length; i++)
|
30
|
-
form["message_ids[" + i + "]"] = messageOrMessages[i];
|
28
|
+
for (var i = 0; i < messageOrMessages.length; i++) form["message_ids[" + i + "]"] = messageOrMessages[i];
|
31
29
|
|
32
30
|
defaultFuncs
|
33
|
-
.post(
|
34
|
-
"https://www.facebook.com/ajax/mercury/delete_messages.php",
|
35
|
-
ctx.jar,
|
36
|
-
form
|
37
|
-
)
|
31
|
+
.post("https://www.facebook.com/ajax/mercury/delete_messages.php", ctx.jar, form)
|
38
32
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
39
|
-
.then(function(resData) {
|
33
|
+
.then(function (resData) {
|
40
34
|
if (resData.error) throw resData;
|
41
|
-
|
42
35
|
return callback();
|
43
36
|
})
|
44
|
-
.catch(function(err) {
|
37
|
+
.catch(function (err) {
|
45
38
|
log.error("deleteMessage", err);
|
46
39
|
return callback(err);
|
47
40
|
});
|
package/src/deleteThread.js
CHANGED
@@ -3,16 +3,16 @@
|
|
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 deleteThread(threadOrThreads, callback) {
|
8
|
-
var resolveFunc = function() {};
|
9
|
-
var rejectFunc = function() {};
|
10
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
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(err) {
|
15
|
+
callback = function (err) {
|
16
16
|
if (err) return rejectFunc(err);
|
17
17
|
resolveFunc();
|
18
18
|
};
|
@@ -22,24 +22,17 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
22
22
|
client: "mercury"
|
23
23
|
};
|
24
24
|
|
25
|
-
if (utils.getType(threadOrThreads) !== "Array")
|
26
|
-
|
27
|
-
for (var i = 0; i < threadOrThreads.length; i++)
|
28
|
-
form["ids[" + i + "]"] = threadOrThreads[i];
|
25
|
+
if (utils.getType(threadOrThreads) !== "Array") threadOrThreads = [threadOrThreads];
|
26
|
+
for (var i = 0; i < threadOrThreads.length; i++) form["ids[" + i + "]"] = threadOrThreads[i];
|
29
27
|
|
30
28
|
defaultFuncs
|
31
|
-
.post(
|
32
|
-
"https://www.facebook.com/ajax/mercury/delete_thread.php",
|
33
|
-
ctx.jar,
|
34
|
-
form
|
35
|
-
)
|
29
|
+
.post("https://www.facebook.com/ajax/mercury/delete_thread.php", ctx.jar, form)
|
36
30
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
37
|
-
.then(function(resData) {
|
31
|
+
.then(function (resData) {
|
38
32
|
if (resData.error) throw resData;
|
39
|
-
|
40
33
|
return callback();
|
41
34
|
})
|
42
|
-
.catch(function(err) {
|
35
|
+
.catch(function (err) {
|
43
36
|
log.error("deleteThread", err);
|
44
37
|
return callback(err);
|
45
38
|
});
|
package/src/forwardAttachment.js
CHANGED
@@ -3,16 +3,16 @@
|
|
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 forwardAttachment(attachmentID, userOrUsers, callback) {
|
8
|
-
var resolveFunc = function() {};
|
9
|
-
var rejectFunc = function() {};
|
10
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
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(err) {
|
15
|
+
callback = function (err) {
|
16
16
|
if (err) return rejectFunc(err);
|
17
17
|
resolveFunc();
|
18
18
|
};
|
@@ -28,22 +28,16 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
28
28
|
|
29
29
|
//That's good, the key of the array is really timestmap in seconds + index
|
30
30
|
//Probably time when the attachment will be sent?
|
31
|
-
for (var i = 0; i < userOrUsers.length; i++)
|
32
|
-
form["recipient_map[" + (timestamp + i) + "]"] = userOrUsers[i];
|
31
|
+
for (var i = 0; i < userOrUsers.length; i++) form["recipient_map[" + (timestamp + i) + "]"] = userOrUsers[i];
|
33
32
|
|
34
33
|
defaultFuncs
|
35
|
-
.post(
|
36
|
-
"https://www.facebook.com/mercury/attachments/forward/",
|
37
|
-
ctx.jar,
|
38
|
-
form
|
39
|
-
)
|
34
|
+
.post("https://www.facebook.com/mercury/attachments/forward/", ctx.jar, form)
|
40
35
|
.then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
|
41
|
-
.then(function(resData) {
|
36
|
+
.then(function (resData) {
|
42
37
|
if (resData.error) throw resData;
|
43
|
-
|
44
38
|
return callback();
|
45
39
|
})
|
46
|
-
.catch(function(err) {
|
40
|
+
.catch(function (err) {
|
47
41
|
log.error("forwardAttachment", err);
|
48
42
|
return callback(err);
|
49
43
|
});
|
File without changes
|
package/src/getCurrentUserID.js
CHANGED
package/src/getEmojiUrl.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
const util = require("util");
|
4
4
|
|
5
|
-
module.exports = function() {
|
5
|
+
module.exports = function () {
|
6
6
|
return function getEmojiUrl(c, size, pixelRatio) {
|
7
7
|
/*
|
8
8
|
Resolves Facebook Messenger emoji image asset URL for an emoji character.
|
@@ -19,8 +19,7 @@ module.exports = function() {
|
|
19
19
|
c.codePointAt(0).toString(16)
|
20
20
|
);
|
21
21
|
let base = 317426846;
|
22
|
-
for (let i = 0; i < ending.length; i++)
|
23
|
-
base = (base << 5) - base + ending.charCodeAt(i);
|
22
|
+
for (let i = 0; i < ending.length; i++) base = (base << 5) - base + ending.charCodeAt(i);
|
24
23
|
|
25
24
|
let hashed = (base & 255).toString(16);
|
26
25
|
return util.format(baseUrl, hashed, ending);
|
package/src/getFriendsList.js
CHANGED
@@ -21,7 +21,7 @@ var GENDERS = {
|
|
21
21
|
};
|
22
22
|
|
23
23
|
function formatData(obj) {
|
24
|
-
return Object.keys(obj).map(function(key) {
|
24
|
+
return Object.keys(obj).map(function (key) {
|
25
25
|
var user = obj[key];
|
26
26
|
return {
|
27
27
|
alternateName: user.alternateName,
|
@@ -39,40 +39,32 @@ function formatData(obj) {
|
|
39
39
|
});
|
40
40
|
}
|
41
41
|
|
42
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
42
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
43
43
|
return function getFriendsList(callback) {
|
44
|
-
var resolveFunc = function() {};
|
45
|
-
var rejectFunc = function() {};
|
46
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
44
|
+
var resolveFunc = function () { };
|
45
|
+
var rejectFunc = function () { };
|
46
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
47
47
|
resolveFunc = resolve;
|
48
48
|
rejectFunc = reject;
|
49
49
|
});
|
50
50
|
|
51
51
|
if (!callback) {
|
52
|
-
callback = function(err, friendList) {
|
52
|
+
callback = function (err, friendList) {
|
53
53
|
if (err) return rejectFunc(err);
|
54
54
|
resolveFunc(friendList);
|
55
55
|
};
|
56
56
|
}
|
57
57
|
|
58
58
|
defaultFuncs
|
59
|
-
.postFormData(
|
60
|
-
"https://www.facebook.com/chat/user_info_all",
|
61
|
-
ctx.jar,
|
62
|
-
{},
|
63
|
-
{ viewer: ctx.userID }
|
64
|
-
)
|
59
|
+
.postFormData("https://www.facebook.com/chat/user_info_all", ctx.jar, {}, { viewer: ctx.userID })
|
65
60
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
66
|
-
.then(function(resData) {
|
61
|
+
.then(function (resData) {
|
67
62
|
if (!resData) throw { error: "getFriendsList returned empty object." };
|
68
63
|
if (resData.error) throw resData;
|
69
64
|
callback(null, formatData(resData.payload));
|
70
65
|
})
|
71
|
-
.catch(function(err) {
|
72
|
-
log.error(
|
73
|
-
"getFriendsList",
|
74
|
-
"Lỗi getFriendsList Có Thể Do Bạn Spam Quá Nhiều ! Hãy Hạn Chế !"
|
75
|
-
);
|
66
|
+
.catch(function (err) {
|
67
|
+
log.error("getFriendsList", err);
|
76
68
|
return callback(err);
|
77
69
|
});
|
78
70
|
|