alicezetion 1.3.0 → 1.3.2
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 +0 -0
- 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,23 +3,51 @@
|
|
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 removeUserFromGroup(userID, threadID, callback) {
|
8
|
-
if (
|
9
|
-
|
10
|
-
|
8
|
+
if (
|
9
|
+
!callback &&
|
10
|
+
(utils.getType(threadID) === "Function" ||
|
11
|
+
utils.getType(threadID) === "AsyncFunction")
|
12
|
+
) {
|
13
|
+
throw { error: "please pass a threadID as a second argument." };
|
14
|
+
}
|
15
|
+
if (
|
16
|
+
utils.getType(threadID) !== "Number" &&
|
17
|
+
utils.getType(threadID) !== "String"
|
18
|
+
) {
|
19
|
+
throw {
|
20
|
+
error:
|
21
|
+
"threadID should be of type Number or String and not " +
|
22
|
+
utils.getType(threadID) +
|
23
|
+
"."
|
24
|
+
};
|
25
|
+
}
|
26
|
+
if (
|
27
|
+
utils.getType(userID) !== "Number" &&
|
28
|
+
utils.getType(userID) !== "String"
|
29
|
+
) {
|
30
|
+
throw {
|
31
|
+
error:
|
32
|
+
"userID should be of type Number or String and not " +
|
33
|
+
utils.getType(userID) +
|
34
|
+
"."
|
35
|
+
};
|
36
|
+
}
|
11
37
|
|
12
|
-
var resolveFunc = function
|
13
|
-
var rejectFunc = function
|
38
|
+
var resolveFunc = function(){};
|
39
|
+
var rejectFunc = function(){};
|
14
40
|
var returnPromise = new Promise(function (resolve, reject) {
|
15
41
|
resolveFunc = resolve;
|
16
42
|
rejectFunc = reject;
|
17
43
|
});
|
18
44
|
|
19
45
|
if (!callback) {
|
20
|
-
callback = function (err,
|
21
|
-
if (err)
|
22
|
-
|
46
|
+
callback = function (err, friendList) {
|
47
|
+
if (err) {
|
48
|
+
return rejectFunc(err);
|
49
|
+
}
|
50
|
+
resolveFunc(friendList);
|
23
51
|
};
|
24
52
|
}
|
25
53
|
|
@@ -31,15 +59,21 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
31
59
|
defaultFuncs
|
32
60
|
.post("https://www.facebook.com/chat/remove_participants", ctx.jar, form)
|
33
61
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
34
|
-
.then(function
|
35
|
-
if (!resData)
|
36
|
-
|
62
|
+
.then(function(resData) {
|
63
|
+
if (!resData) {
|
64
|
+
throw { error: "Remove from group failed." };
|
65
|
+
}
|
66
|
+
if (resData.error) {
|
67
|
+
throw resData;
|
68
|
+
}
|
69
|
+
|
37
70
|
return callback();
|
38
71
|
})
|
39
|
-
.catch(function
|
40
|
-
log.error("removeUserFromGroup",
|
72
|
+
.catch(function(err) {
|
73
|
+
log.error("removeUserFromGroup", err);
|
41
74
|
return callback(err);
|
42
75
|
});
|
76
|
+
|
43
77
|
return returnPromise;
|
44
78
|
};
|
45
79
|
};
|
@@ -3,34 +3,43 @@
|
|
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 resolvePhotoUrl(photoID, 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 (err,
|
17
|
-
if (err)
|
18
|
-
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
19
21
|
};
|
20
22
|
}
|
21
23
|
|
22
24
|
defaultFuncs
|
23
|
-
.get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, {
|
25
|
+
.get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, {
|
26
|
+
photo_id: photoID
|
27
|
+
})
|
24
28
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
25
29
|
.then(resData => {
|
26
|
-
if (resData.error)
|
30
|
+
if (resData.error) {
|
31
|
+
throw resData;
|
32
|
+
}
|
33
|
+
|
27
34
|
var photoUrl = resData.jsmods.require[0][3][0];
|
35
|
+
|
28
36
|
return callback(null, photoUrl);
|
29
37
|
})
|
30
38
|
.catch(err => {
|
31
39
|
log.error("resolvePhotoUrl", err);
|
32
40
|
return callback(err);
|
33
41
|
});
|
42
|
+
|
34
43
|
return returnPromise;
|
35
44
|
};
|
36
45
|
};
|
@@ -2,19 +2,21 @@
|
|
2
2
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
|
5
|
-
module.exports = function
|
5
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
6
6
|
return function searchForThread(name, callback) {
|
7
|
-
var resolveFunc = function
|
8
|
-
var rejectFunc = function
|
7
|
+
var resolveFunc = function(){};
|
8
|
+
var rejectFunc = function(){};
|
9
9
|
var returnPromise = new Promise(function (resolve, reject) {
|
10
10
|
resolveFunc = resolve;
|
11
11
|
rejectFunc = reject;
|
12
12
|
});
|
13
13
|
|
14
14
|
if (!callback) {
|
15
|
-
callback = function (err,
|
16
|
-
if (err)
|
17
|
-
|
15
|
+
callback = function (err, friendList) {
|
16
|
+
if (err) {
|
17
|
+
return rejectFunc(err);
|
18
|
+
}
|
19
|
+
resolveFunc(friendList);
|
18
20
|
};
|
19
21
|
}
|
20
22
|
|
@@ -27,16 +29,25 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
27
29
|
};
|
28
30
|
|
29
31
|
defaultFuncs
|
30
|
-
.post(
|
32
|
+
.post(
|
33
|
+
"https://www.facebook.com/ajax/mercury/search_threads.php",
|
34
|
+
ctx.jar,
|
35
|
+
tmpForm
|
36
|
+
)
|
31
37
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
32
|
-
.then(function
|
33
|
-
if (resData.error)
|
34
|
-
|
38
|
+
.then(function(resData) {
|
39
|
+
if (resData.error) {
|
40
|
+
throw resData;
|
41
|
+
}
|
42
|
+
if (!resData.payload.mercury_payload.threads) {
|
43
|
+
return callback({ error: "Could not find thread `" + name + "`." });
|
44
|
+
}
|
35
45
|
return callback(
|
36
46
|
null,
|
37
47
|
resData.payload.mercury_payload.threads.map(utils.formatThread)
|
38
48
|
);
|
39
49
|
});
|
50
|
+
|
40
51
|
return returnPromise;
|
41
52
|
};
|
42
53
|
};
|
@@ -15,36 +15,52 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
15
15
|
// Check if thread is a single person chat or a group chat
|
16
16
|
// More info on this is in api.sendMessage
|
17
17
|
if (utils.getType(isGroup) == "Boolean") {
|
18
|
-
if (!isGroup)
|
19
|
-
|
18
|
+
if (!isGroup) {
|
19
|
+
form.to = threadID;
|
20
|
+
}
|
20
21
|
defaultFuncs
|
21
22
|
.post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
|
22
23
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
23
24
|
.then(function (resData) {
|
24
|
-
if (resData.error)
|
25
|
+
if (resData.error) {
|
26
|
+
throw resData;
|
27
|
+
}
|
28
|
+
|
25
29
|
return callback();
|
26
30
|
})
|
27
31
|
.catch(function (err) {
|
28
32
|
log.error("sendTypingIndicator", err);
|
29
|
-
if (utils.getType(err) == "Object" && err.error === "Not logged in")
|
33
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in") {
|
34
|
+
ctx.loggedIn = false;
|
35
|
+
}
|
30
36
|
return callback(err);
|
31
37
|
});
|
32
|
-
}
|
33
|
-
else {
|
38
|
+
} else {
|
34
39
|
api.getUserInfo(threadID, function (err, res) {
|
35
|
-
if (err)
|
40
|
+
if (err) {
|
41
|
+
return callback(err);
|
42
|
+
}
|
43
|
+
|
36
44
|
// If id is single person chat
|
37
|
-
if (Object.keys(res).length > 0)
|
45
|
+
if (Object.keys(res).length > 0) {
|
46
|
+
form.to = threadID;
|
47
|
+
}
|
48
|
+
|
38
49
|
defaultFuncs
|
39
50
|
.post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
|
40
51
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
41
52
|
.then(function (resData) {
|
42
|
-
if (resData.error)
|
53
|
+
if (resData.error) {
|
54
|
+
throw resData;
|
55
|
+
}
|
56
|
+
|
43
57
|
return callback();
|
44
58
|
})
|
45
59
|
.catch(function (err) {
|
46
60
|
log.error("sendTypingIndicator", err);
|
47
|
-
if (utils.getType(err) == "Object" && err.error === "Not logged in.")
|
61
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
|
62
|
+
ctx.loggedIn = false;
|
63
|
+
}
|
48
64
|
return callback(err);
|
49
65
|
});
|
50
66
|
});
|
@@ -52,18 +68,35 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
52
68
|
}
|
53
69
|
|
54
70
|
return function sendTypingIndicator(threadID, callback, isGroup) {
|
55
|
-
if (
|
56
|
-
|
71
|
+
if (
|
72
|
+
utils.getType(callback) !== "Function" &&
|
73
|
+
utils.getType(callback) !== "AsyncFunction"
|
74
|
+
) {
|
75
|
+
if (callback) {
|
76
|
+
log.warn(
|
77
|
+
"sendTypingIndicator",
|
78
|
+
"callback is not a function - ignoring."
|
79
|
+
);
|
80
|
+
}
|
57
81
|
callback = () => { };
|
58
82
|
}
|
59
83
|
|
60
84
|
makeTypingIndicator(true, threadID, callback, isGroup);
|
61
85
|
|
62
86
|
return function end(cb) {
|
63
|
-
if (
|
64
|
-
|
87
|
+
if (
|
88
|
+
utils.getType(cb) !== "Function" &&
|
89
|
+
utils.getType(cb) !== "AsyncFunction"
|
90
|
+
) {
|
91
|
+
if (cb) {
|
92
|
+
log.warn(
|
93
|
+
"sendTypingIndicator",
|
94
|
+
"callback is not a function - ignoring."
|
95
|
+
);
|
96
|
+
}
|
65
97
|
cb = () => { };
|
66
98
|
}
|
99
|
+
|
67
100
|
makeTypingIndicator(false, threadID, cb, isGroup);
|
68
101
|
};
|
69
102
|
};
|
@@ -3,19 +3,21 @@
|
|
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 setMessageReaction(reaction, messageID, callback, forceCustomReaction) {
|
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 (err,
|
17
|
-
if (err)
|
18
|
-
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
19
21
|
};
|
20
22
|
}
|
21
23
|
|
@@ -66,7 +68,9 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
66
68
|
reaction = "\uD83D\uDC97";
|
67
69
|
break;
|
68
70
|
default:
|
69
|
-
if (forceCustomReaction)
|
71
|
+
if (forceCustomReaction) {
|
72
|
+
break;
|
73
|
+
}
|
70
74
|
return callback({ error: "Reaction is not a valid emoji." });
|
71
75
|
}
|
72
76
|
|
@@ -87,17 +91,27 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
87
91
|
};
|
88
92
|
|
89
93
|
defaultFuncs
|
90
|
-
.postFormData(
|
94
|
+
.postFormData(
|
95
|
+
"https://www.facebook.com/webgraphql/mutation/",
|
96
|
+
ctx.jar,
|
97
|
+
{},
|
98
|
+
qs
|
99
|
+
)
|
91
100
|
.then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
|
92
|
-
.then(function
|
93
|
-
if (!resData)
|
94
|
-
|
101
|
+
.then(function(resData) {
|
102
|
+
if (!resData) {
|
103
|
+
throw { error: "setReaction returned empty object." };
|
104
|
+
}
|
105
|
+
if (resData.error) {
|
106
|
+
throw resData;
|
107
|
+
}
|
95
108
|
callback(null);
|
96
109
|
})
|
97
|
-
.catch(function
|
110
|
+
.catch(function(err) {
|
98
111
|
log.error("setReaction", err);
|
99
112
|
return callback(err);
|
100
113
|
});
|
114
|
+
|
101
115
|
return returnPromise;
|
102
116
|
};
|
103
117
|
};
|
@@ -3,19 +3,21 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function
|
7
|
-
return function
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
+
return function unsendMessage(postID, type, callback) {
|
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 (err,
|
17
|
-
if (err)
|
18
|
-
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
19
21
|
};
|
20
22
|
}
|
21
23
|
|
@@ -29,7 +31,9 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
29
31
|
};
|
30
32
|
if (typeof type != "number") {
|
31
33
|
type = map[type.toLocaleLowerCase()];
|
32
|
-
if (!type)
|
34
|
+
if (!type) {
|
35
|
+
type = 1;
|
36
|
+
}
|
33
37
|
}
|
34
38
|
var form = {
|
35
39
|
av: ctx.userID,
|
@@ -41,23 +45,32 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
41
45
|
input: {
|
42
46
|
client_mutation_id: "7",
|
43
47
|
actor_id: ctx.userID,
|
44
|
-
feedback_reaction: type
|
48
|
+
feedback_reaction: type,
|
49
|
+
|
45
50
|
},
|
46
51
|
useDefaultActor: true
|
47
52
|
})
|
48
53
|
};
|
49
54
|
|
50
55
|
defaultFuncs
|
51
|
-
.post(
|
56
|
+
.post(
|
57
|
+
"https://www.facebook.com/api/graphql/",
|
58
|
+
ctx.jar,
|
59
|
+
form
|
60
|
+
)
|
52
61
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
53
|
-
.then(function
|
54
|
-
if (resData.error)
|
62
|
+
.then(function(resData) {
|
63
|
+
if (resData.error) {
|
64
|
+
throw resData;
|
65
|
+
}
|
66
|
+
|
55
67
|
return callback();
|
56
68
|
})
|
57
|
-
.catch(function
|
69
|
+
.catch(function(err) {
|
58
70
|
log.error("setPostReaction", err);
|
59
71
|
return callback(err);
|
60
72
|
});
|
73
|
+
|
61
74
|
return returnPromise;
|
62
75
|
};
|
63
76
|
};
|
package/leiamnash/setTitle.js
CHANGED
@@ -3,23 +3,29 @@
|
|
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 setTitle(newTitle, threadID, callback) {
|
8
|
-
if (
|
8
|
+
if (
|
9
|
+
!callback &&
|
10
|
+
(utils.getType(threadID) === "Function" ||
|
11
|
+
utils.getType(threadID) === "AsyncFunction")
|
12
|
+
) {
|
9
13
|
throw { error: "please pass a threadID as a second argument." };
|
14
|
+
}
|
10
15
|
|
11
|
-
|
12
|
-
var
|
13
|
-
var rejectFunc = function () { };
|
16
|
+
var resolveFunc = function(){};
|
17
|
+
var rejectFunc = function(){};
|
14
18
|
var returnPromise = new Promise(function (resolve, reject) {
|
15
19
|
resolveFunc = resolve;
|
16
20
|
rejectFunc = reject;
|
17
21
|
});
|
18
22
|
|
19
23
|
if (!callback) {
|
20
|
-
callback = function (err,
|
21
|
-
if (err)
|
22
|
-
|
24
|
+
callback = function (err, friendList) {
|
25
|
+
if (err) {
|
26
|
+
return rejectFunc(err);
|
27
|
+
}
|
28
|
+
resolveFunc(friendList);
|
23
29
|
};
|
24
30
|
}
|
25
31
|
|
@@ -55,16 +61,26 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
55
61
|
defaultFuncs
|
56
62
|
.post("https://www.facebook.com/messaging/set_thread_name/", ctx.jar, form)
|
57
63
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
58
|
-
.then(function
|
59
|
-
if (resData.error && resData.error === 1545012)
|
60
|
-
|
61
|
-
|
64
|
+
.then(function(resData) {
|
65
|
+
if (resData.error && resData.error === 1545012) {
|
66
|
+
throw { error: "Cannot change chat title: Not member of chat." };
|
67
|
+
}
|
68
|
+
|
69
|
+
if (resData.error && resData.error === 1545003) {
|
70
|
+
throw { error: "Cannot set title of single-user chat." };
|
71
|
+
}
|
72
|
+
|
73
|
+
if (resData.error) {
|
74
|
+
throw resData;
|
75
|
+
}
|
76
|
+
|
62
77
|
return callback();
|
63
78
|
})
|
64
|
-
.catch(function
|
79
|
+
.catch(function(err) {
|
65
80
|
log.error("setTitle", err);
|
66
81
|
return callback(err);
|
67
82
|
});
|
83
|
+
|
68
84
|
return returnPromise;
|
69
85
|
};
|
70
86
|
};
|
@@ -1,41 +1,57 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
module.exports = function
|
3
|
+
module.exports = function(_defaultFuncs, _api, _ctx) {
|
4
4
|
// Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more
|
5
5
|
return {
|
6
|
-
|
6
|
+
//Old hex colors.
|
7
|
+
////MessengerBlue: null,
|
8
|
+
////Viking: "#44bec7",
|
9
|
+
////GoldenPoppy: "#ffc300",
|
10
|
+
////RadicalRed: "#fa3c4c",
|
11
|
+
////Shocking: "#d696bb",
|
12
|
+
////PictonBlue: "#6699cc",
|
13
|
+
////FreeSpeechGreen: "#13cf13",
|
14
|
+
////Pumpkin: "#ff7e29",
|
15
|
+
////LightCoral: "#e68585",
|
16
|
+
////MediumSlateBlue: "#7646ff",
|
17
|
+
////DeepSkyBlue: "#20cef5",
|
18
|
+
////Fern: "#67b868",
|
19
|
+
////Cameo: "#d4a88c",
|
20
|
+
////BrilliantRose: "#ff5ca1",
|
21
|
+
////BilobaFlower: "#a695c7"
|
22
|
+
|
7
23
|
//#region This part is for backward compatibly
|
8
24
|
//trying to match the color one-by-one. kill me plz
|
9
|
-
MessengerBlue:
|
10
|
-
Viking:
|
11
|
-
GoldenPoppy:
|
12
|
-
RadicalRed:
|
13
|
-
Shocking:
|
25
|
+
MessengerBlue: "196241301102133", //DefaultBlue
|
26
|
+
Viking: "1928399724138152", //TealBlue
|
27
|
+
GoldenPoppy: "174636906462322", //Yellow
|
28
|
+
RadicalRed: "2129984390566328", //Red
|
29
|
+
Shocking: "2058653964378557", //LavenderPurple
|
14
30
|
FreeSpeechGreen: "2136751179887052", //Green
|
15
|
-
Pumpkin:
|
16
|
-
LightCoral:
|
31
|
+
Pumpkin: "175615189761153", //Orange
|
32
|
+
LightCoral: "980963458735625", //CoralPink
|
17
33
|
MediumSlateBlue: "234137870477637", //BrightPurple
|
18
|
-
DeepSkyBlue:
|
19
|
-
BrilliantRose:
|
34
|
+
DeepSkyBlue: "2442142322678320", //AquaBlue
|
35
|
+
BrilliantRose: "169463077092846", //HotPink
|
20
36
|
//i've tried my best, everything else can't be mapped. (or is it?) -UIRI 2020
|
21
37
|
//#endregion
|
22
38
|
|
23
|
-
DefaultBlue:
|
24
|
-
HotPink:
|
25
|
-
AquaBlue:
|
26
|
-
BrightPurple:
|
27
|
-
CoralPink:
|
28
|
-
Orange:
|
29
|
-
Green:
|
30
|
-
LavenderPurple:
|
31
|
-
Red:
|
32
|
-
Yellow:
|
33
|
-
TealBlue:
|
34
|
-
Aqua:
|
35
|
-
Mango:
|
36
|
-
Berry:
|
37
|
-
Citrus:
|
38
|
-
Candy:
|
39
|
-
//StarWars:
|
39
|
+
DefaultBlue: "196241301102133",
|
40
|
+
HotPink: "169463077092846",
|
41
|
+
AquaBlue: "2442142322678320",
|
42
|
+
BrightPurple: "234137870477637",
|
43
|
+
CoralPink: "980963458735625",
|
44
|
+
Orange: "175615189761153",
|
45
|
+
Green: "2136751179887052",
|
46
|
+
LavenderPurple: "2058653964378557",
|
47
|
+
Red: "2129984390566328",
|
48
|
+
Yellow: "174636906462322",
|
49
|
+
TealBlue: "1928399724138152",
|
50
|
+
Aqua: "417639218648241",
|
51
|
+
Mango: "930060997172551",
|
52
|
+
Berry: "164535220883264",
|
53
|
+
Citrus: "370940413392601",
|
54
|
+
Candy: "205488546921017",
|
55
|
+
//StarWars: "809305022860427" Removed.
|
40
56
|
};
|
41
57
|
};
|
package/leiamnash/unfriend.js
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function
|
7
|
-
return function
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
+
return function unsendMessage(userID, callback) {
|
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;
|
@@ -14,7 +14,9 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
14
14
|
|
15
15
|
if (!callback) {
|
16
16
|
callback = function (err, friendList) {
|
17
|
-
if (err)
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
18
20
|
resolveFunc(friendList);
|
19
21
|
};
|
20
22
|
}
|
@@ -27,16 +29,24 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
27
29
|
};
|
28
30
|
|
29
31
|
defaultFuncs
|
30
|
-
.post(
|
32
|
+
.post(
|
33
|
+
"https://www.facebook.com/ajax/profile/removefriendconfirm.php",
|
34
|
+
ctx.jar,
|
35
|
+
form
|
36
|
+
)
|
31
37
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
32
|
-
.then(function
|
33
|
-
if (resData.error)
|
38
|
+
.then(function(resData) {
|
39
|
+
if (resData.error) {
|
40
|
+
throw resData;
|
41
|
+
}
|
42
|
+
|
34
43
|
return callback();
|
35
44
|
})
|
36
|
-
.catch(function
|
45
|
+
.catch(function(err) {
|
37
46
|
log.error("unfriend", err);
|
38
47
|
return callback(err);
|
39
48
|
});
|
49
|
+
|
40
50
|
return returnPromise;
|
41
51
|
};
|
42
52
|
};
|