alicezetion 1.0.3 → 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/.travis.yml +6 -0
- package/index.js +532 -604
- package/package.json +78 -75
- package/replit.nix +5 -0
- package/src/addExternalModule.js +15 -0
- package/{alice → src}/addUserToGroup.js +77 -113
- package/src/changeAdminStatus.js +47 -0
- package/src/changeArchivedStatus.js +41 -0
- package/{alice → src}/changeBio.js +64 -77
- package/{alice → src}/changeBlockedStatus.js +36 -47
- package/{alice → src}/changeGroupImage.js +105 -129
- package/src/changeNickname.js +43 -0
- package/{alice → src}/changeThreadColor.js +61 -71
- package/src/changeThreadEmoji.js +41 -0
- package/src/chat.js +315 -0
- package/{alice → src}/createNewGroup.js +70 -86
- package/{alice → src}/createPoll.js +59 -71
- 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 +7 -7
- package/{alice → src}/getEmojiUrl.js +27 -29
- package/{alice → src}/getFriendsList.js +73 -84
- package/{alice → src}/getThreadHistory.js +537 -645
- package/src/getThreadHistoryDeprecated.js +71 -0
- package/{alice → src}/getThreadInfo.js +171 -206
- package/src/getThreadInfoDeprecated.js +56 -0
- package/{alice → src}/getThreadList.js +213 -238
- package/src/getThreadListDeprecated.js +46 -0
- package/src/getThreadPictures.js +59 -0
- package/{alice → src}/getUserID.js +61 -66
- package/{alice → src}/getUserInfo.js +66 -72
- package/src/handleFriendRequest.js +46 -0
- package/src/handleMessageRequest.js +47 -0
- package/{alice → src}/httpGet.js +47 -52
- package/{alice → src}/httpPost.js +47 -52
- package/src/listen.js +553 -0
- package/src/listenMqtt-Test.js +687 -0
- package/src/listenMqtt.js +677 -0
- package/{alice → src}/logout.js +68 -75
- package/{alice → src}/markAsDelivered.js +47 -58
- package/{alice → src}/markAsRead.js +70 -80
- package/{alice/seen.js → src/markAsReadAll.js} +39 -49
- package/{alice → src}/markAsSeen.js +48 -59
- package/{alice → src}/muteThread.js +45 -52
- package/src/removeUserFromGroup.js +45 -0
- package/{alice → src}/resolvePhotoUrl.js +36 -45
- package/src/searchForThread.js +42 -0
- package/{alice → src}/sendTypingIndicator.js +70 -103
- package/{alice/react.js → src/setMessageReaction.js} +103 -117
- package/{alice → src}/setPostReaction.js +63 -76
- package/{alice → src}/setTitle.js +70 -86
- package/src/threadColors.js +41 -0
- package/{alice → src}/unfriend.js +42 -52
- package/{alice → src}/unsendMessage.js +39 -49
- package/utils.js +1190 -1357
- 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/chat.js +0 -459
- package/alice/deleteMessage.js +0 -56
- package/alice/deleteThread.js +0 -56
- package/alice/forwardAttachment.js +0 -60
- package/alice/getThreadHistoryDeprecated.js +0 -93
- 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/searchForThread.js +0 -53
- package/alice/threadColors.js +0 -57
- package/test/data/shareAttach.js +0 -146
- package/test/data/something.mov +0 -0
- package/test/data/test.png +0 -0
- package/test/data/test.txt +0 -7
- package/test/example-config.json +0 -18
- package/test/test-page.js +0 -140
- package/test/test.js +0 -385
@@ -1,76 +1,63 @@
|
|
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
|
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,
|
17
|
-
if (err)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
)
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
-
};
|
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 setPostReaction(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, data) {
|
17
|
+
if (err) return rejectFunc(err);
|
18
|
+
resolveFunc(data);
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
|
+
var map = {
|
23
|
+
like: 1,
|
24
|
+
heart: 2,
|
25
|
+
wow: 3,
|
26
|
+
haha: 4,
|
27
|
+
sad: 7,
|
28
|
+
angry: 8
|
29
|
+
};
|
30
|
+
if (typeof type != "number") {
|
31
|
+
type = map[type.toLocaleLowerCase()];
|
32
|
+
if (!type) type = 1;
|
33
|
+
}
|
34
|
+
var form = {
|
35
|
+
av: ctx.userID,
|
36
|
+
fb_api_caller_class: "RelayModern",
|
37
|
+
fb_api_req_friendly_name: "UFI2FeedbackReactMutation",
|
38
|
+
//This doc_id is valid as of January 17th, 2020
|
39
|
+
doc_id: "2580813318646067",
|
40
|
+
variables: JSON.stringify({
|
41
|
+
input: {
|
42
|
+
client_mutation_id: "7",
|
43
|
+
actor_id: ctx.userID,
|
44
|
+
feedback_reaction: type
|
45
|
+
},
|
46
|
+
useDefaultActor: true
|
47
|
+
})
|
48
|
+
};
|
49
|
+
|
50
|
+
defaultFuncs
|
51
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
52
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
53
|
+
.then(function (resData) {
|
54
|
+
if (resData.error) throw resData;
|
55
|
+
return callback();
|
56
|
+
})
|
57
|
+
.catch(function (err) {
|
58
|
+
log.error("setPostReaction", err);
|
59
|
+
return callback(err);
|
60
|
+
});
|
61
|
+
return returnPromise;
|
62
|
+
};
|
63
|
+
};
|
@@ -1,86 +1,70 @@
|
|
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 setTitle(newTitle, threadID, callback) {
|
8
|
-
if (
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
) {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
}
|
72
|
-
|
73
|
-
if (resData.error) {
|
74
|
-
throw resData;
|
75
|
-
}
|
76
|
-
|
77
|
-
return callback();
|
78
|
-
})
|
79
|
-
.catch(function(err) {
|
80
|
-
log.error("setTitle", err);
|
81
|
-
return callback(err);
|
82
|
-
});
|
83
|
-
|
84
|
-
return returnPromise;
|
85
|
-
};
|
86
|
-
};
|
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 setTitle(newTitle, threadID, callback) {
|
8
|
+
if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction"))
|
9
|
+
throw { error: "please pass a threadID as a second argument." };
|
10
|
+
|
11
|
+
|
12
|
+
var resolveFunc = function () { };
|
13
|
+
var rejectFunc = function () { };
|
14
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
15
|
+
resolveFunc = resolve;
|
16
|
+
rejectFunc = reject;
|
17
|
+
});
|
18
|
+
|
19
|
+
if (!callback) {
|
20
|
+
callback = function (err, data) {
|
21
|
+
if (err) return rejectFunc(err);
|
22
|
+
resolveFunc(data);
|
23
|
+
};
|
24
|
+
}
|
25
|
+
|
26
|
+
var messageAndOTID = utils.generateOfflineThreadingID();
|
27
|
+
var form = {
|
28
|
+
client: "mercury",
|
29
|
+
action_type: "ma-type:log-message",
|
30
|
+
author: "fbid:" + ctx.userID,
|
31
|
+
author_email: "",
|
32
|
+
coordinates: "",
|
33
|
+
timestamp: Date.now(),
|
34
|
+
timestamp_absolute: "Today",
|
35
|
+
timestamp_relative: utils.generateTimestampRelative(),
|
36
|
+
timestamp_time_passed: "0",
|
37
|
+
is_unread: false,
|
38
|
+
is_cleared: false,
|
39
|
+
is_forward: false,
|
40
|
+
is_filtered_content: false,
|
41
|
+
is_spoof_warning: false,
|
42
|
+
source: "source:chat:web",
|
43
|
+
"source_tags[0]": "source:chat",
|
44
|
+
status: "0",
|
45
|
+
offline_threading_id: messageAndOTID,
|
46
|
+
message_id: messageAndOTID,
|
47
|
+
threading_id: utils.generateThreadingID(ctx.clientID),
|
48
|
+
manual_retry_cnt: "0",
|
49
|
+
thread_fbid: threadID,
|
50
|
+
thread_name: newTitle,
|
51
|
+
thread_id: threadID,
|
52
|
+
log_message_type: "log:thread-name"
|
53
|
+
};
|
54
|
+
|
55
|
+
defaultFuncs
|
56
|
+
.post("https://www.facebook.com/messaging/set_thread_name/", ctx.jar, form)
|
57
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
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;
|
62
|
+
return callback();
|
63
|
+
})
|
64
|
+
.catch(function (err) {
|
65
|
+
log.error("setTitle", err);
|
66
|
+
return callback(err);
|
67
|
+
});
|
68
|
+
return returnPromise;
|
69
|
+
};
|
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
|
+
};
|
@@ -1,52 +1,42 @@
|
|
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
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
-
};
|
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 unfriend(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) return rejectFunc(err);
|
18
|
+
resolveFunc(friendList);
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
|
+
var form = {
|
23
|
+
uid: userID,
|
24
|
+
unref: "bd_friends_tab",
|
25
|
+
floc: "friends_tab",
|
26
|
+
"nctr[_mod]": "pagelet_timeline_app_collection_" + ctx.userID + ":2356318349:2"
|
27
|
+
};
|
28
|
+
|
29
|
+
defaultFuncs
|
30
|
+
.post("https://www.facebook.com/ajax/profile/removefriendconfirm.php", ctx.jar, form)
|
31
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
32
|
+
.then(function (resData) {
|
33
|
+
if (resData.error) throw resData;
|
34
|
+
return callback();
|
35
|
+
})
|
36
|
+
.catch(function (err) {
|
37
|
+
log.error("unfriend", err);
|
38
|
+
return callback(err);
|
39
|
+
});
|
40
|
+
return returnPromise;
|
41
|
+
};
|
42
|
+
};
|
@@ -1,49 +1,39 @@
|
|
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(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
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function (err, friendList) {
|
17
|
-
if (err)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
return callback();
|
41
|
-
})
|
42
|
-
.catch(function(err) {
|
43
|
-
log.error("unsendMessage", err);
|
44
|
-
return callback(err);
|
45
|
-
});
|
46
|
-
|
47
|
-
return returnPromise;
|
48
|
-
};
|
49
|
-
};
|
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(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
|
+
|
15
|
+
if (!callback) {
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) return rejectFunc(err);
|
18
|
+
resolveFunc(friendList);
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
|
+
var form = {
|
23
|
+
message_id: messageID
|
24
|
+
};
|
25
|
+
|
26
|
+
defaultFuncs
|
27
|
+
.post("https://www.facebook.com/messaging/unsend_message/", ctx.jar, form)
|
28
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
29
|
+
.then(function (resData) {
|
30
|
+
if (resData.error) throw resData;
|
31
|
+
return callback();
|
32
|
+
})
|
33
|
+
.catch(function (err) {
|
34
|
+
log.error("unsendMessage", "» ParseAndCheckLogin got status code: 404. Bailing out of trying to parse response.");
|
35
|
+
return callback(err);
|
36
|
+
});
|
37
|
+
return returnPromise;
|
38
|
+
};
|
39
|
+
};
|