alicezetion 1.0.2 → 1.0.4
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 +488 -560
- package/package.json +25 -25
- package/replit.nix +5 -0
- package/src/addExternalModule.js +15 -0
- package/{alice → src}/addUserToGroup.js +16 -52
- package/src/changeAdminStatus.js +47 -0
- package/src/changeArchivedStatus.js +41 -0
- package/{alice → src}/changeBio.js +6 -19
- package/{alice → src}/changeBlockedStatus.js +3 -14
- package/{alice → src}/changeGroupImage.js +16 -40
- package/src/changeNickname.js +43 -0
- package/{alice → src}/changeThreadColor.js +10 -20
- package/src/changeThreadEmoji.js +41 -0
- package/src/chat.js +315 -0
- package/{alice → src}/createNewGroup.js +12 -28
- package/{alice → src}/createPoll.js +13 -25
- package/src/deleteMessage.js +44 -0
- package/src/deleteThread.js +42 -0
- package/src/forwardAttachment.js +47 -0
- package/src/forwardMessage.js +0 -0
- package/{alice → src}/getCurrentUserID.js +1 -1
- package/{alice → src}/getEmojiUrl.js +2 -4
- package/{alice → src}/getFriendsList.js +10 -21
- package/{alice → src}/getThreadHistory.js +58 -166
- package/{alice → src}/getThreadHistoryDeprecated.js +20 -42
- package/{alice → src}/getThreadInfo.js +25 -60
- package/src/getThreadInfoDeprecated.js +56 -0
- package/{alice → src}/getThreadList.js +41 -66
- package/src/getThreadListDeprecated.js +46 -0
- package/src/getThreadPictures.js +59 -0
- package/{alice → src}/getUserID.js +9 -14
- package/{alice → src}/getUserInfo.js +13 -19
- package/src/handleFriendRequest.js +46 -0
- package/src/handleMessageRequest.js +47 -0
- package/{alice → src}/httpGet.js +12 -17
- package/{alice → src}/httpPost.js +12 -17
- package/src/listen.js +553 -0
- package/src/listenMqtt-Test.js +687 -0
- package/src/listenMqtt.js +677 -0
- package/{alice → src}/logout.js +13 -20
- package/{alice → src}/markAsDelivered.js +11 -22
- package/{alice → src}/markAsRead.js +11 -21
- package/{alice → src}/markAsReadAll.js +10 -20
- package/{alice → src}/markAsSeen.js +7 -18
- package/{alice → src}/muteThread.js +11 -18
- package/src/removeUserFromGroup.js +45 -0
- package/{alice → src}/resolvePhotoUrl.js +8 -17
- package/{alice → src}/searchForThread.js +10 -21
- package/{alice → src}/sendTypingIndicator.js +14 -47
- package/{alice → src}/setMessageReaction.js +12 -26
- package/{alice → src}/setPostReaction.js +13 -26
- package/{alice → src}/setTitle.js +13 -29
- package/src/threadColors.js +41 -0
- package/{alice → src}/unfriend.js +9 -19
- package/{alice → src}/unsendMessage.js +9 -19
- package/utils.js +1021 -1190
- package/alice/addExternalModule.js +0 -19
- package/alice/changeAdminStatus.js +0 -79
- package/alice/changeArchivedStatus.js +0 -55
- package/alice/changeNickname.js +0 -59
- package/alice/changeThreadEmoji.js +0 -55
- package/alice/deleteMessage.js +0 -56
- package/alice/deleteThread.js +0 -56
- package/alice/forwardAttachment.js +0 -60
- package/alice/getThreadInfoDeprecated.js +0 -80
- package/alice/getThreadListDeprecated.js +0 -75
- package/alice/getThreadPictures.js +0 -79
- package/alice/handleFriendRequest.js +0 -61
- package/alice/handleMessageRequest.js +0 -65
- package/alice/listenMqtt.js +0 -789
- package/alice/removeUserFromGroup.js +0 -79
- package/alice/sendMessage.js +0 -459
- package/alice/threadColors.js +0 -57
@@ -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
|
};
|
@@ -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
|
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
module.exports = function (_defaultFuncs, _api, _ctx) {
|
4
|
+
// Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more
|
5
|
+
return {
|
6
|
+
|
7
|
+
//#region This part is for backward compatibly
|
8
|
+
//trying to match the color one-by-one. kill me plz
|
9
|
+
MessengerBlue: "196241301102133", //DefaultBlue
|
10
|
+
Viking: "1928399724138152", //TealBlue
|
11
|
+
GoldenPoppy: "174636906462322", //Yellow
|
12
|
+
RadicalRed: "2129984390566328", //Red
|
13
|
+
Shocking: "2058653964378557", //LavenderPurple
|
14
|
+
FreeSpeechGreen: "2136751179887052", //Green
|
15
|
+
Pumpkin: "175615189761153", //Orange
|
16
|
+
LightCoral: "980963458735625", //CoralPink
|
17
|
+
MediumSlateBlue: "234137870477637", //BrightPurple
|
18
|
+
DeepSkyBlue: "2442142322678320", //AquaBlue
|
19
|
+
BrilliantRose: "169463077092846", //HotPink
|
20
|
+
//i've tried my best, everything else can't be mapped. (or is it?) -UIRI 2020
|
21
|
+
//#endregion
|
22
|
+
|
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.
|
40
|
+
};
|
41
|
+
};
|
@@ -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
|
};
|