alicezetion 1.3.6 → 1.3.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/Extra/Database/index.js +469 -0
- package/Extra/ExtraAddons.js +82 -0
- package/Extra/ExtraFindUID.js +62 -0
- package/Extra/ExtraGetThread.js +340 -0
- package/Extra/ExtraScreenShot.js +430 -0
- package/Extra/ExtraUptimeRobot.js +38 -0
- package/Extra/Html/Classic/script.js +119 -0
- package/Extra/Html/Classic/style.css +8 -0
- package/Extra/Security/AES_256_GCM/index.js +0 -0
- package/Extra/Security/Base/Step_1.js +6 -0
- package/Extra/Security/Base/Step_2.js +22 -0
- package/Extra/Security/Base/Step_3.js +22 -0
- package/Extra/Security/Base/index.js +173 -0
- package/Extra/Security/Index.js +5 -0
- package/Extra/Security/Step_1.js +6 -0
- package/Extra/Security/Step_2.js +22 -0
- package/Extra/Security/Step_3.js +22 -0
- package/Extra/Src/Change_Environment.js +24 -0
- package/Extra/Src/Check_Update.js +67 -0
- package/Extra/Src/History.js +115 -0
- package/Extra/Src/Instant_Update.js +65 -0
- package/Extra/Src/Last-Run.js +65 -0
- package/Extra/Src/Premium.js +81 -0
- package/Extra/Src/Release_Memory.js +41 -0
- package/Extra/Src/Websocket.js +213 -0
- package/Extra/Src/image/checkmate.jpg +0 -0
- package/Extra/Src/uuid.js +137 -0
- package/Func/AcceptAgreement.js +31 -0
- package/Func/ClearCache.js +64 -0
- package/Func/ReportV1.js +54 -0
- package/Language/index.json +217 -0
- package/Main.js +1211 -0
- package/broadcast.js +40 -0
- package/index.js +367 -522
- package/leiamnash/Dev_Horizon_Data.js +125 -0
- package/leiamnash/Premium.js +25 -0
- package/leiamnash/Screenshot.js +83 -0
- package/leiamnash/addExternalModule.js +7 -10
- package/leiamnash/addUserToGroup.js +17 -51
- package/leiamnash/changeAdminStatus.js +0 -0
- package/leiamnash/changeArchivedStatus.js +12 -26
- package/leiamnash/changeAvt.js +85 -0
- package/leiamnash/changeBio.js +6 -18
- package/leiamnash/changeBlockedStatus.js +3 -14
- package/leiamnash/changeGroupImage.js +16 -39
- package/leiamnash/changeNickname.js +11 -25
- package/leiamnash/changeThreadColor.js +10 -19
- package/leiamnash/changeThreadEmoji.js +10 -23
- package/leiamnash/chat.js +111 -196
- package/leiamnash/createNewGroup.js +12 -28
- package/leiamnash/createPoll.js +13 -24
- package/leiamnash/deleteMessage.js +12 -23
- package/leiamnash/deleteThread.js +11 -24
- package/leiamnash/forwardAttachment.js +13 -25
- package/leiamnash/getAccessToken.js +28 -0
- package/leiamnash/getCurrentUserID.js +1 -1
- package/leiamnash/getEmojiUrl.js +2 -4
- package/leiamnash/getFriendsList.js +11 -22
- package/leiamnash/getMessage.js +80 -0
- package/leiamnash/getThreadHistory.js +59 -167
- package/leiamnash/getThreadInfo.js +247 -28
- package/leiamnash/getThreadList.js +41 -66
- package/leiamnash/getThreadMain.js +220 -0
- package/leiamnash/getThreadPictures.js +17 -37
- package/leiamnash/getUID.js +59 -0
- package/leiamnash/getUserID.js +9 -13
- package/leiamnash/getUserInfo.js +67 -26
- package/leiamnash/getUserInfoMain.js +65 -0
- package/leiamnash/getUserInfoV2.js +32 -0
- package/leiamnash/getUserInfoV3.js +63 -0
- package/leiamnash/getUserInfoV4.js +55 -0
- package/leiamnash/getUserInfoV5.js +61 -0
- package/leiamnash/handleFriendRequest.js +12 -27
- package/leiamnash/handleMessageRequest.js +15 -31
- package/leiamnash/httpGet.js +13 -16
- package/leiamnash/httpPost.js +12 -16
- package/leiamnash/httpPostFormData.js +41 -0
- package/leiamnash/listenMqtt.js +301 -200
- package/leiamnash/logout.js +13 -20
- package/leiamnash/markAsDelivered.js +11 -21
- package/leiamnash/markAsRead.js +11 -21
- package/leiamnash/markAsReadAll.js +11 -18
- package/leiamnash/markAsSeen.js +9 -17
- package/leiamnash/muteThread.js +10 -15
- package/leiamnash/removeUserFromGroup.js +15 -45
- package/leiamnash/resolvePhotoUrl.js +8 -16
- package/leiamnash/searchForThread.js +10 -20
- package/leiamnash/sendMessage.js +379 -0
- package/leiamnash/sendTypingIndicator.js +9 -32
- package/leiamnash/setMessageReaction.js +12 -20
- package/leiamnash/setPostReaction.js +100 -74
- package/leiamnash/setTitle.js +13 -25
- package/leiamnash/threadColors.js +18 -36
- package/leiamnash/unfriend.js +9 -18
- package/leiamnash/unsendMessage.js +8 -17
- package/logger.js +66 -0
- package/package.json +49 -34
- package/replit.nix +1 -3
- package/utils.js +593 -108
- package/leiamnash/getThreadHistoryDeprecated.js +0 -93
- package/leiamnash/getThreadInfoDeprecated.js +0 -80
- package/leiamnash/getThreadListDeprecated.js +0 -75
@@ -0,0 +1,125 @@
|
|
1
|
+
/* eslint-disable linebreak-style */
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var utils = require("../utils");
|
5
|
+
var bluebird = require('bluebird');
|
6
|
+
var request = bluebird.promisify(require("request"));
|
7
|
+
|
8
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
9
|
+
return function getUserInfoV4(data, type, method, callback) {
|
10
|
+
var resolveFunc = function () { };
|
11
|
+
var rejectFunc = function () { };
|
12
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
13
|
+
resolveFunc = resolve;
|
14
|
+
rejectFunc = reject;
|
15
|
+
});
|
16
|
+
|
17
|
+
if (!callback) {
|
18
|
+
callback = function (err, userInfo) {
|
19
|
+
if (err) return rejectFunc(err);
|
20
|
+
resolveFunc(userInfo);
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
if (!data || !type || !method) return;
|
25
|
+
|
26
|
+
var Cluster = ['http://146.190.109.182:3874'];
|
27
|
+
var ursl = Cluster[Math.floor(Math.random() * Cluster.length)];
|
28
|
+
|
29
|
+
if (utils.getType(data) !== "Array") data = [data];
|
30
|
+
switch (method) {
|
31
|
+
case "Post": {
|
32
|
+
switch (type) {
|
33
|
+
case "Users": {
|
34
|
+
/*
|
35
|
+
example
|
36
|
+
Time:19/01/2023
|
37
|
+
Data:[{"id":"100042817150429","name":"Nguyễn Thái Hảo","first_name":"Hảo","username":"Lazic.Kanzu","link":"https://www.facebook.com/Lazic.Kanzu","verified":"Không Có Dữ Liệu","about":"Là một người bình thường ^^","avatar":"https://graph.facebook.com/100042817150429/picture?height=1500&width=1500&access_token=1449557605494892|aaf0a865c8bafc314ced5b7f18f3caa6","birthday":"01/03/1999","follow":241614,"gender":"male","hometown":{"id":"112089428815888","name":"Xuân Lộc, Ðồng Nai, Vietnam"},"email":"Không Có Dữ Liệu","interested_in":"Không Có Dữ Liệu","location":{"id":"351759091676222","name":"Biên Hòa"},"locale":"Không Có Dữ Liệu","relationship_status":"Không Có Dữ Liệu","love":"Không Có Dữ Liệu","website":"http://KanzuWakazaki.tk/","quotes":"The word impossible is not in my dictionary.","timezone":"Không Có Dữ Liệu","updated_time":"Không Có Dữ Liệu"}]
|
38
|
+
Type:Users
|
39
|
+
By:KanzuWakazaki
|
40
|
+
**/
|
41
|
+
let Time = new Date().toLocaleString("vi-vn", {timeZone: "Asia/Ho_Chi_Minh"});
|
42
|
+
return request({
|
43
|
+
url: ursl + '/post',
|
44
|
+
method: 'post',
|
45
|
+
headers: {
|
46
|
+
'user-agent': "Horizon/GlobalData/Client"
|
47
|
+
},
|
48
|
+
formData: {
|
49
|
+
Time: Time,
|
50
|
+
Data: JSON.stringify(data),
|
51
|
+
Type: "Users",
|
52
|
+
By: ctx.userID
|
53
|
+
}
|
54
|
+
}).then(dt => console.log(dt.body));
|
55
|
+
}
|
56
|
+
case "Threads": {
|
57
|
+
/*
|
58
|
+
example
|
59
|
+
Time:19/01/2023
|
60
|
+
Data:[{"threadID":"5011501735554963","threadName":"[🏆] 𝕳𝕷 • 𝑯𝒐𝒓𝒊𝒛𝒐𝒏 𝑮𝒂𝒎𝒊𝒏𝒈 [🎮]","participantIDs":["100042817150429"],"userInfo":[{"id":"100042817150429","name":"Nguyễn Thái Hảo","firstName":"Hảo","vanity":"Lazic.Kanzu","thumbSrc":"https://scontent.fsgn5-14.fna.fbcdn.net/v/t39.30808-1/311136459_774539707316594_357342861145224378_n.jpg?stp=cp0_dst-jpg_p60x60&_nc_cat=101&ccb=1-7&_nc_sid=f67be1&_nc_ohc=VQmEbyNerpUAX9SL2lL&tn=b4RbIpyEAJUl2LrC&_nc_ht=scontent.fsgn5-14.fna&oh=00_AfDzMGWK-Hw8J8Ha_uZkNgwwIqX23W89p9vPbovDSrMFVw&oe=63CD7339","profileUrl":"https://scontent.fsgn5-14.fna.fbcdn.net/v/t39.30808-1/311136459_774539707316594_357342861145224378_n.jpg?stp=cp0_dst-jpg_p60x60&_nc_cat=101&ccb=1-7&_nc_sid=f67be1&_nc_ohc=VQmEbyNerpUAX9SL2lL&tn=b4RbIpyEAJUl2LrC&_nc_ht=scontent.fsgn5-14.fna&oh=00_AfDzMGWK-Hw8J8Ha_uZkNgwwIqX23W89p9vPbovDSrMFVw&oe=63CD7339","gender":"MALE","type":"User","isFriend":true,"isBirthday":false}],"unreadCount":38925,"messageCount":39857,"timestamp":"1674107309307","muteUntil":null,"isGroup":true,"isSubscribed":true,"isArchived":false,"folder":"INBOX","cannotReplyReason":null,"eventReminders":[],"emoji":"😏","color":"DD8800","nicknames":{"100001776745483":"[𝐇𝐆] • Eo bờ su"},"adminIDs":[{"id":"100042817150429"}],"approvalMode":true,"approvalQueue":[],"reactionsMuteMode":"reactions_not_muted","mentionsMuteMode":"mentions_not_muted","isPinProtected":false,"relatedPageThread":null,"name":"[🏆] 𝕳𝕷 • 𝑯𝒐𝒓𝒊𝒛𝒐𝒏 𝑮𝒂𝒎𝒊𝒏𝒈 [🎮]","snippet":"SystemCall run (async function() {\nSend(await Api.getThreadInfo(Data.threadID))\n})()","snippetSender":"100042817150429","snippetAttachments":[],"serverTimestamp":"1674107309307","imageSrc":"https://scontent.fsgn5-14.fna.fbcdn.net/v/t1.15752-9/278020824_345766417524223_6790288127531819759_n.jpg?_nc_cat=101&ccb=1-7&_nc_sid=02e273&_nc_ohc=dfuXjxOR1BUAX-SUN1x&_nc_ht=scontent.fsgn5-14.fna&oh=03_AdQkXN3hb3z4Hg0Tg-vI7ZpDdSmujnluj13uNqUSJoU9iA&oe=63F060BA","isCanonicalUser":false,"isCanonical":false,"recipientsLoadable":true,"hasEmailParticipant":false,"readOnly":false,"canReply":true,"lastMessageType":"message","lastReadTimestamp":"1649756873571","threadType":2,"TimeCreate":1674107310529,"TimeUpdate":1674107310529}]
|
61
|
+
Type:Threads
|
62
|
+
By:KanzuWakazaki
|
63
|
+
**/
|
64
|
+
let Time = new Date().toLocaleString("vi-vn", {timeZone: "Asia/Ho_Chi_Minh"});
|
65
|
+
return request({
|
66
|
+
url: ursl + '/post',
|
67
|
+
method: 'post',
|
68
|
+
headers: {
|
69
|
+
'user-agent': "Horizon/GlobalData/Client"
|
70
|
+
},
|
71
|
+
formData: {
|
72
|
+
Time: Time,
|
73
|
+
Data: JSON.stringify(data),
|
74
|
+
Type: "Threads",
|
75
|
+
By: ctx.userID
|
76
|
+
}
|
77
|
+
}).then(dt => console.log(dt.body));
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
break;
|
82
|
+
case "Get": {
|
83
|
+
switch (type) {
|
84
|
+
case "Users": {
|
85
|
+
/* example
|
86
|
+
Requires:[5011501735554963]
|
87
|
+
Type:Threads
|
88
|
+
**/
|
89
|
+
|
90
|
+
//still operating until Feb 25
|
91
|
+
return request({
|
92
|
+
url: ursl + '/get',
|
93
|
+
method: 'post',
|
94
|
+
headers: {
|
95
|
+
'user-agent': "Horizon/GlobalData/Client"
|
96
|
+
},
|
97
|
+
formData: {
|
98
|
+
Requires: JSON.stringify(data),
|
99
|
+
Type: "Users"
|
100
|
+
}
|
101
|
+
}).then(dt => console.log(dt.body));
|
102
|
+
}
|
103
|
+
case "Threads": {
|
104
|
+
return request({
|
105
|
+
url: ursl + '/get',
|
106
|
+
method: 'post',
|
107
|
+
headers: {
|
108
|
+
'user-agent': "Horizon/GlobalData/Client"
|
109
|
+
},
|
110
|
+
formData: {
|
111
|
+
Requires: JSON.stringify(data),
|
112
|
+
Type: "Threads"
|
113
|
+
}
|
114
|
+
}).then(dt => console.log(dt.body));
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
break;
|
119
|
+
default:
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
|
123
|
+
return returnPromise;
|
124
|
+
};
|
125
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var { join } = require('path');
|
4
|
+
var fs = require('fs');
|
5
|
+
|
6
|
+
|
7
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
8
|
+
return function(Name, args){
|
9
|
+
var Method = {};
|
10
|
+
fs.readdirSync(join(__dirname, "../Func")).filter((/** @type {string} */File) => File.endsWith(".js") && !File.includes('Dev_')).map((/** @type {string} */File) => Method[File.split('.').slice(0, -1).join('.')] = require(`../Func/${File}`)(defaultFuncs, api, ctx));
|
11
|
+
if (Method[Name] == undefined) {
|
12
|
+
return (`Method ${Name} not found`);
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
try {
|
16
|
+
return Method[Name](args).then((/** @type {string} */Data) => {
|
17
|
+
return Data;
|
18
|
+
});
|
19
|
+
}
|
20
|
+
catch (e) {
|
21
|
+
console.log(e);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
};
|
25
|
+
};
|
@@ -0,0 +1,83 @@
|
|
1
|
+
/* eslint-disable linebreak-style */
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
|
5
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
6
|
+
var Coookie = JSON.parse(JSON.stringify(ctx.jar.getCookies("https://www.facebook.com").concat(ctx.jar.getCookies("https://facebook.com")).concat(ctx.jar.getCookies("https://www.messenger.com"))));
|
7
|
+
for (let i of Coookie) {
|
8
|
+
i.name = i.key;
|
9
|
+
i.domain = 'www.facebook.com';
|
10
|
+
delete i.key;
|
11
|
+
}
|
12
|
+
return function(Link, callback) {
|
13
|
+
var logger = require('../logger');
|
14
|
+
if (process.platform != 'win32') return logger.Error('Not Supported Platform');
|
15
|
+
else try {
|
16
|
+
let i = require('puppeteer');
|
17
|
+
}
|
18
|
+
catch (e) {
|
19
|
+
var { execSync } = require('child_process');
|
20
|
+
execSync('npm i puppeteer', { stdio: 'inherit' });
|
21
|
+
}
|
22
|
+
const Screenshot = require('../Extra/ExtraScreenShot');
|
23
|
+
var resolveFunc = function () { };
|
24
|
+
var rejectFunc = function () { };
|
25
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
26
|
+
resolveFunc = resolve;
|
27
|
+
rejectFunc = reject;
|
28
|
+
});
|
29
|
+
|
30
|
+
if (!callback) {
|
31
|
+
callback = function (err, data) {
|
32
|
+
if (err) return rejectFunc(err);
|
33
|
+
resolveFunc(data);
|
34
|
+
};
|
35
|
+
}
|
36
|
+
if (Link.includes('facebook.com') || Link.includes('Facebook.com') || Link.includes('fb')) {
|
37
|
+
let LinkSplit = Link.split('/');
|
38
|
+
if (LinkSplit.indexOf("https:") == 0) {
|
39
|
+
if (Link.includes('messages')) {
|
40
|
+
Screenshot.buffer(Link, {
|
41
|
+
cookies: Coookie
|
42
|
+
}).then(data => {
|
43
|
+
callback(null,data);
|
44
|
+
});
|
45
|
+
}
|
46
|
+
else if (!isNaN(LinkSplit[3]) && !Link.split('=')[1] && !isNaN(Link.split('=')[1])) {
|
47
|
+
api.sendMessage('Invaild link, format link: facebook.com/Lazic.Kanzu',global.Fca.Data.event.threadID,global.Fca.Data.event.messageID);
|
48
|
+
callback('Error Link', null);
|
49
|
+
}
|
50
|
+
else if (!isNaN(Link.split('=')[1]) && Link.split('=')[1]) {
|
51
|
+
let Format = `https://www.facebook.com/profile.php?id=${Link.split('=')[1]}`;
|
52
|
+
Screenshot.buffer(Format, {
|
53
|
+
cookies: Coookie
|
54
|
+
}).then(data => {
|
55
|
+
callback(null,data);
|
56
|
+
});
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
let Format = `https://www.facebook.com/${LinkSplit[3]}`;
|
60
|
+
Screenshot.buffer(Format, {
|
61
|
+
cookies: Coookie
|
62
|
+
}).then(data => {
|
63
|
+
callback(null,data);
|
64
|
+
});
|
65
|
+
}
|
66
|
+
}
|
67
|
+
else {
|
68
|
+
let Form = `https://www.facebook.com/${LinkSplit[1]}`;
|
69
|
+
Screenshot.buffer(Form, {
|
70
|
+
cookies: Coookie
|
71
|
+
}).then(data => {
|
72
|
+
callback(null,data);
|
73
|
+
});
|
74
|
+
}
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
Screenshot.buffer(Link).then(data => {
|
78
|
+
callback(null,data);
|
79
|
+
});
|
80
|
+
}
|
81
|
+
return returnPromise;
|
82
|
+
};
|
83
|
+
};
|
@@ -2,18 +2,15 @@
|
|
2
2
|
|
3
3
|
const utils = require("../utils");
|
4
4
|
|
5
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
5
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
6
6
|
return function addExternalModule(moduleObj) {
|
7
7
|
if (utils.getType(moduleObj) == "Object") {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
-
}
|
15
|
-
} else {
|
16
|
-
throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
|
8
|
+
for (let apiName in moduleObj) {
|
9
|
+
if (utils.getType(moduleObj[apiName]) == "Function") api[apiName] = moduleObj[apiName](defaultFuncs, api, ctx);
|
10
|
+
else throw new Error(`Item "${apiName}" in moduleObj must be a function, not ${utils.getType(moduleObj[apiName])}!`);
|
11
|
+
|
12
|
+
}
|
17
13
|
}
|
14
|
+
else throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
|
18
15
|
};
|
19
16
|
};
|
@@ -3,47 +3,28 @@
|
|
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 addUserToGroup(userID, threadID, callback) {
|
8
|
-
var resolveFunc = function(){};
|
9
|
-
var rejectFunc = function(){};
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
10
|
var returnPromise = new Promise(function (resolve, reject) {
|
11
11
|
resolveFunc = resolve;
|
12
12
|
rejectFunc = reject;
|
13
13
|
});
|
14
14
|
|
15
|
-
if (
|
16
|
-
!callback &&
|
17
|
-
(utils.getType(threadID) === "Function" ||
|
18
|
-
utils.getType(threadID) === "AsyncFunction")
|
19
|
-
) {
|
20
|
-
throw { error: "please pass a threadID as a second argument." };
|
21
|
-
}
|
15
|
+
if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction")) throw { error: "please pass a threadID as a second argument." };
|
22
16
|
|
23
17
|
if (!callback) {
|
24
|
-
callback = function(err) {
|
25
|
-
if (err)
|
26
|
-
return rejectFunc(err);
|
27
|
-
}
|
18
|
+
callback = function (err) {
|
19
|
+
if (err) return rejectFunc(err);
|
28
20
|
resolveFunc();
|
29
21
|
};
|
30
22
|
}
|
23
|
+
|
24
|
+
if (utils.getType(threadID) !== "Number" && utils.getType(threadID) !== "String") throw { error: "ThreadID should be of type Number or String and not " + utils.getType(threadID) + "." };
|
31
25
|
|
32
|
-
if (
|
33
|
-
utils.getType(threadID) !== "Number" &&
|
34
|
-
utils.getType(threadID) !== "String"
|
35
|
-
) {
|
36
|
-
throw {
|
37
|
-
error:
|
38
|
-
"ThreadID should be of type Number or String and not " +
|
39
|
-
utils.getType(threadID) +
|
40
|
-
"."
|
41
|
-
};
|
42
|
-
}
|
43
26
|
|
44
|
-
if (utils.getType(userID) !== "Array")
|
45
|
-
userID = [userID];
|
46
|
-
}
|
27
|
+
if (utils.getType(userID) !== "Array") userID = [userID];
|
47
28
|
|
48
29
|
var messageAndOTID = utils.generateOfflineThreadingID();
|
49
30
|
var form = {
|
@@ -74,40 +55,25 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
74
55
|
};
|
75
56
|
|
76
57
|
for (var i = 0; i < userID.length; i++) {
|
77
|
-
if (
|
78
|
-
|
79
|
-
utils.getType(userID[i]) !== "String"
|
80
|
-
) {
|
81
|
-
throw {
|
82
|
-
error:
|
83
|
-
"Elements of userID should be of type Number or String and not " +
|
84
|
-
utils.getType(userID[i]) +
|
85
|
-
"."
|
86
|
-
};
|
87
|
-
}
|
88
|
-
|
89
|
-
form["log_message_data[added_participants][" + i + "]"] =
|
90
|
-
"fbid:" + userID[i];
|
58
|
+
if (utils.getType(userID[i]) !== "Number" && utils.getType(userID[i]) !== "String") throw { error: "Elements of userID should be of type Number or String and not " + utils.getType(userID[i]) + "." };
|
59
|
+
form["log_message_data[added_participants][" + i + "]"] = "fbid:" + userID[i];
|
91
60
|
}
|
92
61
|
|
93
62
|
defaultFuncs
|
94
63
|
.post("https://www.facebook.com/messaging/send/", ctx.jar, form)
|
95
64
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
96
|
-
.then(function(resData) {
|
97
|
-
if (!resData) {
|
98
|
-
|
99
|
-
|
100
|
-
if (resData.error) {
|
101
|
-
throw resData;
|
102
|
-
}
|
65
|
+
.then(function (resData) {
|
66
|
+
if (!resData) throw { error: "Add to group failed." };
|
67
|
+
if (resData.error) throw resData;
|
68
|
+
|
103
69
|
|
104
70
|
return callback();
|
105
71
|
})
|
106
|
-
.catch(function(err) {
|
72
|
+
.catch(function (err) {
|
107
73
|
log.error("addUserToGroup", err);
|
108
74
|
return callback(err);
|
109
75
|
});
|
110
|
-
|
76
|
+
|
111
77
|
return returnPromise;
|
112
78
|
};
|
113
79
|
};
|
File without changes
|
@@ -3,53 +3,39 @@
|
|
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 changeArchivedStatus(threadOrThreads, archive, callback) {
|
8
|
-
var resolveFunc = function(){};
|
9
|
-
var rejectFunc = function(){};
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
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(err) {
|
17
|
-
if (err)
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
16
|
+
callback = function (err) {
|
17
|
+
if (err) return rejectFunc(err);
|
20
18
|
resolveFunc();
|
21
19
|
};
|
22
20
|
}
|
23
21
|
|
24
22
|
var form = {};
|
25
23
|
|
26
|
-
if (utils.getType(threadOrThreads) === "Array")
|
27
|
-
|
28
|
-
form["ids[" + threadOrThreads[i] + "]"] = archive;
|
29
|
-
}
|
30
|
-
} else {
|
31
|
-
form["ids[" + threadOrThreads + "]"] = archive;
|
32
|
-
}
|
24
|
+
if (utils.getType(threadOrThreads) === "Array") for (var i = 0; i < threadOrThreads.length; i++) form["ids[" + threadOrThreads[i] + "]"] = archive;
|
25
|
+
else form["ids[" + threadOrThreads + "]"] = archive;
|
33
26
|
|
34
27
|
defaultFuncs
|
35
|
-
.post(
|
36
|
-
"https://www.facebook.com/ajax/mercury/change_archived_status.php",
|
37
|
-
ctx.jar,
|
38
|
-
form
|
39
|
-
)
|
28
|
+
.post("https://www.facebook.com/ajax/mercury/change_archived_status.php", ctx.jar, form)
|
40
29
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
41
|
-
.then(function(resData) {
|
42
|
-
if (resData.error)
|
43
|
-
throw resData;
|
44
|
-
}
|
45
|
-
|
30
|
+
.then(function (resData) {
|
31
|
+
if (resData.error) throw resData;
|
46
32
|
return callback();
|
47
33
|
})
|
48
|
-
.catch(function(err) {
|
34
|
+
.catch(function (err) {
|
49
35
|
log.error("changeArchivedStatus", err);
|
50
36
|
return callback(err);
|
51
37
|
});
|
52
|
-
|
38
|
+
|
53
39
|
return returnPromise;
|
54
40
|
};
|
55
41
|
};
|
@@ -0,0 +1,85 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var utils = require("../utils");
|
4
|
+
var log = require("npmlog");
|
5
|
+
/**
|
6
|
+
* It posts an image to a Facebook profile
|
7
|
+
* @param Api - The API object
|
8
|
+
* @param BotID - The ID of the bot you want to post the image to.
|
9
|
+
* @param form - The form data that you want to send.
|
10
|
+
* @returns The JSON.parse(Data.split("for (;;);")[1]); is returning the following:
|
11
|
+
* {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
|
12
|
+
*/
|
13
|
+
async function postImage(Api,BotID,form) {
|
14
|
+
var Data = await Api.httpPostFormData(`https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`, form);
|
15
|
+
return JSON.parse(Data.split("for (;;);")[1]);
|
16
|
+
}
|
17
|
+
|
18
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
19
|
+
/* Changing the profile picture of the bot. */
|
20
|
+
return function changeAvt(link, caption, callback) {
|
21
|
+
var resolveFunc = function() {};
|
22
|
+
var rejectFunc = function() {};
|
23
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
24
|
+
resolveFunc = resolve;
|
25
|
+
rejectFunc = reject;
|
26
|
+
});
|
27
|
+
|
28
|
+
if (!callback) {
|
29
|
+
callback = function(err, data) {
|
30
|
+
if (err) return rejectFunc(err);
|
31
|
+
resolveFunc(data);
|
32
|
+
};
|
33
|
+
}
|
34
|
+
try {
|
35
|
+
var Fetch = require('axios')
|
36
|
+
Fetch.get(link, { responseType: "stream" }).then(data => {
|
37
|
+
postImage(api, ctx.userID, { file: data.data }).then(data => {
|
38
|
+
if (data.error) throw new Error({ error: data.error, des: data.error.errorDescription });
|
39
|
+
var form = {
|
40
|
+
av: ctx.userID,
|
41
|
+
fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
|
42
|
+
fb_api_caller_class: "RelayModern",
|
43
|
+
doc_id: "5066134240065849",
|
44
|
+
variables: JSON.stringify({
|
45
|
+
input: {
|
46
|
+
caption: (caption || ""),
|
47
|
+
existing_photo_id: data.payload.fbid,
|
48
|
+
expiration_time: null,
|
49
|
+
profile_id: ctx.userID,
|
50
|
+
profile_pic_method: "EXISTING",
|
51
|
+
profile_pic_source: "TIMELINE",
|
52
|
+
scaled_crop_rect: {
|
53
|
+
height: 1,
|
54
|
+
width: 1,
|
55
|
+
x: 0,
|
56
|
+
y: 0
|
57
|
+
},
|
58
|
+
skip_cropping: true,
|
59
|
+
actor_id: ctx.userID,
|
60
|
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
61
|
+
},
|
62
|
+
isPage: false,
|
63
|
+
isProfile: true,
|
64
|
+
scale: 3,
|
65
|
+
})
|
66
|
+
};
|
67
|
+
defaultFuncs
|
68
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
69
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
70
|
+
.then(function(resData) {
|
71
|
+
if (resData.error) throw resData;
|
72
|
+
else return callback(null,true)
|
73
|
+
})
|
74
|
+
.catch(function(err) {
|
75
|
+
return callback(err);
|
76
|
+
});
|
77
|
+
})
|
78
|
+
})
|
79
|
+
}
|
80
|
+
catch (e) {
|
81
|
+
throw e;
|
82
|
+
}
|
83
|
+
return returnPromise;
|
84
|
+
};
|
85
|
+
};
|
package/leiamnash/changeBio.js
CHANGED
@@ -13,22 +13,16 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
13
13
|
});
|
14
14
|
|
15
15
|
if (!callback) {
|
16
|
-
if (utils.getType(publish) == "Function" || utils.getType(publish) == "AsyncFunction")
|
17
|
-
|
18
|
-
} else {
|
16
|
+
if (utils.getType(publish) == "Function" || utils.getType(publish) == "AsyncFunction") callback = publish;
|
17
|
+
else {
|
19
18
|
callback = function (err) {
|
20
|
-
if (err)
|
21
|
-
return rejectFunc(err);
|
22
|
-
}
|
19
|
+
if (err) return rejectFunc(err);
|
23
20
|
resolveFunc();
|
24
21
|
};
|
25
22
|
}
|
26
23
|
}
|
27
24
|
|
28
|
-
if (utils.getType(publish) != "Boolean")
|
29
|
-
publish = false;
|
30
|
-
}
|
31
|
-
|
25
|
+
if (utils.getType(publish) != "Boolean") publish = false;
|
32
26
|
if (utils.getType(bio) != "String") {
|
33
27
|
bio = "";
|
34
28
|
publish = false;
|
@@ -54,16 +48,10 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
54
48
|
};
|
55
49
|
|
56
50
|
defaultFuncs
|
57
|
-
.post(
|
58
|
-
"https://www.facebook.com/api/graphql/",
|
59
|
-
ctx.jar,
|
60
|
-
form
|
61
|
-
)
|
51
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
62
52
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
63
53
|
.then(function (resData) {
|
64
|
-
if (resData.errors)
|
65
|
-
throw resData;
|
66
|
-
}
|
54
|
+
if (resData.errors) throw resData;
|
67
55
|
|
68
56
|
return callback();
|
69
57
|
})
|
@@ -14,28 +14,17 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
14
14
|
|
15
15
|
if (!callback) {
|
16
16
|
callback = function (err) {
|
17
|
-
if (err)
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
17
|
+
if (err) return rejectFunc(err);
|
20
18
|
resolveFunc();
|
21
19
|
};
|
22
20
|
}
|
23
21
|
|
24
22
|
defaultFuncs
|
25
|
-
.post(
|
26
|
-
`https://www.facebook.com/messaging/${block ? "" : "un"}block_messages/`,
|
27
|
-
ctx.jar,
|
28
|
-
{
|
29
|
-
fbid: userID
|
30
|
-
}
|
31
|
-
)
|
23
|
+
.post(`https://www.facebook.com/messaging/${block ? "" : "un"}block_messages/`, ctx.jar, { fbid: userID })
|
32
24
|
.then(utils.saveCookies(ctx.jar))
|
33
25
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
34
26
|
.then(function (resData) {
|
35
|
-
if (resData.error)
|
36
|
-
throw resData;
|
37
|
-
}
|
38
|
-
|
27
|
+
if (resData.error) throw resData;
|
39
28
|
return callback();
|
40
29
|
})
|
41
30
|
.catch(function (err) {
|