alicezetion 1.0.3 → 1.0.5
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/modules.stamp +1 -0
- package/.cache/replit/nix/env.json +1 -1
- package/index.js +536 -604
- package/package.json +78 -75
- package/replit.nix +6 -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 +1193 -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,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
|
5
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
6
|
-
return function addExternalModule(moduleObj) {
|
7
|
-
if (utils.getType(moduleObj) == "Object") {
|
8
|
-
for (let apiName in moduleObj) {
|
9
|
-
if (utils.getType(moduleObj[apiName]) == "Function") {
|
10
|
-
api[apiName] = moduleObj[apiName](defaultFuncs, api, ctx);
|
11
|
-
} else {
|
12
|
-
throw new Error(`Item "${apiName}" in moduleObj must be a function, not ${utils.getType(moduleObj[apiName])}!`);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
} else {
|
16
|
-
throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
|
17
|
-
}
|
18
|
-
};
|
19
|
-
};
|
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
-
return function changeAdminStatus(threadID, adminIDs, adminStatus, callback) {
|
8
|
-
if (utils.getType(threadID) !== "String") {
|
9
|
-
throw {error: "changeAdminStatus: threadID must be a string"};
|
10
|
-
}
|
11
|
-
|
12
|
-
if (utils.getType(adminIDs) === "String") {
|
13
|
-
adminIDs = [adminIDs];
|
14
|
-
}
|
15
|
-
|
16
|
-
if (utils.getType(adminIDs) !== "Array") {
|
17
|
-
throw {error: "changeAdminStatus: adminIDs must be an array or string"};
|
18
|
-
}
|
19
|
-
|
20
|
-
if (utils.getType(adminStatus) !== "Boolean") {
|
21
|
-
throw {error: "changeAdminStatus: adminStatus must be a string"};
|
22
|
-
}
|
23
|
-
|
24
|
-
var resolveFunc = function(){};
|
25
|
-
var rejectFunc = function(){};
|
26
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
27
|
-
resolveFunc = resolve;
|
28
|
-
rejectFunc = reject;
|
29
|
-
});
|
30
|
-
|
31
|
-
if (!callback) {
|
32
|
-
callback = function (err) {
|
33
|
-
if (err) {
|
34
|
-
return rejectFunc(err);
|
35
|
-
}
|
36
|
-
resolveFunc();
|
37
|
-
};
|
38
|
-
}
|
39
|
-
|
40
|
-
if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
|
41
|
-
throw {error: "changeAdminStatus: callback is not a function"};
|
42
|
-
}
|
43
|
-
|
44
|
-
let form = {
|
45
|
-
"thread_fbid": threadID,
|
46
|
-
};
|
47
|
-
|
48
|
-
let i = 0;
|
49
|
-
for (let u of adminIDs) {
|
50
|
-
form[`admin_ids[${i++}]`] = u;
|
51
|
-
}
|
52
|
-
form["add"] = adminStatus;
|
53
|
-
|
54
|
-
defaultFuncs
|
55
|
-
.post("https://www.facebook.com/messaging/save_admins/?dpr=1", ctx.jar, form)
|
56
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
57
|
-
.then(function(resData) {
|
58
|
-
if (resData.error) {
|
59
|
-
switch (resData.error) {
|
60
|
-
case 1976004:
|
61
|
-
throw { error: "Cannot alter admin status: you are not an admin.", rawResponse: resData };
|
62
|
-
case 1357031:
|
63
|
-
throw { error: "Cannot alter admin status: this thread is not a group chat.", rawResponse: resData };
|
64
|
-
default:
|
65
|
-
throw { error: "Cannot alter admin status: unknown error.", rawResponse: resData };
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
callback();
|
70
|
-
})
|
71
|
-
.catch(function(err) {
|
72
|
-
log.error("changeAdminStatus", err);
|
73
|
-
return callback(err);
|
74
|
-
});
|
75
|
-
|
76
|
-
return returnPromise;
|
77
|
-
};
|
78
|
-
};
|
79
|
-
|
@@ -1,55 +0,0 @@
|
|
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 changeArchivedStatus(threadOrThreads, archive, 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) {
|
17
|
-
if (err) {
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
20
|
-
resolveFunc();
|
21
|
-
};
|
22
|
-
}
|
23
|
-
|
24
|
-
var form = {};
|
25
|
-
|
26
|
-
if (utils.getType(threadOrThreads) === "Array") {
|
27
|
-
for (var i = 0; i < threadOrThreads.length; i++) {
|
28
|
-
form["ids[" + threadOrThreads[i] + "]"] = archive;
|
29
|
-
}
|
30
|
-
} else {
|
31
|
-
form["ids[" + threadOrThreads + "]"] = archive;
|
32
|
-
}
|
33
|
-
|
34
|
-
defaultFuncs
|
35
|
-
.post(
|
36
|
-
"https://www.facebook.com/ajax/mercury/change_archived_status.php",
|
37
|
-
ctx.jar,
|
38
|
-
form
|
39
|
-
)
|
40
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
41
|
-
.then(function(resData) {
|
42
|
-
if (resData.error) {
|
43
|
-
throw resData;
|
44
|
-
}
|
45
|
-
|
46
|
-
return callback();
|
47
|
-
})
|
48
|
-
.catch(function(err) {
|
49
|
-
log.error("changeArchivedStatus", err);
|
50
|
-
return callback(err);
|
51
|
-
});
|
52
|
-
|
53
|
-
return returnPromise;
|
54
|
-
};
|
55
|
-
};
|
package/alice/changeNickname.js
DELETED
@@ -1,59 +0,0 @@
|
|
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 changeNickname(nickname, threadID, participantID, 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
|
-
if (!callback) {
|
15
|
-
callback = function (err) {
|
16
|
-
if (err) {
|
17
|
-
return rejectFunc(err);
|
18
|
-
}
|
19
|
-
resolveFunc();
|
20
|
-
};
|
21
|
-
}
|
22
|
-
|
23
|
-
var form = {
|
24
|
-
nickname: nickname,
|
25
|
-
participant_id: participantID,
|
26
|
-
thread_or_other_fbid: threadID
|
27
|
-
};
|
28
|
-
|
29
|
-
defaultFuncs
|
30
|
-
.post(
|
31
|
-
"https://www.facebook.com/messaging/save_thread_nickname/?source=thread_settings&dpr=1",
|
32
|
-
ctx.jar,
|
33
|
-
form
|
34
|
-
)
|
35
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
36
|
-
.then(function(resData) {
|
37
|
-
if (resData.error === 1545014) {
|
38
|
-
throw { error: "Trying to change nickname of user isn't in thread" };
|
39
|
-
}
|
40
|
-
if (resData.error === 1357031) {
|
41
|
-
throw {
|
42
|
-
error:
|
43
|
-
"Trying to change user nickname of a thread that doesn't exist. Have at least one message in the thread before trying to change the user nickname."
|
44
|
-
};
|
45
|
-
}
|
46
|
-
if (resData.error) {
|
47
|
-
throw resData;
|
48
|
-
}
|
49
|
-
|
50
|
-
return callback();
|
51
|
-
})
|
52
|
-
.catch(function(err) {
|
53
|
-
log.error("changeNickname", err);
|
54
|
-
return callback(err);
|
55
|
-
});
|
56
|
-
|
57
|
-
return returnPromise;
|
58
|
-
};
|
59
|
-
};
|
@@ -1,55 +0,0 @@
|
|
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 changeThreadEmoji(emoji, threadID, 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) {
|
17
|
-
if (err) {
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
20
|
-
resolveFunc();
|
21
|
-
};
|
22
|
-
}
|
23
|
-
var form = {
|
24
|
-
emoji_choice: emoji,
|
25
|
-
thread_or_other_fbid: threadID
|
26
|
-
};
|
27
|
-
|
28
|
-
defaultFuncs
|
29
|
-
.post(
|
30
|
-
"https://www.facebook.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg",
|
31
|
-
ctx.jar,
|
32
|
-
form
|
33
|
-
)
|
34
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
35
|
-
.then(function(resData) {
|
36
|
-
if (resData.error === 1357031) {
|
37
|
-
throw {
|
38
|
-
error:
|
39
|
-
"Trying to change emoji of a chat that doesn't exist. Have at least one message in the thread before trying to change the emoji."
|
40
|
-
};
|
41
|
-
}
|
42
|
-
if (resData.error) {
|
43
|
-
throw resData;
|
44
|
-
}
|
45
|
-
|
46
|
-
return callback();
|
47
|
-
})
|
48
|
-
.catch(function(err) {
|
49
|
-
log.error("changeThreadEmoji", err);
|
50
|
-
return callback(err);
|
51
|
-
});
|
52
|
-
|
53
|
-
return returnPromise;
|
54
|
-
};
|
55
|
-
};
|