alicezetion 1.2.5 → 1.2.6
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 +5 -2
- package/leiamnash/addExternalModule.js +6 -10
- package/leiamnash/addUserToGroup.js +16 -52
- package/leiamnash/changeAdminStatus.js +37 -69
- package/leiamnash/changeArchivedStatus.js +12 -26
- package/leiamnash/changeBio.js +6 -19
- package/leiamnash/changeBlockedStatus.js +3 -14
- package/leiamnash/changeGroupImage.js +16 -40
- package/leiamnash/changeNickname.js +11 -27
- package/leiamnash/changeThreadColor.js +10 -20
- package/leiamnash/changeThreadEmoji.js +10 -24
- package/leiamnash/chat.js +279 -414
- package/leiamnash/createNewGroup.js +12 -28
- package/leiamnash/createPoll.js +13 -25
- package/leiamnash/deleteMessage.js +12 -24
- package/leiamnash/deleteThread.js +11 -25
- package/leiamnash/forwardAttachment.js +13 -26
- package/leiamnash/forwardMessage.js +0 -0
- package/leiamnash/getCurrentUserID.js +1 -1
- package/leiamnash/getEmojiUrl.js +2 -4
- package/leiamnash/getFriendsList.js +10 -21
- package/leiamnash/getThreadHistory.js +58 -166
- package/leiamnash/getThreadHistoryDeprecated.js +20 -42
- package/leiamnash/getThreadInfo.js +25 -60
- package/leiamnash/getThreadInfoDeprecated.js +18 -42
- package/leiamnash/getThreadList.js +41 -66
- package/leiamnash/getThreadListDeprecated.js +14 -43
- package/leiamnash/getThreadPictures.js +17 -37
- package/leiamnash/getUserID.js +9 -14
- package/leiamnash/getUserInfo.js +12 -18
- package/leiamnash/handleFriendRequest.js +37 -52
- package/leiamnash/handleMessageRequest.js +14 -32
- package/leiamnash/httpGet.js +12 -17
- package/leiamnash/httpPost.js +12 -17
- package/leiamnash/listen.js +553 -0
- package/leiamnash/listenMqtt-Test.js +687 -0
- package/leiamnash/listenMqtt.js +1 -2
- package/leiamnash/logout.js +13 -20
- package/leiamnash/markAsDelivered.js +11 -22
- package/leiamnash/markAsRead.js +11 -21
- package/leiamnash/markAsReadAll.js +10 -20
- package/leiamnash/markAsSeen.js +7 -18
- package/leiamnash/muteThread.js +11 -18
- package/leiamnash/removeUserFromGroup.js +14 -48
- package/leiamnash/resolvePhotoUrl.js +8 -17
- package/leiamnash/searchForThread.js +10 -21
- package/leiamnash/sendTypingIndicator.js +14 -47
- package/leiamnash/setMessageReaction.js +12 -26
- package/leiamnash/setPostReaction.js +13 -26
- package/leiamnash/setTitle.js +13 -29
- package/leiamnash/threadColors.js +28 -44
- package/leiamnash/unfriend.js +9 -19
- package/leiamnash/unsendMessage.js +9 -19
- package/package.json +1 -1
- package/replit.nix +1 -3
- package/utils.js +0 -0
@@ -15,52 +15,36 @@ 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
|
-
|
20
|
-
}
|
18
|
+
if (!isGroup) form.to = threadID;
|
19
|
+
|
21
20
|
defaultFuncs
|
22
21
|
.post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
|
23
22
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
24
23
|
.then(function (resData) {
|
25
|
-
if (resData.error)
|
26
|
-
throw resData;
|
27
|
-
}
|
28
|
-
|
24
|
+
if (resData.error) throw resData;
|
29
25
|
return callback();
|
30
26
|
})
|
31
27
|
.catch(function (err) {
|
32
28
|
log.error("sendTypingIndicator", err);
|
33
|
-
if (utils.getType(err) == "Object" && err.error === "Not logged in")
|
34
|
-
ctx.loggedIn = false;
|
35
|
-
}
|
29
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in") ctx.loggedIn = false;
|
36
30
|
return callback(err);
|
37
31
|
});
|
38
|
-
}
|
32
|
+
}
|
33
|
+
else {
|
39
34
|
api.getUserInfo(threadID, function (err, res) {
|
40
|
-
if (err)
|
41
|
-
return callback(err);
|
42
|
-
}
|
43
|
-
|
35
|
+
if (err) return callback(err);
|
44
36
|
// If id is single person chat
|
45
|
-
if (Object.keys(res).length > 0)
|
46
|
-
form.to = threadID;
|
47
|
-
}
|
48
|
-
|
37
|
+
if (Object.keys(res).length > 0) form.to = threadID;
|
49
38
|
defaultFuncs
|
50
39
|
.post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
|
51
40
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
52
41
|
.then(function (resData) {
|
53
|
-
if (resData.error)
|
54
|
-
throw resData;
|
55
|
-
}
|
56
|
-
|
42
|
+
if (resData.error) throw resData;
|
57
43
|
return callback();
|
58
44
|
})
|
59
45
|
.catch(function (err) {
|
60
46
|
log.error("sendTypingIndicator", err);
|
61
|
-
if (utils.getType(err) == "Object" && err.error === "Not logged in.")
|
62
|
-
ctx.loggedIn = false;
|
63
|
-
}
|
47
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
|
64
48
|
return callback(err);
|
65
49
|
});
|
66
50
|
});
|
@@ -68,35 +52,18 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
68
52
|
}
|
69
53
|
|
70
54
|
return function sendTypingIndicator(threadID, callback, isGroup) {
|
71
|
-
if (
|
72
|
-
|
73
|
-
utils.getType(callback) !== "AsyncFunction"
|
74
|
-
) {
|
75
|
-
if (callback) {
|
76
|
-
log.warn(
|
77
|
-
"sendTypingIndicator",
|
78
|
-
"callback is not a function - ignoring."
|
79
|
-
);
|
80
|
-
}
|
55
|
+
if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
|
56
|
+
if (callback) log.warn("sendTypingIndicator", "callback is not a function - ignoring.");
|
81
57
|
callback = () => { };
|
82
58
|
}
|
83
59
|
|
84
60
|
makeTypingIndicator(true, threadID, callback, isGroup);
|
85
61
|
|
86
62
|
return function end(cb) {
|
87
|
-
if (
|
88
|
-
|
89
|
-
utils.getType(cb) !== "AsyncFunction"
|
90
|
-
) {
|
91
|
-
if (cb) {
|
92
|
-
log.warn(
|
93
|
-
"sendTypingIndicator",
|
94
|
-
"callback is not a function - ignoring."
|
95
|
-
);
|
96
|
-
}
|
63
|
+
if (utils.getType(cb) !== "Function" && utils.getType(cb) !== "AsyncFunction") {
|
64
|
+
if (cb) log.warn("sendTypingIndicator", "callback is not a function - ignoring.");
|
97
65
|
cb = () => { };
|
98
66
|
}
|
99
|
-
|
100
67
|
makeTypingIndicator(false, threadID, cb, isGroup);
|
101
68
|
};
|
102
69
|
};
|
@@ -3,21 +3,19 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
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
|
-
|
19
|
-
}
|
20
|
-
resolveFunc(friendList);
|
16
|
+
callback = function (err, data) {
|
17
|
+
if (err) return rejectFunc(err);
|
18
|
+
resolveFunc(data);
|
21
19
|
};
|
22
20
|
}
|
23
21
|
|
@@ -68,9 +66,7 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
68
66
|
reaction = "\uD83D\uDC97";
|
69
67
|
break;
|
70
68
|
default:
|
71
|
-
if (forceCustomReaction)
|
72
|
-
break;
|
73
|
-
}
|
69
|
+
if (forceCustomReaction) break;
|
74
70
|
return callback({ error: "Reaction is not a valid emoji." });
|
75
71
|
}
|
76
72
|
|
@@ -91,27 +87,17 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
91
87
|
};
|
92
88
|
|
93
89
|
defaultFuncs
|
94
|
-
.postFormData(
|
95
|
-
"https://www.facebook.com/webgraphql/mutation/",
|
96
|
-
ctx.jar,
|
97
|
-
{},
|
98
|
-
qs
|
99
|
-
)
|
90
|
+
.postFormData("https://www.facebook.com/webgraphql/mutation/", ctx.jar, {}, qs)
|
100
91
|
.then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
|
101
|
-
.then(function(resData) {
|
102
|
-
if (!resData) {
|
103
|
-
|
104
|
-
}
|
105
|
-
if (resData.error) {
|
106
|
-
throw resData;
|
107
|
-
}
|
92
|
+
.then(function (resData) {
|
93
|
+
if (!resData) throw { error: "setReaction returned empty object." };
|
94
|
+
if (resData.error) throw resData;
|
108
95
|
callback(null);
|
109
96
|
})
|
110
|
-
.catch(function(err) {
|
97
|
+
.catch(function (err) {
|
111
98
|
log.error("setReaction", err);
|
112
99
|
return callback(err);
|
113
100
|
});
|
114
|
-
|
115
101
|
return returnPromise;
|
116
102
|
};
|
117
103
|
};
|
@@ -3,21 +3,19 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
-
return function
|
8
|
-
var resolveFunc = function(){};
|
9
|
-
var rejectFunc = function(){};
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function setPostReaction(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
|
-
|
19
|
-
}
|
20
|
-
resolveFunc(friendList);
|
16
|
+
callback = function (err, data) {
|
17
|
+
if (err) return rejectFunc(err);
|
18
|
+
resolveFunc(data);
|
21
19
|
};
|
22
20
|
}
|
23
21
|
|
@@ -31,9 +29,7 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
31
29
|
};
|
32
30
|
if (typeof type != "number") {
|
33
31
|
type = map[type.toLocaleLowerCase()];
|
34
|
-
if (!type)
|
35
|
-
type = 1;
|
36
|
-
}
|
32
|
+
if (!type) type = 1;
|
37
33
|
}
|
38
34
|
var form = {
|
39
35
|
av: ctx.userID,
|
@@ -45,32 +41,23 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
45
41
|
input: {
|
46
42
|
client_mutation_id: "7",
|
47
43
|
actor_id: ctx.userID,
|
48
|
-
feedback_reaction: type
|
49
|
-
|
44
|
+
feedback_reaction: type
|
50
45
|
},
|
51
46
|
useDefaultActor: true
|
52
47
|
})
|
53
48
|
};
|
54
49
|
|
55
50
|
defaultFuncs
|
56
|
-
.post(
|
57
|
-
"https://www.facebook.com/api/graphql/",
|
58
|
-
ctx.jar,
|
59
|
-
form
|
60
|
-
)
|
51
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
61
52
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
62
|
-
.then(function(resData) {
|
63
|
-
if (resData.error)
|
64
|
-
throw resData;
|
65
|
-
}
|
66
|
-
|
53
|
+
.then(function (resData) {
|
54
|
+
if (resData.error) throw resData;
|
67
55
|
return callback();
|
68
56
|
})
|
69
|
-
.catch(function(err) {
|
57
|
+
.catch(function (err) {
|
70
58
|
log.error("setPostReaction", err);
|
71
59
|
return callback(err);
|
72
60
|
});
|
73
|
-
|
74
61
|
return returnPromise;
|
75
62
|
};
|
76
63
|
};
|
package/leiamnash/setTitle.js
CHANGED
@@ -3,29 +3,23 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function setTitle(newTitle, threadID, callback) {
|
8
|
-
if (
|
9
|
-
!callback &&
|
10
|
-
(utils.getType(threadID) === "Function" ||
|
11
|
-
utils.getType(threadID) === "AsyncFunction")
|
12
|
-
) {
|
8
|
+
if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction"))
|
13
9
|
throw { error: "please pass a threadID as a second argument." };
|
14
|
-
}
|
15
10
|
|
16
|
-
|
17
|
-
var
|
11
|
+
|
12
|
+
var resolveFunc = function () { };
|
13
|
+
var rejectFunc = function () { };
|
18
14
|
var returnPromise = new Promise(function (resolve, reject) {
|
19
15
|
resolveFunc = resolve;
|
20
16
|
rejectFunc = reject;
|
21
17
|
});
|
22
18
|
|
23
19
|
if (!callback) {
|
24
|
-
callback = function (err,
|
25
|
-
if (err)
|
26
|
-
|
27
|
-
}
|
28
|
-
resolveFunc(friendList);
|
20
|
+
callback = function (err, data) {
|
21
|
+
if (err) return rejectFunc(err);
|
22
|
+
resolveFunc(data);
|
29
23
|
};
|
30
24
|
}
|
31
25
|
|
@@ -61,26 +55,16 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
61
55
|
defaultFuncs
|
62
56
|
.post("https://www.facebook.com/messaging/set_thread_name/", ctx.jar, form)
|
63
57
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
64
|
-
.then(function(resData) {
|
65
|
-
if (resData.error && resData.error === 1545012) {
|
66
|
-
|
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
|
-
|
58
|
+
.then(function (resData) {
|
59
|
+
if (resData.error && resData.error === 1545012) throw { error: "Cannot change chat title: Not member of chat." };
|
60
|
+
if (resData.error && resData.error === 1545003) throw { error: "Cannot set title of single-user chat." };
|
61
|
+
if (resData.error) throw resData;
|
77
62
|
return callback();
|
78
63
|
})
|
79
|
-
.catch(function(err) {
|
64
|
+
.catch(function (err) {
|
80
65
|
log.error("setTitle", err);
|
81
66
|
return callback(err);
|
82
67
|
});
|
83
|
-
|
84
68
|
return returnPromise;
|
85
69
|
};
|
86
70
|
};
|
@@ -1,57 +1,41 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
module.exports = function(_defaultFuncs, _api, _ctx) {
|
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
|
-
|
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
|
-
|
6
|
+
|
23
7
|
//#region This part is for backward compatibly
|
24
8
|
//trying to match the color one-by-one. kill me plz
|
25
|
-
MessengerBlue:
|
26
|
-
Viking:
|
27
|
-
GoldenPoppy:
|
28
|
-
RadicalRed:
|
29
|
-
Shocking:
|
9
|
+
MessengerBlue: "196241301102133", //DefaultBlue
|
10
|
+
Viking: "1928399724138152", //TealBlue
|
11
|
+
GoldenPoppy: "174636906462322", //Yellow
|
12
|
+
RadicalRed: "2129984390566328", //Red
|
13
|
+
Shocking: "2058653964378557", //LavenderPurple
|
30
14
|
FreeSpeechGreen: "2136751179887052", //Green
|
31
|
-
Pumpkin:
|
32
|
-
LightCoral:
|
15
|
+
Pumpkin: "175615189761153", //Orange
|
16
|
+
LightCoral: "980963458735625", //CoralPink
|
33
17
|
MediumSlateBlue: "234137870477637", //BrightPurple
|
34
|
-
DeepSkyBlue:
|
35
|
-
BrilliantRose:
|
18
|
+
DeepSkyBlue: "2442142322678320", //AquaBlue
|
19
|
+
BrilliantRose: "169463077092846", //HotPink
|
36
20
|
//i've tried my best, everything else can't be mapped. (or is it?) -UIRI 2020
|
37
21
|
//#endregion
|
38
22
|
|
39
|
-
DefaultBlue:
|
40
|
-
HotPink:
|
41
|
-
AquaBlue:
|
42
|
-
BrightPurple:
|
43
|
-
CoralPink:
|
44
|
-
Orange:
|
45
|
-
Green:
|
46
|
-
LavenderPurple:
|
47
|
-
Red:
|
48
|
-
Yellow:
|
49
|
-
TealBlue:
|
50
|
-
Aqua:
|
51
|
-
Mango:
|
52
|
-
Berry:
|
53
|
-
Citrus:
|
54
|
-
Candy:
|
55
|
-
//StarWars:
|
23
|
+
DefaultBlue: "196241301102133",
|
24
|
+
HotPink: "169463077092846",
|
25
|
+
AquaBlue: "2442142322678320",
|
26
|
+
BrightPurple: "234137870477637",
|
27
|
+
CoralPink: "980963458735625",
|
28
|
+
Orange: "175615189761153",
|
29
|
+
Green: "2136751179887052",
|
30
|
+
LavenderPurple: "2058653964378557",
|
31
|
+
Red: "2129984390566328",
|
32
|
+
Yellow: "174636906462322",
|
33
|
+
TealBlue: "1928399724138152",
|
34
|
+
Aqua: "417639218648241",
|
35
|
+
Mango: "930060997172551",
|
36
|
+
Berry: "164535220883264",
|
37
|
+
Citrus: "370940413392601",
|
38
|
+
Candy: "205488546921017",
|
39
|
+
//StarWars: "809305022860427" Removed.
|
56
40
|
};
|
57
41
|
};
|
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(defaultFuncs, api, ctx) {
|
7
|
-
return function
|
8
|
-
var resolveFunc = function(){};
|
9
|
-
var rejectFunc = function(){};
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function unfriend(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,9 +14,7 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
14
14
|
|
15
15
|
if (!callback) {
|
16
16
|
callback = function (err, friendList) {
|
17
|
-
if (err)
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
17
|
+
if (err) return rejectFunc(err);
|
20
18
|
resolveFunc(friendList);
|
21
19
|
};
|
22
20
|
}
|
@@ -29,24 +27,16 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
29
27
|
};
|
30
28
|
|
31
29
|
defaultFuncs
|
32
|
-
.post(
|
33
|
-
"https://www.facebook.com/ajax/profile/removefriendconfirm.php",
|
34
|
-
ctx.jar,
|
35
|
-
form
|
36
|
-
)
|
30
|
+
.post("https://www.facebook.com/ajax/profile/removefriendconfirm.php", ctx.jar, form)
|
37
31
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
38
|
-
.then(function(resData) {
|
39
|
-
if (resData.error)
|
40
|
-
throw resData;
|
41
|
-
}
|
42
|
-
|
32
|
+
.then(function (resData) {
|
33
|
+
if (resData.error) throw resData;
|
43
34
|
return callback();
|
44
35
|
})
|
45
|
-
.catch(function(err) {
|
36
|
+
.catch(function (err) {
|
46
37
|
log.error("unfriend", err);
|
47
38
|
return callback(err);
|
48
39
|
});
|
49
|
-
|
50
40
|
return returnPromise;
|
51
41
|
};
|
52
42
|
};
|
@@ -3,10 +3,10 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function unsendMessage(messageID, 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;
|
@@ -14,9 +14,7 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
14
14
|
|
15
15
|
if (!callback) {
|
16
16
|
callback = function (err, friendList) {
|
17
|
-
if (err)
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
17
|
+
if (err) return rejectFunc(err);
|
20
18
|
resolveFunc(friendList);
|
21
19
|
};
|
22
20
|
}
|
@@ -26,24 +24,16 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
26
24
|
};
|
27
25
|
|
28
26
|
defaultFuncs
|
29
|
-
.post(
|
30
|
-
"https://www.facebook.com/messaging/unsend_message/",
|
31
|
-
ctx.jar,
|
32
|
-
form
|
33
|
-
)
|
27
|
+
.post("https://www.facebook.com/messaging/unsend_message/", ctx.jar, form)
|
34
28
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
35
|
-
.then(function(resData) {
|
36
|
-
if (resData.error)
|
37
|
-
throw resData;
|
38
|
-
}
|
39
|
-
|
29
|
+
.then(function (resData) {
|
30
|
+
if (resData.error) throw resData;
|
40
31
|
return callback();
|
41
32
|
})
|
42
|
-
.catch(function(err) {
|
43
|
-
log.error("unsendMessage",
|
33
|
+
.catch(function (err) {
|
34
|
+
log.error("unsendMessage", "» ParseAndCheckLogin got status code: 404. Bailing out of trying to parse response.");
|
44
35
|
return callback(err);
|
45
36
|
});
|
46
|
-
|
47
37
|
return returnPromise;
|
48
38
|
};
|
49
39
|
};
|
package/package.json
CHANGED
package/replit.nix
CHANGED
package/utils.js
CHANGED
File without changes
|