alicezetion 1.0.9 → 1.1.1
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/index.js +558 -490
- package/leiamnash/addExternalModule.js +19 -0
- package/{src → leiamnash}/addUserToGroup.js +52 -16
- package/leiamnash/changeAdminStatus.js +79 -0
- package/leiamnash/changeArchivedStatus.js +55 -0
- package/{src → leiamnash}/changeBio.js +19 -6
- package/{src → leiamnash}/changeBlockedStatus.js +14 -3
- package/{src → leiamnash}/changeGroupImage.js +40 -16
- package/leiamnash/changeNickname.js +59 -0
- package/{src → leiamnash}/changeThreadColor.js +20 -10
- package/leiamnash/changeThreadEmoji.js +55 -0
- package/leiamnash/chat.js +459 -0
- package/{src → leiamnash}/createNewGroup.js +28 -12
- package/{src → leiamnash}/createPoll.js +25 -13
- package/leiamnash/deleteMessage.js +56 -0
- package/leiamnash/deleteThread.js +56 -0
- package/leiamnash/forwardAttachment.js +60 -0
- package/{src → leiamnash}/getCurrentUserID.js +1 -1
- package/{src → leiamnash}/getEmojiUrl.js +4 -2
- package/{src → leiamnash}/getFriendsList.js +21 -10
- package/{src → leiamnash}/getThreadHistory.js +166 -58
- package/{src → leiamnash}/getThreadHistoryDeprecated.js +42 -20
- package/{src → leiamnash}/getThreadInfo.js +60 -25
- package/leiamnash/getThreadInfoDeprecated.js +80 -0
- package/{src → leiamnash}/getThreadList.js +66 -41
- package/leiamnash/getThreadListDeprecated.js +75 -0
- package/leiamnash/getThreadPictures.js +79 -0
- package/{src → leiamnash}/getUserID.js +14 -9
- package/{src → leiamnash}/getUserInfo.js +18 -12
- package/leiamnash/handleFriendRequest.js +61 -0
- package/leiamnash/handleMessageRequest.js +65 -0
- package/{src → leiamnash}/httpGet.js +17 -12
- package/{src → leiamnash}/httpPost.js +17 -12
- package/leiamnash/listenMqtt.js +687 -0
- package/{src → leiamnash}/logout.js +20 -13
- package/{src → leiamnash}/markAsDelivered.js +22 -11
- package/{src → leiamnash}/markAsRead.js +21 -11
- package/{src → leiamnash}/markAsReadAll.js +20 -10
- package/{src → leiamnash}/markAsSeen.js +18 -7
- package/{src → leiamnash}/muteThread.js +18 -11
- package/leiamnash/removeUserFromGroup.js +79 -0
- package/{src → leiamnash}/resolvePhotoUrl.js +17 -8
- package/{src → leiamnash}/searchForThread.js +21 -10
- package/{src → leiamnash}/sendTypingIndicator.js +47 -14
- package/{src → leiamnash}/setMessageReaction.js +26 -12
- package/{src → leiamnash}/setPostReaction.js +26 -13
- package/{src → leiamnash}/setTitle.js +29 -13
- package/leiamnash/threadColors.js +57 -0
- package/{src → leiamnash}/unfriend.js +19 -9
- package/{src → leiamnash}/unsendMessage.js +19 -9
- package/package.json +9 -14
- package/replit.nix +0 -1
- package/utils.js +1193 -1023
- package/src/addExternalModule.js +0 -15
- package/src/changeAdminStatus.js +0 -47
- package/src/changeArchivedStatus.js +0 -41
- package/src/changeNickname.js +0 -43
- package/src/changeThreadEmoji.js +0 -41
- package/src/chat.js +0 -315
- package/src/deleteMessage.js +0 -44
- package/src/deleteThread.js +0 -42
- package/src/forwardAttachment.js +0 -47
- package/src/forwardMessage.js +0 -0
- package/src/getThreadInfoDeprecated.js +0 -56
- package/src/getThreadListDeprecated.js +0 -46
- package/src/getThreadPictures.js +0 -59
- package/src/handleFriendRequest.js +0 -46
- package/src/handleMessageRequest.js +0 -47
- package/src/listen.js +0 -553
- package/src/listenMqtt-Test.js +0 -687
- package/src/listenMqtt.js +0 -677
- package/src/removeUserFromGroup.js +0 -45
- package/src/threadColors.js +0 -41
@@ -0,0 +1,79 @@
|
|
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 getThreadPictures(threadID, offset, limit, 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, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
var form = {
|
25
|
+
thread_id: threadID,
|
26
|
+
offset: offset,
|
27
|
+
limit: limit
|
28
|
+
};
|
29
|
+
|
30
|
+
defaultFuncs
|
31
|
+
.post(
|
32
|
+
"https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php",
|
33
|
+
ctx.jar,
|
34
|
+
form
|
35
|
+
)
|
36
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
37
|
+
.then(function(resData) {
|
38
|
+
if (resData.error) {
|
39
|
+
throw resData;
|
40
|
+
}
|
41
|
+
return Promise.all(
|
42
|
+
resData.payload.imagesData.map(function(image) {
|
43
|
+
form = {
|
44
|
+
thread_id: threadID,
|
45
|
+
image_id: image.fbid
|
46
|
+
};
|
47
|
+
return defaultFuncs
|
48
|
+
.post(
|
49
|
+
"https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php",
|
50
|
+
ctx.jar,
|
51
|
+
form
|
52
|
+
)
|
53
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
54
|
+
.then(function(resData) {
|
55
|
+
if (resData.error) {
|
56
|
+
throw resData;
|
57
|
+
}
|
58
|
+
// the response is pretty messy
|
59
|
+
var queryThreadID =
|
60
|
+
resData.jsmods.require[0][3][1].query_metadata.query_path[0]
|
61
|
+
.message_thread;
|
62
|
+
var imageData =
|
63
|
+
resData.jsmods.require[0][3][1].query_results[queryThreadID]
|
64
|
+
.message_images.edges[0].node.image2;
|
65
|
+
return imageData;
|
66
|
+
});
|
67
|
+
})
|
68
|
+
);
|
69
|
+
})
|
70
|
+
.then(function(resData) {
|
71
|
+
callback(null, resData);
|
72
|
+
})
|
73
|
+
.catch(function(err) {
|
74
|
+
log.error("Error in getThreadPictures", err);
|
75
|
+
callback(err);
|
76
|
+
});
|
77
|
+
return returnPromise;
|
78
|
+
};
|
79
|
+
};
|
@@ -17,19 +17,21 @@ function formatData(data) {
|
|
17
17
|
};
|
18
18
|
}
|
19
19
|
|
20
|
-
module.exports = function
|
20
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
21
21
|
return function getUserID(name, callback) {
|
22
|
-
var resolveFunc = function
|
23
|
-
var rejectFunc = function
|
22
|
+
var resolveFunc = function(){};
|
23
|
+
var rejectFunc = function(){};
|
24
24
|
var returnPromise = new Promise(function (resolve, reject) {
|
25
25
|
resolveFunc = resolve;
|
26
26
|
rejectFunc = reject;
|
27
27
|
});
|
28
28
|
|
29
29
|
if (!callback) {
|
30
|
-
callback = function (err,
|
31
|
-
if (err)
|
32
|
-
|
30
|
+
callback = function (err, friendList) {
|
31
|
+
if (err) {
|
32
|
+
return rejectFunc(err);
|
33
|
+
}
|
34
|
+
resolveFunc(friendList);
|
33
35
|
};
|
34
36
|
}
|
35
37
|
|
@@ -45,13 +47,16 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
45
47
|
defaultFuncs
|
46
48
|
.get("https://www.facebook.com/ajax/typeahead/search.php", ctx.jar, form)
|
47
49
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
48
|
-
.then(function
|
49
|
-
if (resData.error)
|
50
|
+
.then(function(resData) {
|
51
|
+
if (resData.error) {
|
52
|
+
throw resData;
|
53
|
+
}
|
50
54
|
|
51
55
|
var data = resData.payload.entries;
|
56
|
+
|
52
57
|
callback(null, data.map(formatData));
|
53
58
|
})
|
54
|
-
.catch(function
|
59
|
+
.catch(function(err) {
|
55
60
|
log.error("getUserID", err);
|
56
61
|
return callback(err);
|
57
62
|
});
|
@@ -27,37 +27,43 @@ function formatData(data) {
|
|
27
27
|
return retObj;
|
28
28
|
}
|
29
29
|
|
30
|
-
module.exports = function
|
30
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
31
31
|
return function getUserInfo(id, callback) {
|
32
|
-
var resolveFunc = function
|
33
|
-
var rejectFunc = function
|
32
|
+
var resolveFunc = function(){};
|
33
|
+
var rejectFunc = function(){};
|
34
34
|
var returnPromise = new Promise(function (resolve, reject) {
|
35
35
|
resolveFunc = resolve;
|
36
36
|
rejectFunc = reject;
|
37
37
|
});
|
38
38
|
|
39
39
|
if (!callback) {
|
40
|
-
callback = function (err,
|
41
|
-
if (err)
|
42
|
-
|
40
|
+
callback = function (err, friendList) {
|
41
|
+
if (err) {
|
42
|
+
return rejectFunc(err);
|
43
|
+
}
|
44
|
+
resolveFunc(friendList);
|
43
45
|
};
|
44
46
|
}
|
45
47
|
|
46
|
-
if (utils.getType(id) !== "Array")
|
48
|
+
if (utils.getType(id) !== "Array") {
|
49
|
+
id = [id];
|
50
|
+
}
|
47
51
|
|
48
52
|
var form = {};
|
49
|
-
id.map(function
|
53
|
+
id.map(function(v, i) {
|
50
54
|
form["ids[" + i + "]"] = v;
|
51
55
|
});
|
52
56
|
defaultFuncs
|
53
57
|
.post("https://www.facebook.com/chat/user_info/", ctx.jar, form)
|
54
58
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
55
|
-
.then(function
|
56
|
-
if (resData.error)
|
59
|
+
.then(function(resData) {
|
60
|
+
if (resData.error) {
|
61
|
+
throw resData;
|
62
|
+
}
|
57
63
|
return callback(null, formatData(resData.payload.profiles));
|
58
64
|
})
|
59
|
-
.catch(function
|
60
|
-
log.error("getUserInfo",
|
65
|
+
.catch(function(err) {
|
66
|
+
log.error("getUserInfo", err);
|
61
67
|
return callback(err);
|
62
68
|
});
|
63
69
|
|
@@ -0,0 +1,61 @@
|
|
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 handleFriendRequest(userID, accept, callback) {
|
8
|
+
if (utils.getType(accept) !== "Boolean") {
|
9
|
+
throw {
|
10
|
+
error: "Please pass a boolean as a second argument."
|
11
|
+
};
|
12
|
+
}
|
13
|
+
|
14
|
+
var resolveFunc = function(){};
|
15
|
+
var rejectFunc = function(){};
|
16
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
17
|
+
resolveFunc = resolve;
|
18
|
+
rejectFunc = reject;
|
19
|
+
});
|
20
|
+
|
21
|
+
if (!callback) {
|
22
|
+
callback = function (err, friendList) {
|
23
|
+
if (err) {
|
24
|
+
return rejectFunc(err);
|
25
|
+
}
|
26
|
+
resolveFunc(friendList);
|
27
|
+
};
|
28
|
+
}
|
29
|
+
|
30
|
+
var form = {
|
31
|
+
viewer_id: ctx.userID,
|
32
|
+
"frefs[0]": "jwl",
|
33
|
+
floc: "friend_center_requests",
|
34
|
+
ref: "/reqs.php",
|
35
|
+
action: (accept ? "confirm" : "reject")
|
36
|
+
};
|
37
|
+
|
38
|
+
defaultFuncs
|
39
|
+
.post(
|
40
|
+
"https://www.facebook.com/requests/friends/ajax/",
|
41
|
+
ctx.jar,
|
42
|
+
form
|
43
|
+
)
|
44
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
45
|
+
.then(function(resData) {
|
46
|
+
if (resData.payload.err) {
|
47
|
+
throw {
|
48
|
+
err: resData.payload.err
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
return callback();
|
53
|
+
})
|
54
|
+
.catch(function(err) {
|
55
|
+
log.error("handleFriendRequest", err);
|
56
|
+
return callback(err);
|
57
|
+
});
|
58
|
+
|
59
|
+
return returnPromise;
|
60
|
+
};
|
61
|
+
};
|
@@ -0,0 +1,65 @@
|
|
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 handleMessageRequest(threadID, accept, callback) {
|
8
|
+
if (utils.getType(accept) !== "Boolean") {
|
9
|
+
throw {
|
10
|
+
error: "Please pass a boolean as a second argument."
|
11
|
+
};
|
12
|
+
}
|
13
|
+
|
14
|
+
var resolveFunc = function(){};
|
15
|
+
var rejectFunc = function(){};
|
16
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
17
|
+
resolveFunc = resolve;
|
18
|
+
rejectFunc = reject;
|
19
|
+
});
|
20
|
+
|
21
|
+
if (!callback) {
|
22
|
+
callback = function (err, friendList) {
|
23
|
+
if (err) {
|
24
|
+
return rejectFunc(err);
|
25
|
+
}
|
26
|
+
resolveFunc(friendList);
|
27
|
+
};
|
28
|
+
}
|
29
|
+
|
30
|
+
var form = {
|
31
|
+
client: "mercury"
|
32
|
+
};
|
33
|
+
|
34
|
+
if (utils.getType(threadID) !== "Array") {
|
35
|
+
threadID = [threadID];
|
36
|
+
}
|
37
|
+
|
38
|
+
var messageBox = accept ? "inbox" : "other";
|
39
|
+
|
40
|
+
for (var i = 0; i < threadID.length; i++) {
|
41
|
+
form[messageBox + "[" + i + "]"] = threadID[i];
|
42
|
+
}
|
43
|
+
|
44
|
+
defaultFuncs
|
45
|
+
.post(
|
46
|
+
"https://www.facebook.com/ajax/mercury/move_thread.php",
|
47
|
+
ctx.jar,
|
48
|
+
form
|
49
|
+
)
|
50
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
51
|
+
.then(function(resData) {
|
52
|
+
if (resData.error) {
|
53
|
+
throw resData;
|
54
|
+
}
|
55
|
+
|
56
|
+
return callback();
|
57
|
+
})
|
58
|
+
.catch(function(err) {
|
59
|
+
log.error("handleMessageRequest", err);
|
60
|
+
return callback(err);
|
61
|
+
});
|
62
|
+
|
63
|
+
return returnPromise;
|
64
|
+
};
|
65
|
+
};
|
@@ -3,10 +3,10 @@
|
|
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 httpGet(url, form, callback, notAPI) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
8
|
+
var resolveFunc = function(){};
|
9
|
+
var rejectFunc = function(){};
|
10
10
|
|
11
11
|
var returnPromise = new Promise(function (resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
@@ -17,31 +17,36 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
17
17
|
callback = form;
|
18
18
|
form = {};
|
19
19
|
}
|
20
|
+
|
20
21
|
form = form || {};
|
21
22
|
|
22
|
-
callback = callback || function
|
23
|
-
|
24
|
-
|
23
|
+
callback = callback || function(err, data) {
|
24
|
+
if (err) return rejectFunc(err);
|
25
|
+
resolveFunc(data);
|
25
26
|
};
|
26
27
|
|
27
28
|
if (notAPI) {
|
28
29
|
utils
|
29
30
|
.get(url, ctx.jar, form, ctx.globalOptions)
|
30
|
-
.then(
|
31
|
-
|
31
|
+
.then(function(resData) {
|
32
|
+
callback(null, resData.body.toString());
|
33
|
+
})
|
34
|
+
.catch(function(err) {
|
32
35
|
log.error("httpGet", err);
|
33
36
|
return callback(err);
|
34
37
|
});
|
35
|
-
}
|
36
|
-
else {
|
38
|
+
} else {
|
37
39
|
defaultFuncs
|
38
40
|
.get(url, ctx.jar, form)
|
39
|
-
.then(
|
40
|
-
|
41
|
+
.then(function(resData) {
|
42
|
+
callback(null, resData.body.toString());
|
43
|
+
})
|
44
|
+
.catch(function(err) {
|
41
45
|
log.error("httpGet", err);
|
42
46
|
return callback(err);
|
43
47
|
});
|
44
48
|
}
|
49
|
+
|
45
50
|
return returnPromise;
|
46
51
|
};
|
47
52
|
};
|
@@ -3,10 +3,10 @@
|
|
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 httpGet(url, form, callback, notAPI) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
8
|
+
var resolveFunc = function(){};
|
9
|
+
var rejectFunc = function(){};
|
10
10
|
|
11
11
|
var returnPromise = new Promise(function (resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
@@ -17,31 +17,36 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
17
17
|
callback = form;
|
18
18
|
form = {};
|
19
19
|
}
|
20
|
+
|
20
21
|
form = form || {};
|
21
22
|
|
22
|
-
callback = callback || function
|
23
|
-
|
24
|
-
|
23
|
+
callback = callback || function(err, data) {
|
24
|
+
if (err) return rejectFunc(err);
|
25
|
+
resolveFunc(data);
|
25
26
|
};
|
26
27
|
|
27
28
|
if (notAPI) {
|
28
29
|
utils
|
29
30
|
.post(url, ctx.jar, form, ctx.globalOptions)
|
30
|
-
.then(
|
31
|
-
|
31
|
+
.then(function(resData) {
|
32
|
+
callback(null, resData.body.toString());
|
33
|
+
})
|
34
|
+
.catch(function(err) {
|
32
35
|
log.error("httpPost", err);
|
33
36
|
return callback(err);
|
34
37
|
});
|
35
|
-
}
|
36
|
-
else {
|
38
|
+
} else {
|
37
39
|
defaultFuncs
|
38
40
|
.post(url, ctx.jar, form, {})
|
39
|
-
.then(
|
40
|
-
|
41
|
+
.then(function(resData) {
|
42
|
+
callback(null, resData.body.toString());
|
43
|
+
})
|
44
|
+
.catch(function(err) {
|
41
45
|
log.error("httpPost", err);
|
42
46
|
return callback(err);
|
43
47
|
});
|
44
48
|
}
|
49
|
+
|
45
50
|
return returnPromise;
|
46
51
|
};
|
47
52
|
};
|