node-ainzfb-new 1.7.10-14 → 1.7.10-16tfwiu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/changeAvt.js +73 -73
- package/src/editMessage.js +26 -29
- package/src/getAccessToken.js +21 -21
- package/src/getThreadInfo.js +18 -3423
- package/src/getUserInfoV2.js +22 -19
- package/src/pinMessage.js +13 -16
- package/src/shareContact.js +39 -49
- package/src/shareLink.js +48 -51
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "node-ainzfb-new",
|
3
|
-
"version": "1.7.10-
|
3
|
+
"version": "1.7.10-16tfwiu",
|
4
4
|
"description": "A Facebook chat API that doesn't rely on XMPP. Will NOT be deprecated after April 30th 2015.",
|
5
5
|
"scripts": {
|
6
6
|
"test": "mocha",
|
@@ -35,12 +35,12 @@
|
|
35
35
|
"https-proxy-agent": "latest",
|
36
36
|
"is-hexcolor": "^1.0.0",
|
37
37
|
"lodash": "",
|
38
|
-
"mqtt": "^4.3.
|
38
|
+
"mqtt": "^4.3.8",
|
39
39
|
"node-superfetch": "^0.2.3",
|
40
40
|
"npmlog": "latest",
|
41
41
|
"path": "latest",
|
42
|
-
"pretty-ms": "^7.0.1",
|
43
42
|
"pm2": "^5.3.0",
|
43
|
+
"pretty-ms": "^7.0.1",
|
44
44
|
"request": "latest",
|
45
45
|
"semver": "latest",
|
46
46
|
"sus-support": "git+https://github.com/amogusdevlol/sus-support.git",
|
package/src/changeAvt.js
CHANGED
@@ -11,81 +11,81 @@ var log = require("npmlog");
|
|
11
11
|
* {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
|
12
12
|
*/
|
13
13
|
async function postImage(Api, BotID, form) {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
var Data = await Api.httpPostFormData(
|
15
|
+
`https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`,
|
16
|
+
form
|
17
|
+
);
|
18
|
+
return JSON.parse(Data.split("for (;;);")[1]);
|
19
19
|
}
|
20
20
|
|
21
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
22
|
+
/* Changing the profile picture of the bot. */
|
23
|
+
return function changeAvt(link, caption, callback) {
|
24
|
+
var resolveFunc = function () { };
|
25
|
+
var rejectFunc = function () { };
|
26
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
27
|
+
resolveFunc = resolve;
|
28
|
+
rejectFunc = reject;
|
29
|
+
});
|
30
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
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
31
|
+
if (!callback) {
|
32
|
+
callback = function (err, data) {
|
33
|
+
if (err) return rejectFunc(err);
|
34
|
+
resolveFunc(data);
|
35
|
+
};
|
36
|
+
}
|
37
|
+
try {
|
38
|
+
var Fetch = require("axios");
|
39
|
+
Fetch.get(link, { responseType: "stream" }).then(data => {
|
40
|
+
postImage(api, ctx.userID, { file: data.data }).then(data => {
|
41
|
+
if (data.error)
|
42
|
+
throw new Error({
|
43
|
+
error: data.error,
|
44
|
+
des: data.error.errorDescription
|
45
|
+
});
|
46
|
+
var form = {
|
47
|
+
av: ctx.userID,
|
48
|
+
fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
|
49
|
+
fb_api_caller_class: "RelayModern",
|
50
|
+
doc_id: "5066134240065849",
|
51
|
+
variables: JSON.stringify({
|
52
|
+
input: {
|
53
|
+
caption: caption || "",
|
54
|
+
existing_photo_id: data.payload.fbid,
|
55
|
+
expiration_time: null,
|
56
|
+
profile_id: ctx.userID,
|
57
|
+
profile_pic_method: "EXISTING",
|
58
|
+
profile_pic_source: "TIMELINE",
|
59
|
+
scaled_crop_rect: {
|
60
|
+
height: 1,
|
61
|
+
width: 1,
|
62
|
+
x: 0,
|
63
|
+
y: 0
|
64
|
+
},
|
65
|
+
skip_cropping: true,
|
66
|
+
actor_id: ctx.userID,
|
67
|
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
68
|
+
},
|
69
|
+
isPage: false,
|
70
|
+
isProfile: true,
|
71
|
+
scale: 3
|
72
|
+
})
|
73
|
+
};
|
74
|
+
defaultFuncs
|
75
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
76
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
77
|
+
.then(function (resData) {
|
78
|
+
if (resData.error) throw resData;
|
79
|
+
else return callback(null, true);
|
80
|
+
})
|
81
|
+
.catch(function (err) {
|
82
|
+
return callback(err);
|
83
|
+
});
|
84
|
+
});
|
83
85
|
});
|
84
|
-
})
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
}
|
89
|
-
return returnPromise;
|
90
|
-
};
|
86
|
+
} catch (e) {
|
87
|
+
throw e;
|
88
|
+
}
|
89
|
+
return returnPromise;
|
90
|
+
};
|
91
91
|
};
|
package/src/editMessage.js
CHANGED
@@ -5,16 +5,16 @@ var log = require("npmlog");
|
|
5
5
|
|
6
6
|
module.exports = function(defaultFuncs, api, ctx) {
|
7
7
|
return function editMessage(text, messageID, callback) {
|
8
|
-
let reqID = ctx.wsReqNumber
|
8
|
+
let reqID = ctx.wsReqNumber+1;
|
9
9
|
var resolveFunc = function() {};
|
10
10
|
var rejectFunc = function() {};
|
11
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
11
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
13
13
|
rejectFunc = reject;
|
14
14
|
});
|
15
15
|
|
16
16
|
if (!callback) {
|
17
|
-
callback = function(err, data) {
|
17
|
+
callback = function (err, data) {
|
18
18
|
if (err) {
|
19
19
|
return rejectFunc(err);
|
20
20
|
}
|
@@ -24,61 +24,58 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
24
24
|
|
25
25
|
var form = {
|
26
26
|
message_id: messageID,
|
27
|
-
text: text
|
27
|
+
text: text,
|
28
28
|
};
|
29
29
|
|
30
30
|
var content = {
|
31
|
-
app_id:
|
31
|
+
app_id: '2220391788200892',
|
32
32
|
payload: JSON.stringify({
|
33
33
|
data_trace_id: null,
|
34
34
|
epoch_id: parseInt(utils.generateOfflineThreadingID()),
|
35
|
-
tasks: [
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
],
|
44
|
-
version_id: "6903494529735864"
|
35
|
+
tasks: [{
|
36
|
+
failure_count: null,
|
37
|
+
label: '742',
|
38
|
+
payload: JSON.stringify(form),
|
39
|
+
queue_name: 'edit_message',
|
40
|
+
task_id: ++ctx.wsTaskNumber,
|
41
|
+
}],
|
42
|
+
version_id: '6903494529735864',
|
45
43
|
}),
|
46
44
|
request_id: ++ctx.wsReqNumber,
|
47
45
|
type: 3
|
48
|
-
}
|
46
|
+
}
|
49
47
|
|
50
|
-
ctx.mqttClient.publish(
|
51
|
-
qos: 1,
|
52
|
-
retain: false
|
48
|
+
ctx.mqttClient.publish('/ls_req', JSON.stringify(content), {
|
49
|
+
qos: 1, retain: false
|
53
50
|
});
|
54
|
-
const handleRes = function(topic, message, _packet) {
|
51
|
+
const handleRes = function (topic, message, _packet) {
|
55
52
|
if (topic === "/ls_resp") {
|
56
53
|
let jsonMsg = JSON.parse(message.toString());
|
57
54
|
jsonMsg.payload = JSON.parse(jsonMsg.payload);
|
58
55
|
if (jsonMsg.request_id != reqID) return;
|
59
|
-
ctx.mqttClient.removeListener(
|
56
|
+
ctx.mqttClient.removeListener('message', handleRes);
|
60
57
|
|
61
58
|
let msgID = jsonMsg.payload.step[1][2][2][1][2];
|
62
59
|
let msgReplace = jsonMsg.payload.step[1][2][2][1][4];
|
63
|
-
|
60
|
+
|
64
61
|
if (msgReplace != text) {
|
65
|
-
let err = {
|
62
|
+
let err = {error: "The message is too old or not from you!"}
|
66
63
|
log.error("editMessage", err);
|
67
|
-
|
64
|
+
|
68
65
|
return callback(err, {
|
69
66
|
body: msgReplace,
|
70
67
|
messageID: msgID
|
71
68
|
});
|
72
69
|
}
|
73
|
-
|
70
|
+
|
74
71
|
return callback(undefined, {
|
75
72
|
body: msgReplace,
|
76
73
|
messageID: msgID
|
77
74
|
});
|
78
75
|
}
|
79
|
-
}
|
80
|
-
ctx.mqttClient.on(
|
81
|
-
|
76
|
+
}
|
77
|
+
ctx.mqttClient.on('message', handleRes);
|
78
|
+
|
82
79
|
return returnPromise;
|
83
80
|
};
|
84
|
-
}
|
81
|
+
}
|
package/src/getAccessToken.js
CHANGED
@@ -4,29 +4,29 @@
|
|
4
4
|
var utils = require("../utils");
|
5
5
|
var log = require("npmlog");
|
6
6
|
|
7
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
8
|
-
return function getAccessToken(callback) {
|
9
|
-
var resolveFunc = function() {};
|
10
|
-
var rejectFunc = function() {};
|
11
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
12
|
-
resolveFunc = resolve;
|
13
|
-
rejectFunc = reject;
|
14
|
-
});
|
15
7
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
8
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
9
|
+
return function getAccessToken(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
|
+
}
|
22
23
|
try {
|
23
|
-
var { getAccessToken } = require(
|
24
|
-
getAccessToken(ctx.jar,
|
25
|
-
|
26
|
-
|
27
|
-
} catch (e) {
|
24
|
+
var { getAccessToken } = require('../Extra/ExtraAddons');
|
25
|
+
getAccessToken(ctx.jar,ctx,defaultFuncs).then(data => callback(null,data));
|
26
|
+
}
|
27
|
+
catch (e) {
|
28
28
|
callback(null, e);
|
29
29
|
}
|
30
30
|
return returnPromise;
|
31
|
-
|
32
|
-
};
|
31
|
+
};
|
32
|
+
};
|