alicezetion 1.0.0 → 1.0.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/alice/addExternalModule.js +19 -0
- package/alice/{add.js → addUserToGroup.js} +16 -2
- package/alice/{admin.js → changeAdminStatus.js} +17 -3
- package/alice/{archive.js → changeArchivedStatus.js} +16 -2
- package/alice/changeBio.js +77 -0
- package/alice/changeBlockedStatus.js +47 -0
- package/alice/{gcimage.js → changeGroupImage.js} +16 -2
- package/alice/{nickname.js → changeNickname.js} +17 -2
- package/alice/changeThreadColor.js +71 -0
- package/alice/{emoji.js → changeThreadEmoji.js} +16 -2
- package/alice/createNewGroup.js +86 -0
- package/alice/{poll.js → createPoll.js} +18 -2
- package/alice/{deletemsg.js → deleteMessage.js} +15 -2
- package/alice/{deletegc.js → deleteThread.js} +15 -2
- package/alice/{forward.js → forwardAttachment.js} +16 -3
- package/alice/{id.js → getCurrentUserID.js} +1 -1
- package/alice/{friend.js → getFriendsList.js} +17 -3
- package/alice/{history.js → getThreadHistory.js} +19 -6
- package/alice/{gchistorydeprecated.js → getThreadHistoryDeprecated.js} +18 -1
- package/alice/{gcinfo.js → getThreadInfo.js} +49 -13
- package/alice/{gcinfodeprecated.js → getThreadInfoDeprecated.js} +17 -2
- package/alice/{gclist.js → getThreadList.js} +27 -9
- package/alice/{gclistdeprecated.js → getThreadListDeprecated.js} +1 -1
- package/alice/{gcimg.js → getThreadPictures.js} +15 -2
- package/alice/{userid.js → getUserID.js} +16 -2
- package/alice/{userinfo.js → getUserInfo.js} +18 -3
- package/alice/handleFriendRequest.js +61 -0
- package/alice/{msgrequest.js → handleMessageRequest.js} +16 -2
- package/alice/httpGet.js +52 -0
- package/alice/httpPost.js +52 -0
- package/alice/listenMqtt.js +363 -134
- package/alice/logout.js +18 -2
- package/alice/{delivered.js → markAsDelivered.js} +19 -2
- package/alice/markAsRead.js +80 -0
- package/alice/{seen.js → markAsReadAll.js} +16 -2
- package/alice/markAsSeen.js +59 -0
- package/alice/{mute.js → muteThread.js} +16 -2
- package/alice/{kick.js → removeUserFromGroup.js} +16 -2
- package/alice/{resolveimgurl.js → resolvePhotoUrl.js} +16 -2
- package/alice/{gcsearch.js → searchForThread.js} +16 -2
- package/alice/{chat.js → sendMessage.js} +78 -34
- package/alice/sendTypingIndicator.js +103 -0
- package/alice/{react.js → setMessageReaction.js} +39 -4
- package/alice/setPostReaction.js +76 -0
- package/alice/{title.js → setTitle.js} +16 -3
- package/alice/threadColors.js +57 -0
- package/alice/unfriend.js +52 -0
- package/alice/{unsend.js → unsendMessage.js} +16 -2
- package/index.js +324 -143
- package/package.json +27 -18
- package/utils.js +137 -61
- package/.cache/replit/modules.stamp +0 -0
- package/README.md +0 -40
- package/alice/block.js +0 -72
- package/alice/color.js +0 -53
- package/alice/gcolor.js +0 -22
- package/alice/listen.js +0 -553
- package/alice/read.js +0 -52
- package/alice/typeindicator.js +0 -77
- /package/alice/{emojiurl.js → getEmojiUrl.js} +0 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var utils = require("../utils");
|
4
|
+
var log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
function makeTypingIndicator(typ, threadID, callback, isGroup) {
|
8
|
+
var form = {
|
9
|
+
typ: +typ,
|
10
|
+
to: "",
|
11
|
+
source: "mercury-chat",
|
12
|
+
thread: threadID
|
13
|
+
};
|
14
|
+
|
15
|
+
// Check if thread is a single person chat or a group chat
|
16
|
+
// More info on this is in api.sendMessage
|
17
|
+
if (utils.getType(isGroup) == "Boolean") {
|
18
|
+
if (!isGroup) {
|
19
|
+
form.to = threadID;
|
20
|
+
}
|
21
|
+
defaultFuncs
|
22
|
+
.post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
|
23
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
24
|
+
.then(function (resData) {
|
25
|
+
if (resData.error) {
|
26
|
+
throw resData;
|
27
|
+
}
|
28
|
+
|
29
|
+
return callback();
|
30
|
+
})
|
31
|
+
.catch(function (err) {
|
32
|
+
log.error("sendTypingIndicator", err);
|
33
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in") {
|
34
|
+
ctx.loggedIn = false;
|
35
|
+
}
|
36
|
+
return callback(err);
|
37
|
+
});
|
38
|
+
} else {
|
39
|
+
api.getUserInfo(threadID, function (err, res) {
|
40
|
+
if (err) {
|
41
|
+
return callback(err);
|
42
|
+
}
|
43
|
+
|
44
|
+
// If id is single person chat
|
45
|
+
if (Object.keys(res).length > 0) {
|
46
|
+
form.to = threadID;
|
47
|
+
}
|
48
|
+
|
49
|
+
defaultFuncs
|
50
|
+
.post("https://www.facebook.com/ajax/messaging/typ.php", ctx.jar, form)
|
51
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
52
|
+
.then(function (resData) {
|
53
|
+
if (resData.error) {
|
54
|
+
throw resData;
|
55
|
+
}
|
56
|
+
|
57
|
+
return callback();
|
58
|
+
})
|
59
|
+
.catch(function (err) {
|
60
|
+
log.error("sendTypingIndicator", err);
|
61
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
|
62
|
+
ctx.loggedIn = false;
|
63
|
+
}
|
64
|
+
return callback(err);
|
65
|
+
});
|
66
|
+
});
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
return function sendTypingIndicator(threadID, callback, isGroup) {
|
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
|
+
}
|
81
|
+
callback = () => { };
|
82
|
+
}
|
83
|
+
|
84
|
+
makeTypingIndicator(true, threadID, callback, isGroup);
|
85
|
+
|
86
|
+
return function end(cb) {
|
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
|
+
}
|
97
|
+
cb = () => { };
|
98
|
+
}
|
99
|
+
|
100
|
+
makeTypingIndicator(false, threadID, cb, isGroup);
|
101
|
+
};
|
102
|
+
};
|
103
|
+
};
|
@@ -3,13 +3,37 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs,
|
7
|
-
return function setMessageReaction(reaction, messageID, callback) {
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
+
return function setMessageReaction(reaction, messageID, callback, forceCustomReaction) {
|
8
|
+
var resolveFunc = function(){};
|
9
|
+
var rejectFunc = function(){};
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
8
15
|
if (!callback) {
|
9
|
-
callback = function() {
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
21
|
+
};
|
10
22
|
}
|
11
23
|
|
12
24
|
switch (reaction) {
|
25
|
+
case "\uD83D\uDE0D": //:heart_eyes:
|
26
|
+
case "\uD83D\uDE06": //:laughing:
|
27
|
+
case "\uD83D\uDE2E": //:open_mouth:
|
28
|
+
case "\uD83D\uDE22": //:cry:
|
29
|
+
case "\uD83D\uDE20": //:angry:
|
30
|
+
case "\uD83D\uDC4D": //:thumbsup:
|
31
|
+
case "\uD83D\uDC4E": //:thumbsdown:
|
32
|
+
case "\u2764": //:heart:
|
33
|
+
case "\uD83D\uDC97": //:glowingheart:
|
34
|
+
case "":
|
35
|
+
//valid
|
36
|
+
break;
|
13
37
|
case ":heart_eyes:":
|
14
38
|
case ":love:":
|
15
39
|
reaction = "\uD83D\uDE0D";
|
@@ -37,8 +61,17 @@ module.exports = function(defaultFuncs, bot, ctx) {
|
|
37
61
|
case ":dislike:":
|
38
62
|
reaction = "\uD83D\uDC4E";
|
39
63
|
break;
|
40
|
-
|
64
|
+
case ":heart:":
|
65
|
+
reaction = "\u2764";
|
41
66
|
break;
|
67
|
+
case ":glowingheart:":
|
68
|
+
reaction = "\uD83D\uDC97";
|
69
|
+
break;
|
70
|
+
default:
|
71
|
+
if (forceCustomReaction) {
|
72
|
+
break;
|
73
|
+
}
|
74
|
+
return callback({ error: "Reaction is not a valid emoji." });
|
42
75
|
}
|
43
76
|
|
44
77
|
var variables = {
|
@@ -78,5 +111,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
|
|
78
111
|
log.error("setReaction", err);
|
79
112
|
return callback(err);
|
80
113
|
});
|
114
|
+
|
115
|
+
return returnPromise;
|
81
116
|
};
|
82
117
|
};
|
@@ -0,0 +1,76 @@
|
|
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 unsendMessage(postID, type, 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, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
var map = {
|
25
|
+
like: 1,
|
26
|
+
heart: 2,
|
27
|
+
wow: 3,
|
28
|
+
haha: 4,
|
29
|
+
sad: 7,
|
30
|
+
angry: 8
|
31
|
+
};
|
32
|
+
if (typeof type != "number") {
|
33
|
+
type = map[type.toLocaleLowerCase()];
|
34
|
+
if (!type) {
|
35
|
+
type = 1;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
var form = {
|
39
|
+
av: ctx.userID,
|
40
|
+
fb_api_caller_class: "RelayModern",
|
41
|
+
fb_api_req_friendly_name: "UFI2FeedbackReactMutation",
|
42
|
+
//This doc_id is valid as of January 17th, 2020
|
43
|
+
doc_id: "2580813318646067",
|
44
|
+
variables: JSON.stringify({
|
45
|
+
input: {
|
46
|
+
client_mutation_id: "7",
|
47
|
+
actor_id: ctx.userID,
|
48
|
+
feedback_reaction: type,
|
49
|
+
|
50
|
+
},
|
51
|
+
useDefaultActor: true
|
52
|
+
})
|
53
|
+
};
|
54
|
+
|
55
|
+
defaultFuncs
|
56
|
+
.post(
|
57
|
+
"https://www.facebook.com/api/graphql/",
|
58
|
+
ctx.jar,
|
59
|
+
form
|
60
|
+
)
|
61
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
62
|
+
.then(function(resData) {
|
63
|
+
if (resData.error) {
|
64
|
+
throw resData;
|
65
|
+
}
|
66
|
+
|
67
|
+
return callback();
|
68
|
+
})
|
69
|
+
.catch(function(err) {
|
70
|
+
log.error("setPostReaction", err);
|
71
|
+
return callback(err);
|
72
|
+
});
|
73
|
+
|
74
|
+
return returnPromise;
|
75
|
+
};
|
76
|
+
};
|
@@ -3,7 +3,7 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs,
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
7
|
return function setTitle(newTitle, threadID, callback) {
|
8
8
|
if (
|
9
9
|
!callback &&
|
@@ -13,8 +13,20 @@ module.exports = function(defaultFuncs, bot, ctx) {
|
|
13
13
|
throw { error: "please pass a threadID as a second argument." };
|
14
14
|
}
|
15
15
|
|
16
|
+
var resolveFunc = function(){};
|
17
|
+
var rejectFunc = function(){};
|
18
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
19
|
+
resolveFunc = resolve;
|
20
|
+
rejectFunc = reject;
|
21
|
+
});
|
22
|
+
|
16
23
|
if (!callback) {
|
17
|
-
callback = function() {
|
24
|
+
callback = function (err, friendList) {
|
25
|
+
if (err) {
|
26
|
+
return rejectFunc(err);
|
27
|
+
}
|
28
|
+
resolveFunc(friendList);
|
29
|
+
};
|
18
30
|
}
|
19
31
|
|
20
32
|
var messageAndOTID = utils.generateOfflineThreadingID();
|
@@ -22,7 +34,6 @@ module.exports = function(defaultFuncs, bot, ctx) {
|
|
22
34
|
client: "mercury",
|
23
35
|
action_type: "ma-type:log-message",
|
24
36
|
author: "fbid:" + ctx.userID,
|
25
|
-
thread_id: "",
|
26
37
|
author_email: "",
|
27
38
|
coordinates: "",
|
28
39
|
timestamp: Date.now(),
|
@@ -69,5 +80,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
|
|
69
80
|
log.error("setTitle", err);
|
70
81
|
return callback(err);
|
71
82
|
});
|
83
|
+
|
84
|
+
return returnPromise;
|
72
85
|
};
|
73
86
|
};
|
@@ -0,0 +1,57 @@
|
|
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
|
+
//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
|
+
|
23
|
+
//#region This part is for backward compatibly
|
24
|
+
//trying to match the color one-by-one. kill me plz
|
25
|
+
MessengerBlue: "196241301102133", //DefaultBlue
|
26
|
+
Viking: "1928399724138152", //TealBlue
|
27
|
+
GoldenPoppy: "174636906462322", //Yellow
|
28
|
+
RadicalRed: "2129984390566328", //Red
|
29
|
+
Shocking: "2058653964378557", //LavenderPurple
|
30
|
+
FreeSpeechGreen: "2136751179887052", //Green
|
31
|
+
Pumpkin: "175615189761153", //Orange
|
32
|
+
LightCoral: "980963458735625", //CoralPink
|
33
|
+
MediumSlateBlue: "234137870477637", //BrightPurple
|
34
|
+
DeepSkyBlue: "2442142322678320", //AquaBlue
|
35
|
+
BrilliantRose: "169463077092846", //HotPink
|
36
|
+
//i've tried my best, everything else can't be mapped. (or is it?) -UIRI 2020
|
37
|
+
//#endregion
|
38
|
+
|
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.
|
56
|
+
};
|
57
|
+
};
|
@@ -0,0 +1,52 @@
|
|
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 unsendMessage(userID, 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, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
var form = {
|
25
|
+
uid: userID,
|
26
|
+
unref: "bd_friends_tab",
|
27
|
+
floc: "friends_tab",
|
28
|
+
"nctr[_mod]": "pagelet_timeline_app_collection_" + ctx.userID + ":2356318349:2"
|
29
|
+
};
|
30
|
+
|
31
|
+
defaultFuncs
|
32
|
+
.post(
|
33
|
+
"https://www.facebook.com/ajax/profile/removefriendconfirm.php",
|
34
|
+
ctx.jar,
|
35
|
+
form
|
36
|
+
)
|
37
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
38
|
+
.then(function(resData) {
|
39
|
+
if (resData.error) {
|
40
|
+
throw resData;
|
41
|
+
}
|
42
|
+
|
43
|
+
return callback();
|
44
|
+
})
|
45
|
+
.catch(function(err) {
|
46
|
+
log.error("unfriend", err);
|
47
|
+
return callback(err);
|
48
|
+
});
|
49
|
+
|
50
|
+
return returnPromise;
|
51
|
+
};
|
52
|
+
};
|
@@ -3,10 +3,22 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs,
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
7
|
return function unsendMessage(messageID, 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
|
+
|
8
15
|
if (!callback) {
|
9
|
-
callback = function() {
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
21
|
+
};
|
10
22
|
}
|
11
23
|
|
12
24
|
var form = {
|
@@ -31,5 +43,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
|
|
31
43
|
log.error("unsendMessage", err);
|
32
44
|
return callback(err);
|
33
45
|
});
|
46
|
+
|
47
|
+
return returnPromise;
|
34
48
|
};
|
35
49
|
};
|