alicezetion 1.0.3 → 1.0.4
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 +532 -604
- package/package.json +78 -75
- package/replit.nix +5 -0
- package/src/addExternalModule.js +15 -0
- package/{alice → src}/addUserToGroup.js +77 -113
- package/src/changeAdminStatus.js +47 -0
- package/src/changeArchivedStatus.js +41 -0
- package/{alice → src}/changeBio.js +64 -77
- package/{alice → src}/changeBlockedStatus.js +36 -47
- package/{alice → src}/changeGroupImage.js +105 -129
- package/src/changeNickname.js +43 -0
- package/{alice → src}/changeThreadColor.js +61 -71
- package/src/changeThreadEmoji.js +41 -0
- package/src/chat.js +315 -0
- package/{alice → src}/createNewGroup.js +70 -86
- package/{alice → src}/createPoll.js +59 -71
- package/src/deleteMessage.js +44 -0
- package/src/deleteThread.js +42 -0
- package/src/forwardAttachment.js +47 -0
- package/src/forwardMessage.js +0 -0
- package/{alice → src}/getCurrentUserID.js +7 -7
- package/{alice → src}/getEmojiUrl.js +27 -29
- package/{alice → src}/getFriendsList.js +73 -84
- package/{alice → src}/getThreadHistory.js +537 -645
- package/src/getThreadHistoryDeprecated.js +71 -0
- package/{alice → src}/getThreadInfo.js +171 -206
- package/src/getThreadInfoDeprecated.js +56 -0
- package/{alice → src}/getThreadList.js +213 -238
- package/src/getThreadListDeprecated.js +46 -0
- package/src/getThreadPictures.js +59 -0
- package/{alice → src}/getUserID.js +61 -66
- package/{alice → src}/getUserInfo.js +66 -72
- package/src/handleFriendRequest.js +46 -0
- package/src/handleMessageRequest.js +47 -0
- package/{alice → src}/httpGet.js +47 -52
- package/{alice → src}/httpPost.js +47 -52
- package/src/listen.js +553 -0
- package/src/listenMqtt-Test.js +687 -0
- package/src/listenMqtt.js +677 -0
- package/{alice → src}/logout.js +68 -75
- package/{alice → src}/markAsDelivered.js +47 -58
- package/{alice → src}/markAsRead.js +70 -80
- package/{alice/seen.js → src/markAsReadAll.js} +39 -49
- package/{alice → src}/markAsSeen.js +48 -59
- package/{alice → src}/muteThread.js +45 -52
- package/src/removeUserFromGroup.js +45 -0
- package/{alice → src}/resolvePhotoUrl.js +36 -45
- package/src/searchForThread.js +42 -0
- package/{alice → src}/sendTypingIndicator.js +70 -103
- package/{alice/react.js → src/setMessageReaction.js} +103 -117
- package/{alice → src}/setPostReaction.js +63 -76
- package/{alice → src}/setTitle.js +70 -86
- package/src/threadColors.js +41 -0
- package/{alice → src}/unfriend.js +42 -52
- package/{alice → src}/unsendMessage.js +39 -49
- package/utils.js +1190 -1357
- package/alice/addExternalModule.js +0 -19
- package/alice/changeAdminStatus.js +0 -79
- package/alice/changeArchivedStatus.js +0 -55
- package/alice/changeNickname.js +0 -59
- package/alice/changeThreadEmoji.js +0 -55
- package/alice/chat.js +0 -459
- package/alice/deleteMessage.js +0 -56
- package/alice/deleteThread.js +0 -56
- package/alice/forwardAttachment.js +0 -60
- package/alice/getThreadHistoryDeprecated.js +0 -93
- package/alice/getThreadInfoDeprecated.js +0 -80
- package/alice/getThreadListDeprecated.js +0 -75
- package/alice/getThreadPictures.js +0 -79
- package/alice/handleFriendRequest.js +0 -61
- package/alice/handleMessageRequest.js +0 -65
- package/alice/listenMqtt.js +0 -789
- package/alice/removeUserFromGroup.js +0 -79
- package/alice/searchForThread.js +0 -53
- package/alice/threadColors.js +0 -57
- 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/package.json
CHANGED
@@ -1,76 +1,79 @@
|
|
1
|
-
{
|
2
|
-
"name": "alicezetion",
|
3
|
-
"version": "1.0.
|
4
|
-
"description": "
|
5
|
-
"scripts": {
|
6
|
-
"test": "mocha",
|
7
|
-
"lint": "
|
8
|
-
"prettier": "prettier utils.js src/* --write"
|
9
|
-
},
|
10
|
-
"repository": {
|
11
|
-
"type": "git",
|
12
|
-
"url": "
|
13
|
-
},
|
14
|
-
"keywords": [
|
15
|
-
"messenger",
|
1
|
+
{
|
2
|
+
"name": "alicezetion",
|
3
|
+
"version": "1.0.4",
|
4
|
+
"description": "Artificial labile intelligence cybernated existence",
|
5
|
+
"scripts": {
|
6
|
+
"test": "mocha",
|
7
|
+
"lint": "eslint **.js",
|
8
|
+
"prettier": "prettier utils.js src/* --write"
|
9
|
+
},
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": ""
|
13
|
+
},
|
14
|
+
"keywords": [
|
16
15
|
"alice",
|
17
|
-
"leiamnash"
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
"
|
24
|
-
"
|
25
|
-
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
"
|
39
|
-
"
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
"
|
45
|
-
"
|
46
|
-
|
47
|
-
|
48
|
-
"
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
"
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
"
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
"
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
16
|
+
"leiamnash"
|
17
|
+
],
|
18
|
+
"bugs": {
|
19
|
+
"url": ""
|
20
|
+
},
|
21
|
+
"author": "LeiamNash",
|
22
|
+
"license": "MIT",
|
23
|
+
"dependencies": {
|
24
|
+
"bluebird": "^2.11.0",
|
25
|
+
"cheerio": "^1.0.0-rc.10",
|
26
|
+
"https-proxy-agent": "^4.0.0",
|
27
|
+
"mqtt": "^4.2.8",
|
28
|
+
"npmlog": "^1.2.0",
|
29
|
+
"request": "^2.53.0",
|
30
|
+
"websocket-stream": "^5.5.0"
|
31
|
+
},
|
32
|
+
"engines": {
|
33
|
+
"node": ">=10.x"
|
34
|
+
},
|
35
|
+
"devDependencies": {
|
36
|
+
"eslint": "^7.32.0",
|
37
|
+
"mocha": "^7.0.1",
|
38
|
+
"prettier": "^1.11.1"
|
39
|
+
},
|
40
|
+
"eslintConfig": {
|
41
|
+
"env": {
|
42
|
+
"es6": true,
|
43
|
+
"es2017": true,
|
44
|
+
"node": true
|
45
|
+
},
|
46
|
+
"extends": "eslint:recommended",
|
47
|
+
"parserOptions": {
|
48
|
+
"sourceType": "module"
|
49
|
+
},
|
50
|
+
"rules": {
|
51
|
+
"linebreak-style": [
|
52
|
+
"error",
|
53
|
+
"unix"
|
54
|
+
],
|
55
|
+
"semi": [
|
56
|
+
"error",
|
57
|
+
"always"
|
58
|
+
],
|
59
|
+
"no-unused-vars": [
|
60
|
+
1,
|
61
|
+
{
|
62
|
+
"argsIgnorePattern": "^_",
|
63
|
+
"varsIgnorePattern": "^_"
|
64
|
+
}
|
65
|
+
],
|
66
|
+
"no-empty": [
|
67
|
+
"error",
|
68
|
+
{
|
69
|
+
"allowEmptyCatch": true
|
70
|
+
}
|
71
|
+
]
|
72
|
+
}
|
73
|
+
},
|
74
|
+
"homepage": "https://github.com/manhkhac/lawerpr0ject-api#readme",
|
75
|
+
"main": "index.js",
|
76
|
+
"directories": {
|
77
|
+
"test": "test"
|
78
|
+
}
|
79
|
+
}
|
package/replit.nix
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
|
5
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
6
|
+
return function addExternalModule(moduleObj) {
|
7
|
+
if (utils.getType(moduleObj) == "Object") {
|
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
|
+
}
|
13
|
+
else throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
|
14
|
+
};
|
15
|
+
};
|
@@ -1,113 +1,77 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var utils = require("../utils");
|
4
|
-
var log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
-
return function addUserToGroup(userID, threadID, callback) {
|
8
|
-
var resolveFunc = function(){};
|
9
|
-
var rejectFunc = function(){};
|
10
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
utils.getType(userID[i]) !== "Number" &&
|
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];
|
91
|
-
}
|
92
|
-
|
93
|
-
defaultFuncs
|
94
|
-
.post("https://www.facebook.com/messaging/send/", ctx.jar, form)
|
95
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
96
|
-
.then(function(resData) {
|
97
|
-
if (!resData) {
|
98
|
-
throw { error: "Add to group failed." };
|
99
|
-
}
|
100
|
-
if (resData.error) {
|
101
|
-
throw resData;
|
102
|
-
}
|
103
|
-
|
104
|
-
return callback();
|
105
|
-
})
|
106
|
-
.catch(function(err) {
|
107
|
-
log.error("addUserToGroup", err);
|
108
|
-
return callback(err);
|
109
|
-
});
|
110
|
-
|
111
|
-
return returnPromise;
|
112
|
-
};
|
113
|
-
};
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var utils = require("../utils");
|
4
|
+
var log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function addUserToGroup(userID, threadID, callback) {
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
15
|
+
if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction")) throw { error: "please pass a threadID as a second argument." };
|
16
|
+
|
17
|
+
if (!callback) {
|
18
|
+
callback = function (err) {
|
19
|
+
if (err) return rejectFunc(err);
|
20
|
+
resolveFunc();
|
21
|
+
};
|
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) + "." };
|
25
|
+
|
26
|
+
if (utils.getType(userID) !== "Array") userID = [userID];
|
27
|
+
|
28
|
+
var messageAndOTID = utils.generateOfflineThreadingID();
|
29
|
+
var form = {
|
30
|
+
client: "mercury",
|
31
|
+
action_type: "ma-type:log-message",
|
32
|
+
author: "fbid:" + ctx.userID,
|
33
|
+
thread_id: "",
|
34
|
+
timestamp: Date.now(),
|
35
|
+
timestamp_absolute: "Today",
|
36
|
+
timestamp_relative: utils.generateTimestampRelative(),
|
37
|
+
timestamp_time_passed: "0",
|
38
|
+
is_unread: false,
|
39
|
+
is_cleared: false,
|
40
|
+
is_forward: false,
|
41
|
+
is_filtered_content: false,
|
42
|
+
is_filtered_content_bh: false,
|
43
|
+
is_filtered_content_account: false,
|
44
|
+
is_spoof_warning: false,
|
45
|
+
source: "source:chat:web",
|
46
|
+
"source_tags[0]": "source:chat",
|
47
|
+
log_message_type: "log:subscribe",
|
48
|
+
status: "0",
|
49
|
+
offline_threading_id: messageAndOTID,
|
50
|
+
message_id: messageAndOTID,
|
51
|
+
threading_id: utils.generateThreadingID(ctx.clientID),
|
52
|
+
manual_retry_cnt: "0",
|
53
|
+
thread_fbid: threadID
|
54
|
+
};
|
55
|
+
|
56
|
+
for (var i = 0; i < userID.length; i++) {
|
57
|
+
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]) + "." };
|
58
|
+
form["log_message_data[added_participants][" + i + "]"] = "fbid:" + userID[i];
|
59
|
+
}
|
60
|
+
|
61
|
+
defaultFuncs
|
62
|
+
.post("https://www.facebook.com/messaging/send/", ctx.jar, form)
|
63
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
64
|
+
.then(function (resData) {
|
65
|
+
if (!resData) throw { error: "Add to group failed." };
|
66
|
+
if (resData.error) throw resData;
|
67
|
+
|
68
|
+
return callback();
|
69
|
+
})
|
70
|
+
.catch(function (err) {
|
71
|
+
log.error("addUserToGroup", "» Cannot add user to the voice chat. Please try again after");
|
72
|
+
return callback(err);
|
73
|
+
});
|
74
|
+
|
75
|
+
return returnPromise;
|
76
|
+
};
|
77
|
+
};
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
|
5
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
6
|
+
return function changeAdminStatus(threadID, adminID, adminStatus) {
|
7
|
+
if (utils.getType(threadID) !== "String") throw { error: "changeAdminStatus: threadID must be a string" };
|
8
|
+
if (utils.getType(adminID) !== "String" && utils.getType(adminID) !== "Array") throw { error: "changeAdminStatus: adminID must be a string or an array" };
|
9
|
+
if (utils.getType(adminStatus) !== "Boolean") throw { error: "changeAdminStatus: adminStatus must be true or false" };
|
10
|
+
|
11
|
+
let wsContent = {
|
12
|
+
request_id: 1,
|
13
|
+
type: 3,
|
14
|
+
payload: {
|
15
|
+
version_id: '3816854585040595',
|
16
|
+
tasks: [],
|
17
|
+
epoch_id: 6763184801413415579,
|
18
|
+
data_trace_id: null
|
19
|
+
},
|
20
|
+
app_id: '772021112871879'
|
21
|
+
}
|
22
|
+
|
23
|
+
if (utils.getType(adminID) === "Array") {
|
24
|
+
for (let i = 0; i < adminID.length; i++) {
|
25
|
+
wsContent.payload.tasks.push({
|
26
|
+
label: '25',
|
27
|
+
payload: JSON.stringify({ thread_key: threadID, contact_id: adminID[i], is_admin: adminStatus }),
|
28
|
+
queue_name: 'admin_status',
|
29
|
+
task_id: i + 1,
|
30
|
+
failure_count: null
|
31
|
+
});
|
32
|
+
}
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
wsContent.payload.tasks.push({
|
36
|
+
label: '25',
|
37
|
+
payload: JSON.stringify({ thread_key: threadID, contact_id: adminID, is_admin: adminStatus }),
|
38
|
+
queue_name: 'admin_status',
|
39
|
+
task_id: 1,
|
40
|
+
failure_count: null
|
41
|
+
});
|
42
|
+
}
|
43
|
+
|
44
|
+
wsContent.payload = JSON.stringify(wsContent.payload);
|
45
|
+
return new Promise((resolve, reject) => ctx.mqttClient && ctx.mqttClient.publish('/ls_req', JSON.stringify(wsContent), {}, (err, _packet) => err ? reject(err) : resolve()));
|
46
|
+
};
|
47
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var utils = require("../utils");
|
4
|
+
var log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function changeArchivedStatus(threadOrThreads, archive, callback) {
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
15
|
+
if (!callback) {
|
16
|
+
callback = function (err) {
|
17
|
+
if (err) return rejectFunc(err);
|
18
|
+
resolveFunc();
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
|
+
var form = {};
|
23
|
+
|
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;
|
26
|
+
|
27
|
+
defaultFuncs
|
28
|
+
.post("https://www.facebook.com/ajax/mercury/change_archived_status.php", ctx.jar, form)
|
29
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
30
|
+
.then(function (resData) {
|
31
|
+
if (resData.error) throw resData;
|
32
|
+
return callback();
|
33
|
+
})
|
34
|
+
.catch(function (err) {
|
35
|
+
log.error("changeArchivedStatus", err);
|
36
|
+
return callback(err);
|
37
|
+
});
|
38
|
+
|
39
|
+
return returnPromise;
|
40
|
+
};
|
41
|
+
};
|
@@ -1,77 +1,64 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var utils = require("../utils");
|
4
|
-
var log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function changeBio(bio, publish, callback) {
|
8
|
-
var resolveFunc = function () { };
|
9
|
-
var rejectFunc = function () { };
|
10
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
if (utils.getType(publish) == "Function" || utils.getType(publish) == "AsyncFunction")
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
throw resData;
|
66
|
-
}
|
67
|
-
|
68
|
-
return callback();
|
69
|
-
})
|
70
|
-
.catch(function (err) {
|
71
|
-
log.error("changeBio", err);
|
72
|
-
return callback(err);
|
73
|
-
});
|
74
|
-
|
75
|
-
return returnPromise;
|
76
|
-
};
|
77
|
-
};
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var utils = require("../utils");
|
4
|
+
var log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function changeBio(bio, publish, callback) {
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
15
|
+
if (!callback) {
|
16
|
+
if (utils.getType(publish) == "Function" || utils.getType(publish) == "AsyncFunction") callback = publish;
|
17
|
+
else {
|
18
|
+
callback = function (err) {
|
19
|
+
if (err) return rejectFunc(err);
|
20
|
+
resolveFunc();
|
21
|
+
};
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
if (utils.getType(publish) != "Boolean") publish = false;
|
26
|
+
if (utils.getType(bio) != "String") {
|
27
|
+
bio = "";
|
28
|
+
publish = false;
|
29
|
+
}
|
30
|
+
|
31
|
+
var form = {
|
32
|
+
fb_api_caller_class: "RelayModern",
|
33
|
+
fb_api_req_friendly_name: "ProfileCometSetBioMutation",
|
34
|
+
// This doc_is is valid as of May 23, 2020
|
35
|
+
doc_id: "2725043627607610",
|
36
|
+
variables: JSON.stringify({
|
37
|
+
input: {
|
38
|
+
bio: bio,
|
39
|
+
publish_bio_feed_story: publish,
|
40
|
+
actor_id: ctx.userID,
|
41
|
+
client_mutation_id: Math.round(Math.random() * 1024).toString()
|
42
|
+
},
|
43
|
+
hasProfileTileViewID: false,
|
44
|
+
profileTileViewID: null,
|
45
|
+
scale: 1
|
46
|
+
}),
|
47
|
+
av: ctx.userID
|
48
|
+
};
|
49
|
+
|
50
|
+
defaultFuncs
|
51
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
52
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
53
|
+
.then(function (resData) {
|
54
|
+
if (resData.errors) throw resData;
|
55
|
+
return callback();
|
56
|
+
})
|
57
|
+
.catch(function (err) {
|
58
|
+
log.error("changeBio", err);
|
59
|
+
return callback(err);
|
60
|
+
});
|
61
|
+
|
62
|
+
return returnPromise;
|
63
|
+
};
|
64
|
+
};
|