alicezetion 1.1.0 → 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 +1 -1
- 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
@@ -1,56 +0,0 @@
|
|
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 getThreadInfo(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) {
|
16
|
-
callback = function (err, data) {
|
17
|
-
if (err) return rejectFunc(err);
|
18
|
-
resolveFunc(data);
|
19
|
-
};
|
20
|
-
}
|
21
|
-
|
22
|
-
var form = {
|
23
|
-
client: "mercury"
|
24
|
-
};
|
25
|
-
|
26
|
-
api.getUserInfo(threadID, function (err, userRes) {
|
27
|
-
if (err) return callback(err);
|
28
|
-
var key = Object.keys(userRes).length > 0 ? "user_ids" : "thread_fbids";
|
29
|
-
form["threads[" + key + "][0]"] = threadID;
|
30
|
-
|
31
|
-
if (ctx.globalOptions.pageId) form.request_user_id = ctx.globalOptions.pageId;
|
32
|
-
|
33
|
-
defaultFuncs
|
34
|
-
.post("https://www.facebook.com/ajax/mercury/thread_info.php", ctx.jar, form)
|
35
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
36
|
-
.then(function (resData) {
|
37
|
-
if (resData.error) throw resData;
|
38
|
-
else if (!resData.payload) throw { error: "Could not retrieve thread Info." };
|
39
|
-
|
40
|
-
var threadData = resData.payload.threads[0];
|
41
|
-
var userData = userRes[threadID];
|
42
|
-
|
43
|
-
if (threadData == null) throw { error: "ThreadData is null" };
|
44
|
-
|
45
|
-
threadData.name = userData != null && userData.name != null ? userData.name : threadData.name;
|
46
|
-
threadData.image_src = userData != null && userData.thumbSrc != null ? userData.thumbSrc : threadData.image_src;
|
47
|
-
callback(null, utils.formatThread(threadData));
|
48
|
-
})
|
49
|
-
.catch(function (err) {
|
50
|
-
log.error("getThreadInfo", err);
|
51
|
-
return callback(err);
|
52
|
-
});
|
53
|
-
});
|
54
|
-
return returnPromise;
|
55
|
-
};
|
56
|
-
};
|
@@ -1,46 +0,0 @@
|
|
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 getThreadList(start, end, type, callback) {
|
8
|
-
if (utils.getType(callback) === "Undefined") {
|
9
|
-
if (utils.getType(end) !== "Number") throw { error: "Please pass a number as a second argument." };
|
10
|
-
else if (utils.getType(type) === "Function" || utils.getType(type) === "AsyncFunction") {
|
11
|
-
callback = type;
|
12
|
-
type = "inbox"; //default to inbox
|
13
|
-
}
|
14
|
-
else if (utils.getType(type) !== "String") throw { error: "Please pass a String as a third argument. Your options are: inbox, pending, and archived" };
|
15
|
-
else throw { error: "getThreadList: need callback" };
|
16
|
-
}
|
17
|
-
|
18
|
-
if (type === "archived") type = "action:archived";
|
19
|
-
else if (type !== "inbox" && type !== "pending" && type !== "other") throw { error: "type can only be one of the following: inbox, pending, archived, other" };
|
20
|
-
|
21
|
-
|
22
|
-
if (end <= start) end = start + 20;
|
23
|
-
|
24
|
-
var form = {
|
25
|
-
client: "mercury"
|
26
|
-
};
|
27
|
-
|
28
|
-
form[type + "[offset]"] = start;
|
29
|
-
form[type + "[limit]"] = end - start;
|
30
|
-
|
31
|
-
if (ctx.globalOptions.pageID) form.request_user_id = ctx.globalOptions.pageID;
|
32
|
-
|
33
|
-
defaultFuncs
|
34
|
-
.post("https://www.facebook.com/ajax/mercury/threadlist_info.php", ctx.jar, form)
|
35
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
36
|
-
.then(function (resData) {
|
37
|
-
if (resData.error) throw resData;
|
38
|
-
log.verbose("getThreadList", JSON.stringify(resData.payload.threads));
|
39
|
-
return callback(null, (resData.payload.threads || []).map(utils.formatThread));
|
40
|
-
})
|
41
|
-
.catch(function (err) {
|
42
|
-
log.error("getThreadList", err);
|
43
|
-
return callback(err);
|
44
|
-
});
|
45
|
-
};
|
46
|
-
};
|
package/src/getThreadPictures.js
DELETED
@@ -1,59 +0,0 @@
|
|
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, data) {
|
17
|
-
if (err) return rejectFunc(err);
|
18
|
-
resolveFunc(data);
|
19
|
-
};
|
20
|
-
}
|
21
|
-
|
22
|
-
var form = {
|
23
|
-
thread_id: threadID,
|
24
|
-
offset: offset,
|
25
|
-
limit: limit
|
26
|
-
};
|
27
|
-
|
28
|
-
defaultFuncs
|
29
|
-
.post("https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php", ctx.jar, form)
|
30
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
31
|
-
.then(function (resData) {
|
32
|
-
if (resData.error) throw resData;
|
33
|
-
return Promise.all(
|
34
|
-
resData.payload.imagesData.map(function (image) {
|
35
|
-
form = {
|
36
|
-
thread_id: threadID,
|
37
|
-
image_id: image.fbid
|
38
|
-
};
|
39
|
-
return defaultFuncs
|
40
|
-
.post("https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php", ctx.jar, form)
|
41
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
42
|
-
.then(function (resData) {
|
43
|
-
if (resData.error) throw resData;
|
44
|
-
// the response is pretty messy
|
45
|
-
var queryThreadID = resData.jsmods.require[0][3][1].query_metadata.query_path[0].message_thread;
|
46
|
-
var imageData = resData.jsmods.require[0][3][1].query_results[queryThreadID].message_images.edges[0].node.image2;
|
47
|
-
return imageData;
|
48
|
-
});
|
49
|
-
})
|
50
|
-
);
|
51
|
-
})
|
52
|
-
.then(resData => callback(null, resData))
|
53
|
-
.catch(function (err) {
|
54
|
-
log.error("Error in getThreadPictures", err);
|
55
|
-
callback(err);
|
56
|
-
});
|
57
|
-
return returnPromise;
|
58
|
-
};
|
59
|
-
};
|
@@ -1,46 +0,0 @@
|
|
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") throw { error: "Please pass a boolean as a second argument." };
|
9
|
-
|
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, data) {
|
19
|
-
if (err) return rejectFunc(err);
|
20
|
-
resolveFunc(data);
|
21
|
-
};
|
22
|
-
}
|
23
|
-
|
24
|
-
var form = {
|
25
|
-
viewer_id: userID,
|
26
|
-
"frefs[0]": "jwl",
|
27
|
-
floc: "friend_center_requests",
|
28
|
-
ref: "/reqs.php",
|
29
|
-
action: (accept ? "confirm" : "reject")
|
30
|
-
};
|
31
|
-
|
32
|
-
defaultFuncs
|
33
|
-
.post("https://www.facebook.com/requests/friends/ajax/", ctx.jar, form)
|
34
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
35
|
-
.then(function(resData) {
|
36
|
-
if (resData.payload.err) throw { err: resData.payload.err };
|
37
|
-
return callback();
|
38
|
-
})
|
39
|
-
.catch(function(err) {
|
40
|
-
log.error("handleFriendRequest", err);
|
41
|
-
return callback(err);
|
42
|
-
});
|
43
|
-
|
44
|
-
return returnPromise;
|
45
|
-
};
|
46
|
-
};
|
@@ -1,47 +0,0 @@
|
|
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") throw { error: "Please pass a boolean as a second argument." };
|
9
|
-
|
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, data) {
|
19
|
-
if (err) return rejectFunc(err);
|
20
|
-
resolveFunc(data);
|
21
|
-
};
|
22
|
-
}
|
23
|
-
|
24
|
-
var form = {
|
25
|
-
client: "mercury"
|
26
|
-
};
|
27
|
-
|
28
|
-
if (utils.getType(threadID) !== "Array") threadID = [threadID];
|
29
|
-
|
30
|
-
var messageBox = accept ? "inbox" : "other";
|
31
|
-
for (var i = 0; i < threadID.length; i++) form[messageBox + "[" + i + "]"] = threadID[i];
|
32
|
-
|
33
|
-
defaultFuncs
|
34
|
-
.post("https://www.facebook.com/ajax/mercury/move_thread.php", ctx.jar, form)
|
35
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
36
|
-
.then(function (resData) {
|
37
|
-
if (resData.error) throw resData;
|
38
|
-
return callback();
|
39
|
-
})
|
40
|
-
.catch(function (err) {
|
41
|
-
log.error("handleMessageRequest", err);
|
42
|
-
return callback(err);
|
43
|
-
});
|
44
|
-
|
45
|
-
return returnPromise;
|
46
|
-
};
|
47
|
-
};
|