alicezetion 1.8.2 → 1.8.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 +210 -375
- package/package.json +6 -3
- package/replit.nix +4 -4
- package/src/addExternalModule.js +17 -0
- package/src/addUserToGroup.js +113 -0
- package/src/changeAdminStatus.js +79 -0
- package/src/changeArchivedStatus.js +55 -0
- package/src/changeAvatar.js +93 -0
- package/src/changeBio.js +77 -0
- package/src/changeBlockedStatus.js +47 -0
- package/src/changeCover.js +73 -0
- package/src/changeGroupImage.js +132 -0
- package/src/changeName.js +79 -0
- package/src/changeNickname.js +59 -0
- package/src/changeThreadColor.js +65 -0
- package/src/changeThreadEmoji.js +55 -0
- package/{leiamnash → src}/chat.js +28 -3
- package/src/createNewGroup.js +86 -0
- package/src/createPoll.js +71 -0
- package/src/data/getThreadInfo.json +1 -0
- package/src/deleteMessage.js +56 -0
- package/src/deleteThread.js +56 -0
- package/src/forwardAttachment.js +60 -0
- package/src/getAccess.js +112 -0
- package/src/getAvatarUser.js +78 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +29 -0
- package/src/getFriendsList.js +83 -0
- package/src/getThreadHistory.js +666 -0
- package/{leiamnash → src}/getThreadInfo.js +70 -54
- package/src/getThreadList.js +237 -0
- package/src/getThreadPictures.js +79 -0
- package/src/getUserID.js +66 -0
- package/src/getUserInfo.js +163 -0
- package/src/handleFriendRequest.js +61 -0
- package/src/handleMessageRequest.js +65 -0
- package/src/httpGet.js +57 -0
- package/src/httpPost.js +57 -0
- package/src/httpPostFormData.js +63 -0
- package/{leiamnash → src}/listenMqtt.js +16 -6
- package/src/listenNotification.js +88 -0
- package/src/logout.js +275 -0
- package/src/markAsDelivered.js +58 -0
- package/src/markAsRead.js +80 -0
- package/src/markAsReadAll.js +50 -0
- package/src/markAsSeen.js +59 -0
- package/src/muteThread.js +52 -0
- package/src/react.js +117 -0
- package/{leiamnash → src}/refreshFb_dtsg.js +1 -1
- package/src/removeUserFromGroup.js +79 -0
- package/src/resolvePhotoUrl.js +45 -0
- package/src/searchForThread.js +53 -0
- package/src/searchStickers.js +52 -0
- package/src/seen.js +50 -0
- package/src/sendMessage.js +477 -0
- package/src/sendMessageMqtt.js +316 -0
- package/src/sendTypingIndicator.js +103 -0
- package/src/setMessageReaction.js +117 -0
- package/src/setPostReaction.js +109 -0
- package/src/setTitle.js +86 -0
- package/src/threadColors.js +131 -0
- package/src/unfriend.js +52 -0
- package/src/unsendMessage.js +49 -0
- package/utils.js +135 -176
- package/.cache/replit/modules.stamp +0 -1
- package/leiamnash/addExternalModule.js +0 -15
- package/leiamnash/addUserToGroup.js +0 -77
- package/leiamnash/changeAdminStatus.js +0 -47
- package/leiamnash/changeArchivedStatus.js +0 -41
- package/leiamnash/changeAvatar.js +0 -127
- package/leiamnash/changeBio.js +0 -64
- package/leiamnash/changeBlockedStatus.js +0 -36
- package/leiamnash/changeGroupImage.js +0 -105
- package/leiamnash/changeNickname.js +0 -43
- package/leiamnash/changeThreadColor.js +0 -61
- package/leiamnash/changeThreadEmoji.js +0 -41
- package/leiamnash/createNewGroup.js +0 -70
- package/leiamnash/createPoll.js +0 -59
- package/leiamnash/deleteMessage.js +0 -44
- package/leiamnash/deleteThread.js +0 -42
- package/leiamnash/forwardAttachment.js +0 -47
- package/leiamnash/forwardMessage.js +0 -0
- package/leiamnash/getCurrentUserID.js +0 -7
- package/leiamnash/getEmojiUrl.js +0 -27
- package/leiamnash/getFriendsList.js +0 -73
- package/leiamnash/getInfoVideo.js +0 -134
- package/leiamnash/getThreadHistory.js +0 -537
- package/leiamnash/getThreadHistoryDeprecated.js +0 -71
- package/leiamnash/getThreadInfoDeprecated.js +0 -56
- package/leiamnash/getThreadList.js +0 -213
- package/leiamnash/getThreadListDeprecated.js +0 -46
- package/leiamnash/getThreadPictures.js +0 -59
- package/leiamnash/getUserID.js +0 -61
- package/leiamnash/getUserInfo.js +0 -66
- package/leiamnash/handleFriendRequest.js +0 -46
- package/leiamnash/handleMessageRequest.js +0 -47
- package/leiamnash/httpGet.js +0 -47
- package/leiamnash/httpPost.js +0 -47
- package/leiamnash/logout.js +0 -68
- package/leiamnash/markAsDelivered.js +0 -47
- package/leiamnash/markAsRead.js +0 -70
- package/leiamnash/markAsReadAll.js +0 -40
- package/leiamnash/markAsSeen.js +0 -48
- package/leiamnash/muteThread.js +0 -45
- package/leiamnash/react.js +0 -109
- package/leiamnash/removeUserFromGroup.js +0 -45
- package/leiamnash/resolvePhotoUrl.js +0 -36
- package/leiamnash/searchForThread.js +0 -42
- package/leiamnash/seen.js +0 -40
- package/leiamnash/sendMessage.js +0 -315
- package/leiamnash/sendTypingIndicator.js +0 -70
- package/leiamnash/setMessageReaction.js +0 -103
- package/leiamnash/setPostReaction.js +0 -63
- package/leiamnash/setTitle.js +0 -70
- package/leiamnash/threadColors.js +0 -41
- package/leiamnash/unfriend.js +0 -42
- package/leiamnash/unsendMessage.js +0 -39
- /package/{leiamnash → src}/getMessage.js +0 -0
@@ -0,0 +1,79 @@
|
|
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 removeUserFromGroup(userID, threadID, callback) {
|
8
|
+
if (
|
9
|
+
!callback &&
|
10
|
+
(utils.getType(threadID) === "Function" ||
|
11
|
+
utils.getType(threadID) === "AsyncFunction")
|
12
|
+
) {
|
13
|
+
throw { error: "please pass a threadID as a second argument." };
|
14
|
+
}
|
15
|
+
if (
|
16
|
+
utils.getType(threadID) !== "Number" &&
|
17
|
+
utils.getType(threadID) !== "String"
|
18
|
+
) {
|
19
|
+
throw {
|
20
|
+
error:
|
21
|
+
"threadID should be of type Number or String and not " +
|
22
|
+
utils.getType(threadID) +
|
23
|
+
"."
|
24
|
+
};
|
25
|
+
}
|
26
|
+
if (
|
27
|
+
utils.getType(userID) !== "Number" &&
|
28
|
+
utils.getType(userID) !== "String"
|
29
|
+
) {
|
30
|
+
throw {
|
31
|
+
error:
|
32
|
+
"userID should be of type Number or String and not " +
|
33
|
+
utils.getType(userID) +
|
34
|
+
"."
|
35
|
+
};
|
36
|
+
}
|
37
|
+
|
38
|
+
let resolveFunc = function () { };
|
39
|
+
let rejectFunc = function () { };
|
40
|
+
const returnPromise = new Promise(function (resolve, reject) {
|
41
|
+
resolveFunc = resolve;
|
42
|
+
rejectFunc = reject;
|
43
|
+
});
|
44
|
+
|
45
|
+
if (!callback) {
|
46
|
+
callback = function (err, friendList) {
|
47
|
+
if (err) {
|
48
|
+
return rejectFunc(err);
|
49
|
+
}
|
50
|
+
resolveFunc(friendList);
|
51
|
+
};
|
52
|
+
}
|
53
|
+
|
54
|
+
const form = {
|
55
|
+
uid: userID,
|
56
|
+
tid: threadID
|
57
|
+
};
|
58
|
+
|
59
|
+
defaultFuncs
|
60
|
+
.post("https://www.facebook.com/chat/remove_participants", ctx.jar, form)
|
61
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
62
|
+
.then(function (resData) {
|
63
|
+
if (!resData) {
|
64
|
+
throw { error: "Remove from group failed." };
|
65
|
+
}
|
66
|
+
if (resData.error) {
|
67
|
+
throw resData;
|
68
|
+
}
|
69
|
+
|
70
|
+
return callback();
|
71
|
+
})
|
72
|
+
.catch(function (err) {
|
73
|
+
log.error("removeUserFromGroup", err);
|
74
|
+
return callback(err);
|
75
|
+
});
|
76
|
+
|
77
|
+
return returnPromise;
|
78
|
+
};
|
79
|
+
};
|
@@ -0,0 +1,45 @@
|
|
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 resolvePhotoUrl(photoID, callback) {
|
8
|
+
let resolveFunc = function () { };
|
9
|
+
let rejectFunc = function () { };
|
10
|
+
const 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
|
+
defaultFuncs
|
25
|
+
.get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, {
|
26
|
+
photo_id: photoID
|
27
|
+
})
|
28
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
29
|
+
.then(resData => {
|
30
|
+
if (resData.error) {
|
31
|
+
throw resData;
|
32
|
+
}
|
33
|
+
|
34
|
+
const photoUrl = resData.jsmods.require[0][3][0];
|
35
|
+
|
36
|
+
return callback(null, photoUrl);
|
37
|
+
})
|
38
|
+
.catch(err => {
|
39
|
+
log.error("resolvePhotoUrl", err);
|
40
|
+
return callback(err);
|
41
|
+
});
|
42
|
+
|
43
|
+
return returnPromise;
|
44
|
+
};
|
45
|
+
};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
|
5
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
6
|
+
return function searchForThread(name, callback) {
|
7
|
+
let resolveFunc = function () { };
|
8
|
+
let rejectFunc = function () { };
|
9
|
+
const returnPromise = new Promise(function (resolve, reject) {
|
10
|
+
resolveFunc = resolve;
|
11
|
+
rejectFunc = reject;
|
12
|
+
});
|
13
|
+
|
14
|
+
if (!callback) {
|
15
|
+
callback = function (err, friendList) {
|
16
|
+
if (err) {
|
17
|
+
return rejectFunc(err);
|
18
|
+
}
|
19
|
+
resolveFunc(friendList);
|
20
|
+
};
|
21
|
+
}
|
22
|
+
|
23
|
+
const tmpForm = {
|
24
|
+
client: "web_messenger",
|
25
|
+
query: name,
|
26
|
+
offset: 0,
|
27
|
+
limit: 21,
|
28
|
+
index: "fbid"
|
29
|
+
};
|
30
|
+
|
31
|
+
defaultFuncs
|
32
|
+
.post(
|
33
|
+
"https://www.facebook.com/ajax/mercury/search_threads.php",
|
34
|
+
ctx.jar,
|
35
|
+
tmpForm
|
36
|
+
)
|
37
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
38
|
+
.then(function (resData) {
|
39
|
+
if (resData.error) {
|
40
|
+
throw resData;
|
41
|
+
}
|
42
|
+
if (!resData.payload.mercury_payload.threads) {
|
43
|
+
return callback({ error: "Could not find thread `" + name + "`." });
|
44
|
+
}
|
45
|
+
return callback(
|
46
|
+
null,
|
47
|
+
resData.payload.mercury_payload.threads.map(utils.formatThread)
|
48
|
+
);
|
49
|
+
});
|
50
|
+
|
51
|
+
return returnPromise;
|
52
|
+
};
|
53
|
+
};
|
@@ -0,0 +1,52 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var utils = require('../utils.js');
|
4
|
+
var log = require('npmlog');
|
5
|
+
|
6
|
+
module.exports = function (http, api, ctx) {
|
7
|
+
function formatData(res) {
|
8
|
+
return {
|
9
|
+
id: res.node.id,
|
10
|
+
image: res.node.image,
|
11
|
+
package: res.node.pack != null ? {
|
12
|
+
name: res.node.pack.name,
|
13
|
+
id: res.node.pack.id
|
14
|
+
} : {},
|
15
|
+
label: res.node.label
|
16
|
+
};
|
17
|
+
}
|
18
|
+
|
19
|
+
return function searchStickers(query = '', callback) {
|
20
|
+
var cb;
|
21
|
+
var rtPromise = new Promise(function (resolve, reject) {
|
22
|
+
cb = function (error, data) {
|
23
|
+
data ? resolve(data) : reject(error);
|
24
|
+
}
|
25
|
+
});
|
26
|
+
|
27
|
+
if (typeof callback == 'function') cb = callback;
|
28
|
+
|
29
|
+
var form = {
|
30
|
+
fb_api_req_friendly_name: 'StickersFlyoutTagSelectorQuery',
|
31
|
+
variables: JSON.stringify({
|
32
|
+
stickerWidth: 64,
|
33
|
+
stickerHeight: 64,
|
34
|
+
stickerInterface: 'messages',
|
35
|
+
query
|
36
|
+
}),
|
37
|
+
doc_id: '4642836929159953'
|
38
|
+
}
|
39
|
+
http
|
40
|
+
.post('https://www.facebook.com/api/graphql/', ctx.jar, form)
|
41
|
+
.then(utils.parseAndCheckLogin(ctx, http))
|
42
|
+
.then(function (res) {
|
43
|
+
return cb(null, res.data.sticker_search.sticker_results.edges.map(formatData));
|
44
|
+
})
|
45
|
+
.catch(function (err) {
|
46
|
+
log.error('searchStickers', err);
|
47
|
+
return cb(err);
|
48
|
+
});
|
49
|
+
|
50
|
+
return rtPromise;
|
51
|
+
}
|
52
|
+
}
|
package/src/seen.js
ADDED
@@ -0,0 +1,50 @@
|
|
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 markAsReadAll(callback) {
|
8
|
+
let resolveFunc = function () { };
|
9
|
+
let rejectFunc = function () { };
|
10
|
+
const 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
|
+
const form = {
|
25
|
+
folder: 'inbox'
|
26
|
+
};
|
27
|
+
|
28
|
+
defaultFuncs
|
29
|
+
.post(
|
30
|
+
"https://www.facebook.com/ajax/mercury/mark_folder_as_read.php",
|
31
|
+
ctx.jar,
|
32
|
+
form
|
33
|
+
)
|
34
|
+
.then(utils.saveCookies(ctx.jar))
|
35
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
36
|
+
.then(function (resData) {
|
37
|
+
if (resData.error) {
|
38
|
+
throw resData;
|
39
|
+
}
|
40
|
+
|
41
|
+
return callback();
|
42
|
+
})
|
43
|
+
.catch(function (err) {
|
44
|
+
log.error("markAsReadAll", err);
|
45
|
+
return callback(err);
|
46
|
+
});
|
47
|
+
|
48
|
+
return returnPromise;
|
49
|
+
};
|
50
|
+
};
|