alicezetion 1.2.7 → 1.2.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/index.js +2 -5
- package/leiamnash/addExternalModule.js +10 -6
- package/leiamnash/addUserToGroup.js +52 -16
- package/leiamnash/changeAdminStatus.js +69 -37
- package/leiamnash/changeArchivedStatus.js +26 -12
- package/leiamnash/changeBio.js +19 -6
- package/leiamnash/changeBlockedStatus.js +14 -3
- package/leiamnash/changeGroupImage.js +40 -16
- package/leiamnash/changeNickname.js +27 -11
- package/leiamnash/changeThreadColor.js +20 -10
- package/leiamnash/changeThreadEmoji.js +24 -10
- package/leiamnash/chat.js +414 -279
- package/leiamnash/createNewGroup.js +28 -12
- package/leiamnash/createPoll.js +25 -13
- package/leiamnash/deleteMessage.js +24 -12
- package/leiamnash/deleteThread.js +25 -11
- package/leiamnash/forwardAttachment.js +26 -13
- package/leiamnash/getCurrentUserID.js +1 -1
- package/leiamnash/getEmojiUrl.js +4 -2
- package/leiamnash/getFriendsList.js +21 -10
- package/leiamnash/getThreadHistory.js +166 -58
- package/leiamnash/getThreadHistoryDeprecated.js +42 -20
- package/leiamnash/getThreadInfo.js +60 -25
- package/leiamnash/getThreadInfoDeprecated.js +42 -18
- package/leiamnash/getThreadList.js +66 -41
- package/leiamnash/getThreadListDeprecated.js +43 -14
- package/leiamnash/getThreadPictures.js +37 -17
- package/leiamnash/getUserID.js +14 -9
- package/leiamnash/getUserInfo.js +18 -12
- package/leiamnash/handleFriendRequest.js +52 -37
- package/leiamnash/handleMessageRequest.js +32 -14
- package/leiamnash/httpGet.js +17 -12
- package/leiamnash/httpPost.js +17 -12
- package/leiamnash/listenMqtt.js +2 -1
- package/leiamnash/logout.js +20 -13
- package/leiamnash/markAsDelivered.js +22 -11
- package/leiamnash/markAsRead.js +21 -11
- package/leiamnash/markAsReadAll.js +20 -10
- package/leiamnash/markAsSeen.js +18 -7
- package/leiamnash/muteThread.js +18 -11
- package/leiamnash/removeUserFromGroup.js +48 -14
- package/leiamnash/resolvePhotoUrl.js +17 -8
- package/leiamnash/searchForThread.js +21 -10
- package/leiamnash/sendTypingIndicator.js +47 -14
- package/leiamnash/setMessageReaction.js +26 -12
- package/leiamnash/setPostReaction.js +26 -13
- package/leiamnash/setTitle.js +29 -13
- package/leiamnash/threadColors.js +44 -28
- package/leiamnash/unfriend.js +19 -9
- package/leiamnash/unsendMessage.js +19 -9
- package/package.json +1 -1
- package/replit.nix +3 -1
- package/utils.js +0 -0
- package/leiamnash/forwardMessage.js +0 -0
- package/leiamnash/listen.js +0 -553
- package/leiamnash/listenMqtt-Test.js +0 -687
@@ -3,27 +3,34 @@
|
|
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 changeThreadColor(color, 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
15
|
if (!callback) {
|
16
|
-
callback = function
|
17
|
-
if (err)
|
16
|
+
callback = function(err) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
18
20
|
resolveFunc(err);
|
19
21
|
};
|
20
22
|
}
|
21
23
|
|
22
24
|
var validatedColor = color !== null ? color.toLowerCase() : color; // API only accepts lowercase letters in hex string
|
23
|
-
var colorList = Object.keys(api.threadColors).map(function
|
25
|
+
var colorList = Object.keys(api.threadColors).map(function(name) {
|
24
26
|
return api.threadColors[name];
|
25
27
|
});
|
26
|
-
if (!colorList.includes(validatedColor))
|
28
|
+
if (!colorList.includes(validatedColor)) {
|
29
|
+
throw {
|
30
|
+
error:
|
31
|
+
"The color you are trying to use is not a valid thread color. Use api.threadColors to find acceptable values."
|
32
|
+
};
|
33
|
+
}
|
27
34
|
|
28
35
|
var form = {
|
29
36
|
dpr: 1,
|
@@ -47,11 +54,14 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
47
54
|
defaultFuncs
|
48
55
|
.post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
|
49
56
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
50
|
-
.then(function
|
51
|
-
if (resData[resData.length - 1].error_results > 0)
|
57
|
+
.then(function(resData) {
|
58
|
+
if (resData[resData.length - 1].error_results > 0) {
|
59
|
+
throw resData[0].o0.errors;
|
60
|
+
}
|
61
|
+
|
52
62
|
return callback();
|
53
63
|
})
|
54
|
-
.catch(function
|
64
|
+
.catch(function(err) {
|
55
65
|
log.error("changeThreadColor", err);
|
56
66
|
return callback(err);
|
57
67
|
});
|
@@ -3,18 +3,20 @@
|
|
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 changeThreadEmoji(emoji, 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
15
|
if (!callback) {
|
16
|
-
callback = function
|
17
|
-
if (err)
|
16
|
+
callback = function(err) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
18
20
|
resolveFunc();
|
19
21
|
};
|
20
22
|
}
|
@@ -24,14 +26,26 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
24
26
|
};
|
25
27
|
|
26
28
|
defaultFuncs
|
27
|
-
.post(
|
29
|
+
.post(
|
30
|
+
"https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",
|
31
|
+
ctx.jar,
|
32
|
+
form
|
33
|
+
)
|
28
34
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
29
|
-
.then(function
|
30
|
-
if (resData.error === 1357031)
|
31
|
-
|
35
|
+
.then(function(resData) {
|
36
|
+
if (resData.error === 1357031) {
|
37
|
+
throw {
|
38
|
+
error:
|
39
|
+
"Trying to change emoji of a chat that doesn't exist. Have at least one message in the thread before trying to change the emoji."
|
40
|
+
};
|
41
|
+
}
|
42
|
+
if (resData.error) {
|
43
|
+
throw resData;
|
44
|
+
}
|
45
|
+
|
32
46
|
return callback();
|
33
47
|
})
|
34
|
-
.catch(function
|
48
|
+
.catch(function(err) {
|
35
49
|
log.error("changeThreadEmoji", err);
|
36
50
|
return callback(err);
|
37
51
|
});
|