alicezetion 1.2.5 → 1.2.7
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 +6 -3
- 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
@@ -3,23 +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 createNewGroup(participantIDs, groupTitle, callback) {
|
8
8
|
if (utils.getType(groupTitle) == "Function") {
|
9
9
|
callback = groupTitle;
|
10
10
|
groupTitle = null;
|
11
11
|
}
|
12
12
|
|
13
|
-
if (utils.getType(participantIDs) !== "Array") {
|
14
|
-
throw { error: "createNewGroup: participantIDs should be an array." };
|
15
|
-
}
|
13
|
+
if (utils.getType(participantIDs) !== "Array") throw { error: "createNewGroup: participantIDs should be an array." };
|
16
14
|
|
17
|
-
if (participantIDs.length < 2) {
|
18
|
-
throw { error: "createNewGroup: participantIDs should have at least 2 IDs." };
|
19
|
-
}
|
15
|
+
if (participantIDs.length < 2) throw { error: "createNewGroup: participantIDs should have at least 2 IDs." };
|
20
16
|
|
21
|
-
var resolveFunc = function(){};
|
22
|
-
var rejectFunc = function(){};
|
17
|
+
var resolveFunc = function () { };
|
18
|
+
var rejectFunc = function () { };
|
23
19
|
var returnPromise = new Promise(function (resolve, reject) {
|
24
20
|
resolveFunc = resolve;
|
25
21
|
rejectFunc = reject;
|
@@ -27,20 +23,14 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
27
23
|
|
28
24
|
if (!callback) {
|
29
25
|
callback = function (err, threadID) {
|
30
|
-
if (err)
|
31
|
-
return rejectFunc(err);
|
32
|
-
}
|
26
|
+
if (err) return rejectFunc(err);
|
33
27
|
resolveFunc(threadID);
|
34
28
|
};
|
35
29
|
}
|
36
30
|
|
37
31
|
var pids = [];
|
38
|
-
for (var n in participantIDs) {
|
39
|
-
|
40
|
-
fbid: participantIDs[n]
|
41
|
-
});
|
42
|
-
}
|
43
|
-
pids.push({fbid: ctx.userID});
|
32
|
+
for (var n in participantIDs) pids.push({ fbid: participantIDs[n] });
|
33
|
+
pids.push({ fbid: ctx.userID });
|
44
34
|
|
45
35
|
var form = {
|
46
36
|
fb_api_caller_class: "RelayModern",
|
@@ -64,19 +54,13 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
64
54
|
};
|
65
55
|
|
66
56
|
defaultFuncs
|
67
|
-
.post(
|
68
|
-
"https://www.facebook.com/api/graphql/",
|
69
|
-
ctx.jar,
|
70
|
-
form
|
71
|
-
)
|
57
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
72
58
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
73
|
-
.then(function(resData) {
|
74
|
-
if (resData.errors)
|
75
|
-
throw resData;
|
76
|
-
}
|
59
|
+
.then(function (resData) {
|
60
|
+
if (resData.errors) throw resData;
|
77
61
|
return callback(null, resData.data.messenger_group_thread_create.thread.thread_key.thread_fbid);
|
78
62
|
})
|
79
|
-
.catch(function(err) {
|
63
|
+
.catch(function (err) {
|
80
64
|
log.error("createNewGroup", err);
|
81
65
|
return callback(err);
|
82
66
|
});
|
package/leiamnash/createPoll.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) {
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function createPoll(title, threadID, options, 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;
|
@@ -16,18 +16,15 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
16
16
|
if (utils.getType(options) == "Function") {
|
17
17
|
callback = options;
|
18
18
|
options = null;
|
19
|
-
}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
callback = function (err) {
|
22
|
+
if (err) return rejectFunc(err);
|
24
23
|
resolveFunc();
|
25
24
|
};
|
26
25
|
}
|
27
26
|
}
|
28
|
-
if (!options) {
|
29
|
-
options = {}; // Initial poll options are optional
|
30
|
-
}
|
27
|
+
if (!options) options = {}; // Initial poll options are optional
|
31
28
|
|
32
29
|
var form = {
|
33
30
|
target_id: threadID,
|
@@ -40,28 +37,19 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
40
37
|
// eslint-disable-next-line no-prototype-builtins
|
41
38
|
if (options.hasOwnProperty(opt)) {
|
42
39
|
form["option_text_array[" + ind + "]"] = opt;
|
43
|
-
form["option_is_selected_array[" + ind + "]"] = options[opt]
|
44
|
-
? "1"
|
45
|
-
: "0";
|
40
|
+
form["option_is_selected_array[" + ind + "]"] = options[opt] ? "1" : "0";
|
46
41
|
ind++;
|
47
42
|
}
|
48
43
|
}
|
49
44
|
|
50
45
|
defaultFuncs
|
51
|
-
.post(
|
52
|
-
"https://www.facebook.com/messaging/group_polling/create_poll/?dpr=1",
|
53
|
-
ctx.jar,
|
54
|
-
form
|
55
|
-
)
|
46
|
+
.post("https://www.facebook.com/messaging/group_polling/create_poll/?dpr=1", ctx.jar, form)
|
56
47
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
57
|
-
.then(function(resData) {
|
58
|
-
if (resData.payload.status != "success")
|
59
|
-
throw resData;
|
60
|
-
}
|
61
|
-
|
48
|
+
.then(function (resData) {
|
49
|
+
if (resData.payload.status != "success") throw resData;
|
62
50
|
return callback();
|
63
51
|
})
|
64
|
-
.catch(function(err) {
|
52
|
+
.catch(function (err) {
|
65
53
|
log.error("createPoll", err);
|
66
54
|
return callback(err);
|
67
55
|
});
|
@@ -3,19 +3,18 @@
|
|
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 deleteMessage(messageOrMessages, 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;
|
13
13
|
});
|
14
14
|
if (!callback) {
|
15
|
-
callback = function(err) {
|
16
|
-
if (err)
|
17
|
-
|
18
|
-
}
|
15
|
+
callback = function (err) {
|
16
|
+
if (err) return rejectFunc(err);
|
17
|
+
|
19
18
|
resolveFunc();
|
20
19
|
};
|
21
20
|
}
|
@@ -24,29 +23,18 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
24
23
|
client: "mercury"
|
25
24
|
};
|
26
25
|
|
27
|
-
if (utils.getType(messageOrMessages) !== "Array")
|
28
|
-
messageOrMessages = [messageOrMessages];
|
29
|
-
}
|
26
|
+
if (utils.getType(messageOrMessages) !== "Array") messageOrMessages = [messageOrMessages];
|
30
27
|
|
31
|
-
for (var i = 0; i < messageOrMessages.length; i++)
|
32
|
-
form["message_ids[" + i + "]"] = messageOrMessages[i];
|
33
|
-
}
|
28
|
+
for (var i = 0; i < messageOrMessages.length; i++) form["message_ids[" + i + "]"] = messageOrMessages[i];
|
34
29
|
|
35
30
|
defaultFuncs
|
36
|
-
.post(
|
37
|
-
"https://www.facebook.com/ajax/mercury/delete_messages.php",
|
38
|
-
ctx.jar,
|
39
|
-
form
|
40
|
-
)
|
31
|
+
.post("https://www.facebook.com/ajax/mercury/delete_messages.php", ctx.jar, form)
|
41
32
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
42
|
-
.then(function(resData) {
|
43
|
-
if (resData.error)
|
44
|
-
throw resData;
|
45
|
-
}
|
46
|
-
|
33
|
+
.then(function (resData) {
|
34
|
+
if (resData.error) throw resData;
|
47
35
|
return callback();
|
48
36
|
})
|
49
|
-
.catch(function(err) {
|
37
|
+
.catch(function (err) {
|
50
38
|
log.error("deleteMessage", err);
|
51
39
|
return callback(err);
|
52
40
|
});
|
@@ -3,19 +3,17 @@
|
|
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 deleteThread(threadOrThreads, 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;
|
13
13
|
});
|
14
14
|
if (!callback) {
|
15
|
-
callback = function(err) {
|
16
|
-
if (err)
|
17
|
-
return rejectFunc(err);
|
18
|
-
}
|
15
|
+
callback = function (err) {
|
16
|
+
if (err) return rejectFunc(err);
|
19
17
|
resolveFunc();
|
20
18
|
};
|
21
19
|
}
|
@@ -24,29 +22,17 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
24
22
|
client: "mercury"
|
25
23
|
};
|
26
24
|
|
27
|
-
if (utils.getType(threadOrThreads) !== "Array")
|
28
|
-
|
29
|
-
}
|
30
|
-
|
31
|
-
for (var i = 0; i < threadOrThreads.length; i++) {
|
32
|
-
form["ids[" + i + "]"] = threadOrThreads[i];
|
33
|
-
}
|
25
|
+
if (utils.getType(threadOrThreads) !== "Array") threadOrThreads = [threadOrThreads];
|
26
|
+
for (var i = 0; i < threadOrThreads.length; i++) form["ids[" + i + "]"] = threadOrThreads[i];
|
34
27
|
|
35
28
|
defaultFuncs
|
36
|
-
.post(
|
37
|
-
"https://www.facebook.com/ajax/mercury/delete_thread.php",
|
38
|
-
ctx.jar,
|
39
|
-
form
|
40
|
-
)
|
29
|
+
.post("https://www.facebook.com/ajax/mercury/delete_thread.php", ctx.jar, form)
|
41
30
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
42
|
-
.then(function(resData) {
|
43
|
-
if (resData.error)
|
44
|
-
throw resData;
|
45
|
-
}
|
46
|
-
|
31
|
+
.then(function (resData) {
|
32
|
+
if (resData.error) throw resData;
|
47
33
|
return callback();
|
48
34
|
})
|
49
|
-
.catch(function(err) {
|
35
|
+
.catch(function (err) {
|
50
36
|
log.error("deleteThread", err);
|
51
37
|
return callback(err);
|
52
38
|
});
|
@@ -3,19 +3,17 @@
|
|
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 forwardAttachment(attachmentID, userOrUsers, 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;
|
13
13
|
});
|
14
14
|
if (!callback) {
|
15
|
-
callback = function(err) {
|
16
|
-
if (err)
|
17
|
-
return rejectFunc(err);
|
18
|
-
}
|
15
|
+
callback = function (err) {
|
16
|
+
if (err) return rejectFunc(err);
|
19
17
|
resolveFunc();
|
20
18
|
};
|
21
19
|
}
|
@@ -24,33 +22,22 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
24
22
|
attachment_id: attachmentID
|
25
23
|
};
|
26
24
|
|
27
|
-
if (utils.getType(userOrUsers) !== "Array")
|
28
|
-
userOrUsers = [userOrUsers];
|
29
|
-
}
|
25
|
+
if (utils.getType(userOrUsers) !== "Array") userOrUsers = [userOrUsers];
|
30
26
|
|
31
27
|
var timestamp = Math.floor(Date.now() / 1000);
|
32
28
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
form["recipient_map[" + (timestamp + i) + "]"] = userOrUsers[i];
|
37
|
-
}
|
29
|
+
//That's good, the key of the array is really timestmap in seconds + index
|
30
|
+
//Probably time when the attachment will be sent?
|
31
|
+
for (var i = 0; i < userOrUsers.length; i++) form["recipient_map[" + (timestamp + i) + "]"] = userOrUsers[i];
|
38
32
|
|
39
33
|
defaultFuncs
|
40
|
-
.post(
|
41
|
-
"https://www.facebook.com/mercury/attachments/forward/",
|
42
|
-
ctx.jar,
|
43
|
-
form
|
44
|
-
)
|
34
|
+
.post("https://www.facebook.com/mercury/attachments/forward/", ctx.jar, form)
|
45
35
|
.then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
|
46
|
-
.then(function(resData) {
|
47
|
-
if (resData.error)
|
48
|
-
throw resData;
|
49
|
-
}
|
50
|
-
|
36
|
+
.then(function (resData) {
|
37
|
+
if (resData.error) throw resData;
|
51
38
|
return callback();
|
52
39
|
})
|
53
|
-
.catch(function(err) {
|
40
|
+
.catch(function (err) {
|
54
41
|
log.error("forwardAttachment", err);
|
55
42
|
return callback(err);
|
56
43
|
});
|
File without changes
|
package/leiamnash/getEmojiUrl.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
const util = require("util");
|
4
4
|
|
5
|
-
module.exports = function() {
|
5
|
+
module.exports = function () {
|
6
6
|
return function getEmojiUrl(c, size, pixelRatio) {
|
7
7
|
/*
|
8
8
|
Resolves Facebook Messenger emoji image asset URL for an emoji character.
|
@@ -19,9 +19,7 @@ module.exports = function() {
|
|
19
19
|
c.codePointAt(0).toString(16)
|
20
20
|
);
|
21
21
|
let base = 317426846;
|
22
|
-
for (let i = 0; i < ending.length; i++)
|
23
|
-
base = (base << 5) - base + ending.charCodeAt(i);
|
24
|
-
}
|
22
|
+
for (let i = 0; i < ending.length; i++) base = (base << 5) - base + ending.charCodeAt(i);
|
25
23
|
|
26
24
|
let hashed = (base & 255).toString(16);
|
27
25
|
return util.format(baseUrl, hashed, ending);
|
@@ -21,7 +21,7 @@ var GENDERS = {
|
|
21
21
|
};
|
22
22
|
|
23
23
|
function formatData(obj) {
|
24
|
-
return Object.keys(obj).map(function(key) {
|
24
|
+
return Object.keys(obj).map(function (key) {
|
25
25
|
var user = obj[key];
|
26
26
|
return {
|
27
27
|
alternateName: user.alternateName,
|
@@ -39,10 +39,10 @@ function formatData(obj) {
|
|
39
39
|
});
|
40
40
|
}
|
41
41
|
|
42
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
42
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
43
43
|
return function getFriendsList(callback) {
|
44
|
-
var resolveFunc = function(){};
|
45
|
-
var rejectFunc = function(){};
|
44
|
+
var resolveFunc = function () { };
|
45
|
+
var rejectFunc = function () { };
|
46
46
|
var returnPromise = new Promise(function (resolve, reject) {
|
47
47
|
resolveFunc = resolve;
|
48
48
|
rejectFunc = reject;
|
@@ -50,31 +50,20 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
50
50
|
|
51
51
|
if (!callback) {
|
52
52
|
callback = function (err, friendList) {
|
53
|
-
if (err)
|
54
|
-
return rejectFunc(err);
|
55
|
-
}
|
53
|
+
if (err) return rejectFunc(err);
|
56
54
|
resolveFunc(friendList);
|
57
55
|
};
|
58
56
|
}
|
59
57
|
|
60
58
|
defaultFuncs
|
61
|
-
.postFormData(
|
62
|
-
"https://www.facebook.com/chat/user_info_all",
|
63
|
-
ctx.jar,
|
64
|
-
{},
|
65
|
-
{ viewer: ctx.userID }
|
66
|
-
)
|
59
|
+
.postFormData("https://www.facebook.com/chat/user_info_all", ctx.jar, {}, { viewer: ctx.userID })
|
67
60
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
68
|
-
.then(function(resData) {
|
69
|
-
if (!resData) {
|
70
|
-
|
71
|
-
}
|
72
|
-
if (resData.error) {
|
73
|
-
throw resData;
|
74
|
-
}
|
61
|
+
.then(function (resData) {
|
62
|
+
if (!resData) throw { error: "getFriendsList returned empty object." };
|
63
|
+
if (resData.error) throw resData;
|
75
64
|
callback(null, formatData(resData.payload));
|
76
65
|
})
|
77
|
-
.catch(function(err) {
|
66
|
+
.catch(function (err) {
|
78
67
|
log.error("getFriendsList", err);
|
79
68
|
return callback(err);
|
80
69
|
});
|