fca-arif-babu 1.0.21 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Extra/Balancer.js +49 -0
- package/Extra/Bypass/956/index.js +234 -0
- package/Extra/Bypass/test/aaaa.json +169 -0
- package/Extra/Bypass/test/index.js +188 -0
- package/Extra/Database/index.js +469 -0
- package/Extra/ExtraAddons.js +82 -0
- package/Extra/ExtraFindUID.js +62 -0
- package/Extra/ExtraGetThread.js +365 -0
- package/Extra/ExtraScreenShot.js +430 -0
- package/Extra/ExtraUptimeRobot.js +38 -0
- package/Extra/Html/Classic/script.js +119 -0
- package/Extra/Html/Classic/style.css +8 -0
- package/Extra/Security/AES_256_GCM/index.js +1 -0
- package/Extra/Security/Base/Step_1.js +6 -0
- package/Extra/Security/Base/Step_2.js +22 -0
- package/Extra/Security/Base/Step_3.js +22 -0
- package/Extra/Security/Base/index.js +191 -0
- package/Extra/Security/Step_1.js +6 -0
- package/Extra/Security/Step_2.js +22 -0
- package/Extra/Security/Step_3.js +22 -0
- package/Extra/Security/index.js +5 -0
- package/Extra/Src/Change_Environment.js +24 -0
- package/Extra/Src/Check_Update.js +67 -0
- package/Extra/Src/History.js +115 -0
- package/Extra/Src/Instant_Update.js +65 -0
- package/Extra/Src/Last-Run.js +65 -0
- package/Extra/Src/Premium.js +81 -0
- package/Extra/Src/Release_Memory.js +160 -0
- package/Extra/Src/Websocket.js +213 -0
- package/Extra/Src/image/62518eafb0670b697788ce4f9a4f71d1.jpg +0 -0
- package/Extra/Src/test.js +28 -0
- package/Extra/Src/uuid.js +137 -0
- package/Func/AcceptAgreement.js +31 -0
- package/Func/ClearCache.js +64 -0
- package/Func/ReportV1.js +54 -0
- package/{LICENSE-MIT → LICENSE.txt} +6 -6
- package/Language/index.json +228 -0
- package/Main.js +1290 -0
- package/README.md +8 -6
- package/SECURITY.md +17 -0
- package/broadcast.js +44 -0
- package/index.js +424 -465
- package/logger.js +66 -0
- package/package.json +91 -42
- package/src/Dev_Horizon_Data.js +125 -0
- package/src/Dev_getThreadInfoOLD.js +422 -0
- package/src/Dev_shareTest2.js +68 -0
- package/src/Dev_shareTest3.js +71 -0
- package/src/Premium.js +25 -0
- package/src/Screenshot.js +83 -0
- package/src/addExternalModule.js +5 -14
- package/src/addUserToGroup.js +21 -57
- package/src/changeAdminStatus.js +22 -46
- package/src/changeArchivedStatus.js +12 -26
- package/src/{changeAvatarV2.js → changeAvt.js} +2 -3
- package/src/changeBio.js +15 -26
- package/src/changeBlockedStatus.js +9 -22
- package/src/changeGroupImage.js +26 -55
- package/src/changeNickname.js +14 -28
- package/src/changeThreadColor.js +19 -22
- package/src/changeThreadEmoji.js +12 -25
- package/src/createNewGroup.js +18 -36
- package/src/createPoll.js +17 -28
- package/src/deleteMessage.js +14 -25
- package/src/deleteThread.js +13 -26
- package/src/editMessage.js +50 -56
- package/src/forwardAttachment.js +16 -28
- package/src/getAccessToken.js +28 -0
- package/src/getCurrentUserID.js +3 -3
- package/src/getEmojiUrl.js +8 -10
- package/src/getFriendsList.js +15 -25
- package/src/getMessage.js +81 -813
- package/src/getThreadHistory.js +98 -241
- package/src/getThreadInfo.js +286 -89
- package/src/getThreadInfoOLD.js +422 -0
- package/src/getThreadList.js +158 -215
- package/src/getThreadMain.js +220 -0
- package/src/getThreadPictures.js +20 -40
- package/src/getUID.js +49 -112
- package/src/getUserID.js +14 -18
- package/src/getUserInfo.js +75 -34
- package/src/getUserInfoMain.js +65 -0
- package/src/getUserInfoV2.js +32 -0
- package/src/getUserInfoV3.js +63 -0
- package/src/getUserInfoV4.js +55 -0
- package/src/getUserInfoV5.js +61 -0
- package/src/handleFriendRequest.js +14 -25
- package/src/handleMessageRequest.js +21 -37
- package/src/httpGet.js +22 -37
- package/src/httpPost.js +20 -36
- package/src/httpPostFormData.js +23 -52
- package/src/listenMqtt.js +667 -414
- package/src/listenMqttV1.js +846 -0
- package/src/logout.js +17 -24
- package/src/markAsDelivered.js +16 -23
- package/src/markAsRead.js +28 -43
- package/src/markAsReadAll.js +14 -21
- package/src/markAsSeen.js +19 -29
- package/src/muteThread.js +13 -18
- package/src/removeUserFromGroup.js +18 -48
- package/src/resolvePhotoUrl.js +14 -22
- package/src/searchForThread.js +13 -23
- package/src/sendMessage.js +125 -181
- package/src/sendMqttMessage.js +71 -0
- package/src/sendTypingIndicator.js +80 -28
- package/src/setMessageReaction.js +20 -33
- package/src/setPostReaction.js +95 -105
- package/src/setTitle.js +19 -35
- package/src/shareContact.js +37 -92
- package/src/shareLink.js +5 -6
- package/src/threadColors.js +17 -109
- package/src/unfriend.js +11 -20
- package/src/unsendMessage.js +33 -30
- package/src/unsendMqttMessage.js +66 -0
- package/test/data/shareAttach.js +146 -0
- package/test/data/something.mov +1 -0
- package/test/data/test.png +1 -0
- package/test/data/test.txt +1 -0
- package/test/env/.env +1 -0
- package/test/example-config.json +18 -0
- package/test/test-page.js +140 -0
- package/test/test.js +385 -0
- package/test/testv2.js +3 -0
- package/utils.js +2908 -1247
- package/replit.nix +0 -3
- package/src/changeAvatar.js +0 -136
- package/src/changeBlockedStatusMqtt.js +0 -80
- package/src/changeCover.js +0 -72
- package/src/changeName.js +0 -78
- package/src/changeUsername.js +0 -58
- package/src/createCommentPost.js +0 -229
- package/src/createPost.js +0 -275
- package/src/data/getThreadInfo.json +0 -1
- package/src/editMessageOld.js +0 -67
- package/src/follow.js +0 -74
- package/src/getAccess.js +0 -112
- package/src/getAvatarUser.js +0 -78
- package/src/getBotInitialData.js +0 -42
- package/src/getRegion.js +0 -7
- package/src/getThreadHistoryDeprecated.js +0 -93
- package/src/getThreadInfoDeprecated.js +0 -80
- package/src/getThreadListDeprecated.js +0 -75
- package/src/listenNotification.js +0 -85
- package/src/pinMessage.js +0 -59
- package/src/refreshFb_dtsg.js +0 -89
- package/src/searchStickers.js +0 -53
- package/src/sendMessageMqtt.js +0 -316
- package/src/setMessageReactionMqtt.js +0 -62
- package/src/setProfileGuard.js +0 -44
- package/src/setStoryReaction.js +0 -64
- package/src/stopListenMqtt.js +0 -23
- package/src/uploadAttachment.js +0 -94
package/src/searchForThread.js
CHANGED
@@ -1,50 +1,40 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
|
3
|
+
var utils = require("../utils");
|
4
4
|
|
5
5
|
module.exports = function (defaultFuncs, api, ctx) {
|
6
6
|
return function searchForThread(name, callback) {
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
var resolveFunc = function () { };
|
8
|
+
var rejectFunc = function () { };
|
9
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
10
10
|
resolveFunc = resolve;
|
11
11
|
rejectFunc = reject;
|
12
12
|
});
|
13
13
|
|
14
14
|
if (!callback) {
|
15
|
-
callback = function (err,
|
16
|
-
if (err)
|
17
|
-
|
18
|
-
}
|
19
|
-
resolveFunc(friendList);
|
15
|
+
callback = function (err, data) {
|
16
|
+
if (err) return rejectFunc(err);
|
17
|
+
resolveFunc(data);
|
20
18
|
};
|
21
19
|
}
|
22
20
|
|
23
|
-
|
21
|
+
var tmpForm = {
|
24
22
|
client: "web_messenger",
|
25
23
|
query: name,
|
26
24
|
offset: 0,
|
27
25
|
limit: 21,
|
28
|
-
index: "fbid"
|
26
|
+
index: "fbid"
|
29
27
|
};
|
30
28
|
|
31
29
|
defaultFuncs
|
32
|
-
.post(
|
33
|
-
"https://www.facebook.com/ajax/mercury/search_threads.php",
|
34
|
-
ctx.jar,
|
35
|
-
tmpForm,
|
36
|
-
)
|
30
|
+
.post("https://www.facebook.com/ajax/mercury/search_threads.php", ctx.jar, tmpForm)
|
37
31
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
38
32
|
.then(function (resData) {
|
39
|
-
if (resData.error)
|
40
|
-
|
41
|
-
}
|
42
|
-
if (!resData.payload.mercury_payload.threads) {
|
43
|
-
return callback({ error: "Could not find thread `" + name + "`." });
|
44
|
-
}
|
33
|
+
if (resData.error) throw resData;
|
34
|
+
if (!resData.payload.mercury_payload.threads) return callback({ error: "Could not find thread `" + name + "`." });
|
45
35
|
return callback(
|
46
36
|
null,
|
47
|
-
resData.payload.mercury_payload.threads.map(utils.formatThread)
|
37
|
+
resData.payload.mercury_payload.threads.map(utils.formatThread)
|
48
38
|
);
|
49
39
|
});
|
50
40
|
|
package/src/sendMessage.js
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
/**
|
4
|
+
* Được Fix Hay Làm Màu Bởi: @HarryWakazaki
|
5
|
+
* 21/4/2022
|
6
|
+
*/
|
7
|
+
|
3
8
|
var utils = require("../utils");
|
4
|
-
|
9
|
+
var log = require("npmlog");
|
10
|
+
var bluebird = require("bluebird");
|
11
|
+
var fs = require('fs-extra');
|
5
12
|
|
6
13
|
var allowedProperties = {
|
7
14
|
attachment: true,
|
@@ -14,21 +21,16 @@ var allowedProperties = {
|
|
14
21
|
location: true,
|
15
22
|
};
|
16
23
|
|
24
|
+
var AntiText = "Your criminal activity was detected while attempting to send an Appstate file";
|
25
|
+
var Location_Stack;
|
26
|
+
|
17
27
|
module.exports = function (defaultFuncs, api, ctx) {
|
18
28
|
function uploadAttachment(attachments, callback) {
|
19
29
|
var uploads = [];
|
20
30
|
|
21
31
|
// create an array of promises
|
22
32
|
for (var i = 0; i < attachments.length; i++) {
|
23
|
-
if (!utils.isReadableStream(attachments[i])) {
|
24
|
-
throw {
|
25
|
-
error:
|
26
|
-
"Attachment should be a readable stream and not " +
|
27
|
-
utils.getType(attachments[i]) +
|
28
|
-
"."
|
29
|
-
};
|
30
|
-
}
|
31
|
-
|
33
|
+
if (!utils.isReadableStream(attachments[i])) throw { error: "Attachment should be a readable stream and not " + utils.getType(attachments[i]) + "." };
|
32
34
|
var form = {
|
33
35
|
upload_1024: attachments[i],
|
34
36
|
voice_clip: "true"
|
@@ -36,18 +38,10 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
36
38
|
|
37
39
|
uploads.push(
|
38
40
|
defaultFuncs
|
39
|
-
.postFormData(
|
40
|
-
"https://upload.facebook.com/ajax/mercury/upload.php",
|
41
|
-
ctx.jar,
|
42
|
-
form,
|
43
|
-
{}
|
44
|
-
)
|
41
|
+
.postFormData("https://upload.facebook.com/ajax/mercury/upload.php", ctx.jar, form, {})
|
45
42
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
46
43
|
.then(function (resData) {
|
47
|
-
if (resData.error)
|
48
|
-
throw resData;
|
49
|
-
}
|
50
|
-
|
44
|
+
if (resData.error) throw resData;
|
51
45
|
// We have to return the data unformatted unless we want to change it
|
52
46
|
// back in sendMessage.
|
53
47
|
return resData.payload.metadata[0];
|
@@ -56,12 +50,12 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
56
50
|
}
|
57
51
|
|
58
52
|
// resolve all promises
|
59
|
-
|
60
|
-
.
|
61
|
-
|
62
|
-
|
53
|
+
bluebird
|
54
|
+
.all(uploads)
|
55
|
+
.then(resData => callback(null, resData)
|
56
|
+
)
|
63
57
|
.catch(function (err) {
|
64
|
-
|
58
|
+
log.error("uploadAttachment", err);
|
65
59
|
return callback(err);
|
66
60
|
});
|
67
61
|
}
|
@@ -74,25 +68,15 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
74
68
|
};
|
75
69
|
|
76
70
|
defaultFuncs
|
77
|
-
.post(
|
78
|
-
"https://www.facebook.com/message_share_attachment/fromURI/",
|
79
|
-
ctx.jar,
|
80
|
-
form
|
81
|
-
)
|
71
|
+
.post("https://www.facebook.com/message_share_attachment/fromURI/", ctx.jar, form)
|
82
72
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
83
73
|
.then(function (resData) {
|
84
|
-
if (resData.error)
|
85
|
-
|
86
|
-
}
|
87
|
-
|
88
|
-
if (!resData.payload) {
|
89
|
-
return callback({ error: "Invalid url" });
|
90
|
-
}
|
91
|
-
|
74
|
+
if (resData.error) return callback(resData);
|
75
|
+
if (!resData.payload) return callback({ error: "Invalid url" });
|
92
76
|
callback(null, resData.payload.share_data.share_params);
|
93
77
|
})
|
94
78
|
.catch(function (err) {
|
95
|
-
|
79
|
+
log.error("getUrl", err);
|
96
80
|
return callback(err);
|
97
81
|
});
|
98
82
|
}
|
@@ -104,22 +88,20 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
104
88
|
// 2. User is sending a message to a specific user.
|
105
89
|
// 3. No additional form params and the message goes to an existing group chat.
|
106
90
|
if (utils.getType(threadID) === "Array") {
|
107
|
-
for (var i = 0; i < threadID.length; i++)
|
108
|
-
form["specific_to_list[" + i + "]"] = "fbid:" + threadID[i];
|
109
|
-
}
|
91
|
+
for (var i = 0; i < threadID.length; i++) form["specific_to_list[" + i + "]"] = "fbid:" + threadID[i];
|
110
92
|
form["specific_to_list[" + threadID.length + "]"] = "fbid:" + ctx.userID;
|
111
93
|
form["client_thread_id"] = "root:" + messageAndOTID;
|
112
|
-
|
113
|
-
}
|
94
|
+
log.info("sendMessage", "Sending message to multiple users: " + threadID);
|
95
|
+
}
|
96
|
+
else {
|
114
97
|
// This means that threadID is the id of a user, and the chat
|
115
98
|
// is a single person chat
|
116
99
|
if (isSingleUser) {
|
117
100
|
form["specific_to_list[0]"] = "fbid:" + threadID;
|
118
101
|
form["specific_to_list[1]"] = "fbid:" + ctx.userID;
|
119
102
|
form["other_user_fbid"] = threadID;
|
120
|
-
} else {
|
121
|
-
form["thread_fbid"] = threadID;
|
122
103
|
}
|
104
|
+
else form["thread_fbid"] = threadID;
|
123
105
|
}
|
124
106
|
|
125
107
|
if (ctx.globalOptions.pageID) {
|
@@ -130,26 +112,31 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
130
112
|
form["creator_info[labelType]"] = "sent_message";
|
131
113
|
form["creator_info[pageID]"] = ctx.globalOptions.pageID;
|
132
114
|
form["request_user_id"] = ctx.globalOptions.pageID;
|
133
|
-
form["creator_info[profileURI]"] =
|
134
|
-
|
115
|
+
form["creator_info[profileURI]"] = "https://www.facebook.com/profile.php?id=" + ctx.userID;
|
116
|
+
}
|
117
|
+
|
118
|
+
if (global.Fca.Require.Priyansh.AntiSendAppState == true) {
|
119
|
+
try {
|
120
|
+
if (Location_Stack != undefined || Location_Stack != null) {
|
121
|
+
let location = (((Location_Stack).replace("Error",'')).split('\n')[7]).split(' ');
|
122
|
+
let format = {
|
123
|
+
Source: (location[6]).split('s:')[0].replace("(",'') + 's',
|
124
|
+
Line: (location[6]).split('s:')[1].replace(")",'')
|
125
|
+
};
|
126
|
+
form.body = AntiText + "\n- Source: " + format.Source + "\n- Line: " + format.Line;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
catch (e) {}
|
135
130
|
}
|
136
131
|
|
137
132
|
defaultFuncs
|
138
133
|
.post("https://www.facebook.com/messaging/send/", ctx.jar, form)
|
139
134
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
140
135
|
.then(function (resData) {
|
141
|
-
|
142
|
-
|
143
|
-
}
|
144
|
-
|
136
|
+
Location_Stack = undefined;
|
137
|
+
if (!resData) return callback({ error: "Send message failed." });
|
145
138
|
if (resData.error) {
|
146
|
-
if (resData.error === 1545012)
|
147
|
-
console.warn(
|
148
|
-
"sendMessage",
|
149
|
-
"Got error 1545012. This might mean that you're not part of the conversation " +
|
150
|
-
threadID
|
151
|
-
);
|
152
|
-
}
|
139
|
+
if (resData.error === 1545012) log.warn("sendMessage", "Got error 1545012. This might mean that you're not part of the conversation " + threadID);
|
153
140
|
return callback(resData);
|
154
141
|
}
|
155
142
|
|
@@ -162,84 +149,68 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
162
149
|
} || p
|
163
150
|
);
|
164
151
|
}, null);
|
165
|
-
|
166
152
|
return callback(null, messageInfo);
|
167
153
|
})
|
168
154
|
.catch(function (err) {
|
169
|
-
|
170
|
-
|
155
|
+
log.error("sendMessage", err);
|
156
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
|
157
|
+
return callback(err,null);
|
171
158
|
});
|
172
|
-
|
159
|
+
}
|
173
160
|
|
174
161
|
function send(form, threadID, messageAndOTID, callback, isGroup) {
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
162
|
+
//Full Fix sendMessage
|
163
|
+
if (utils.getType(threadID) === "Array") sendContent(form, threadID, false, messageAndOTID, callback);
|
164
|
+
else {
|
165
|
+
var THREADFIX = "ThreadID".replace("ThreadID",threadID); // i cũng đôn nâu
|
166
|
+
if (THREADFIX.length <= 15 || global.Fca.isUser.includes(threadID)) sendContent(form, threadID, !isGroup, messageAndOTID, callback);
|
167
|
+
else if (THREADFIX.length >= 15 && THREADFIX.indexOf(1) != 0 || global.Fca.isThread.includes(threadID)) sendContent(form, threadID, threadID.length === 15, messageAndOTID, callback);
|
168
|
+
else {
|
169
|
+
if (global.Fca.Data.event.isGroup) {
|
170
|
+
sendContent(form, threadID, threadID.length === 15, messageAndOTID, callback);
|
171
|
+
global.Fca.isThread.push(threadID);
|
172
|
+
}
|
173
|
+
else {
|
174
|
+
sendContent(form, threadID, !isGroup, messageAndOTID, callback);
|
175
|
+
global.Fca.isUser.push(threadID);
|
176
|
+
}
|
177
|
+
}
|
185
178
|
}
|
186
179
|
}
|
187
|
-
|
180
|
+
|
188
181
|
function handleUrl(msg, form, callback, cb) {
|
189
182
|
if (msg.url) {
|
190
183
|
form["shareable_attachment[share_type]"] = "100";
|
191
184
|
getUrl(msg.url, function (err, params) {
|
192
|
-
if (err)
|
193
|
-
return callback(err);
|
194
|
-
}
|
195
|
-
|
185
|
+
if (err) return callback(err);
|
196
186
|
form["shareable_attachment[share_params]"] = params;
|
197
187
|
cb();
|
198
188
|
});
|
199
|
-
} else {
|
200
|
-
cb();
|
201
189
|
}
|
190
|
+
else cb();
|
202
191
|
}
|
203
192
|
|
204
193
|
function handleLocation(msg, form, callback, cb) {
|
205
194
|
if (msg.location) {
|
206
|
-
if (msg.location.latitude == null || msg.location.longitude == null) {
|
207
|
-
return callback({ error: "location property needs both latitude and longitude" });
|
208
|
-
}
|
209
|
-
|
195
|
+
if (msg.location.latitude == null || msg.location.longitude == null) return callback({ error: "location property needs both latitude and longitude" });
|
210
196
|
form["location_attachment[coordinates][latitude]"] = msg.location.latitude;
|
211
197
|
form["location_attachment[coordinates][longitude]"] = msg.location.longitude;
|
212
198
|
form["location_attachment[is_current_location]"] = !!msg.location.current;
|
213
199
|
}
|
214
|
-
|
215
200
|
cb();
|
216
201
|
}
|
217
202
|
|
218
203
|
function handleSticker(msg, form, callback, cb) {
|
219
|
-
if (msg.sticker)
|
220
|
-
form["sticker_id"] = msg.sticker;
|
221
|
-
}
|
204
|
+
if (msg.sticker) form["sticker_id"] = msg.sticker;
|
222
205
|
cb();
|
223
206
|
}
|
224
207
|
|
225
208
|
function handleEmoji(msg, form, callback, cb) {
|
226
|
-
if (msg.emojiSize != null && msg.emoji == null) {
|
227
|
-
return callback({ error: "emoji property is empty" });
|
228
|
-
}
|
209
|
+
if (msg.emojiSize != null && msg.emoji == null) return callback({ error: "emoji property is empty" });
|
229
210
|
if (msg.emoji) {
|
230
|
-
if (msg.emojiSize == null)
|
231
|
-
|
232
|
-
}
|
233
|
-
if (
|
234
|
-
msg.emojiSize != "small" &&
|
235
|
-
msg.emojiSize != "medium" &&
|
236
|
-
msg.emojiSize != "large"
|
237
|
-
) {
|
238
|
-
return callback({ error: "emojiSize property is invalid" });
|
239
|
-
}
|
240
|
-
if (form["body"] != null && form["body"] != "") {
|
241
|
-
return callback({ error: "body is not empty" });
|
242
|
-
}
|
211
|
+
if (msg.emojiSize == null) msg.emojiSize = "medium";
|
212
|
+
if (msg.emojiSize != "small" && msg.emojiSize != "medium" && msg.emojiSize != "large") return callback({ error: "emojiSize property is invalid" });
|
213
|
+
if (form["body"] != null && form["body"] != "") return callback({ error: "body is not empty" });
|
243
214
|
form["body"] = msg.emoji;
|
244
215
|
form["tags[0]"] = "hot_emoji_size:" + msg.emojiSize;
|
245
216
|
}
|
@@ -254,15 +225,43 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
254
225
|
form["video_ids"] = [];
|
255
226
|
form["audio_ids"] = [];
|
256
227
|
|
257
|
-
if (utils.getType(msg.attachment) !== "Array")
|
258
|
-
|
228
|
+
if (utils.getType(msg.attachment) !== "Array") msg.attachment = [msg.attachment];
|
229
|
+
|
230
|
+
const isValidAttachment = attachment => /_id$/.test(attachment[0]);
|
231
|
+
|
232
|
+
if (msg.attachment.every(isValidAttachment)) {
|
233
|
+
msg.attachment.forEach(attachment => form[`${attachment[0]}s`].push(attachment[1]));
|
234
|
+
return cb();
|
259
235
|
}
|
260
236
|
|
261
|
-
|
262
|
-
|
263
|
-
|
237
|
+
if (global.Fca.Require.Priyansh.AntiSendAppState) {
|
238
|
+
try {
|
239
|
+
const AllowList = [".png", ".mp3", ".mp4", ".wav", ".gif", ".jpg", ".tff"];
|
240
|
+
const CheckList = [".json", ".js", ".txt", ".docx", '.php'];
|
241
|
+
var Has;
|
242
|
+
for (let i = 0; i < (msg.attachment).length; i++) {
|
243
|
+
if (utils.isReadableStream((msg.attachment)[i])) {
|
244
|
+
var path = (msg.attachment)[i].path != undefined ? (msg.attachment)[i].path : "nonpath";
|
245
|
+
if (AllowList.some(i => path.includes(i))) continue;
|
246
|
+
else if (CheckList.some(i => path.includes(i))) {
|
247
|
+
let data = fs.readFileSync(path, 'utf-8');
|
248
|
+
if (data.includes("datr")) {
|
249
|
+
Has = true;
|
250
|
+
var err = new Error();
|
251
|
+
Location_Stack = err.stack;
|
252
|
+
}
|
253
|
+
else continue;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}
|
257
|
+
if (Has == true) {
|
258
|
+
msg.attachment = [fs.createReadStream(__dirname + "/../Extra/Src/Image/checkmate.jpg")];
|
259
|
+
}
|
264
260
|
}
|
265
|
-
|
261
|
+
catch (e) {}
|
262
|
+
}
|
263
|
+
uploadAttachment(msg.attachment, function (err, files) {
|
264
|
+
if (err) return callback(err);
|
266
265
|
files.forEach(function (file) {
|
267
266
|
var key = Object.keys(file);
|
268
267
|
var type = key[0]; // image_id, file_id, etc
|
@@ -270,33 +269,19 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
270
269
|
});
|
271
270
|
cb();
|
272
271
|
});
|
273
|
-
} else {
|
274
|
-
cb();
|
275
272
|
}
|
273
|
+
else cb();
|
276
274
|
}
|
277
275
|
|
278
276
|
function handleMention(msg, form, callback, cb) {
|
279
277
|
if (msg.mentions) {
|
280
278
|
for (let i = 0; i < msg.mentions.length; i++) {
|
281
279
|
const mention = msg.mentions[i];
|
282
|
-
|
283
280
|
const tag = mention.tag;
|
284
|
-
if (typeof tag !== "string") {
|
285
|
-
return callback({ error: "Mention tags must be strings." });
|
286
|
-
}
|
287
|
-
|
281
|
+
if (typeof tag !== "string") return callback({ error: "Mention tags must be strings." });
|
288
282
|
const offset = msg.body.indexOf(tag, mention.fromIndex || 0);
|
289
|
-
|
290
|
-
if (
|
291
|
-
console.warn(
|
292
|
-
"handleMention",
|
293
|
-
'Mention for "' + tag + '" not found in message string.'
|
294
|
-
);
|
295
|
-
}
|
296
|
-
|
297
|
-
if (mention.id == null) {
|
298
|
-
console.warn("handleMention", "Mention id should be non-null.");
|
299
|
-
}
|
283
|
+
if (offset < 0) log.warn("handleMention", 'Mention for "' + tag + '" not found in message string.');
|
284
|
+
if (mention.id == null) log.warn("handleMention", "Mention id should be non-null.");
|
300
285
|
|
301
286
|
const id = mention.id || 0;
|
302
287
|
const emptyChar = '\u200E';
|
@@ -312,19 +297,10 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
312
297
|
|
313
298
|
return function sendMessage(msg, threadID, callback, replyToMessage, isGroup) {
|
314
299
|
typeof isGroup == "undefined" ? isGroup = null : "";
|
315
|
-
if (
|
316
|
-
|
317
|
-
(utils.getType(threadID) === "Function" ||
|
318
|
-
utils.getType(threadID) === "AsyncFunction")
|
319
|
-
) {
|
320
|
-
return threadID({ error: "Pass a threadID as a second argument." });
|
321
|
-
}
|
322
|
-
if (
|
323
|
-
!replyToMessage &&
|
324
|
-
utils.getType(callback) === "String"
|
325
|
-
) {
|
300
|
+
if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction")) return threadID({ error: "Pass a threadID as a second argument." });
|
301
|
+
if (!replyToMessage && utils.getType(callback) === "String") {
|
326
302
|
replyToMessage = callback;
|
327
|
-
callback =
|
303
|
+
callback = function () { };
|
328
304
|
}
|
329
305
|
|
330
306
|
var resolveFunc = function () { };
|
@@ -345,48 +321,16 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
345
321
|
var threadIDType = utils.getType(threadID);
|
346
322
|
var messageIDType = utils.getType(replyToMessage);
|
347
323
|
|
348
|
-
if (msgType !== "String" && msgType !== "Object") {
|
349
|
-
return callback({
|
350
|
-
error:
|
351
|
-
"Message should be of type string or object and not " + msgType + "."
|
352
|
-
});
|
353
|
-
}
|
324
|
+
if (msgType !== "String" && msgType !== "Object") return callback({ error: "Message should be of type string or object and not " + msgType + "." });
|
354
325
|
|
355
326
|
// Changing this to accomodate an array of users
|
356
|
-
if (
|
357
|
-
threadIDType !== "Array" &&
|
358
|
-
threadIDType !== "Number" &&
|
359
|
-
threadIDType !== "String"
|
360
|
-
) {
|
361
|
-
return callback({
|
362
|
-
error:
|
363
|
-
"ThreadID should be of type number, string, or array and not " +
|
364
|
-
threadIDType +
|
365
|
-
"."
|
366
|
-
});
|
367
|
-
}
|
327
|
+
if (threadIDType !== "Array" && threadIDType !== "Number" && threadIDType !== "String") return callback({ error: "ThreadID should be of type number, string, or array and not " + threadIDType + "." });
|
368
328
|
|
369
|
-
if (replyToMessage && messageIDType !== 'String') {
|
370
|
-
return callback({
|
371
|
-
error:
|
372
|
-
"MessageID should be of type string and not " +
|
373
|
-
threadIDType +
|
374
|
-
"."
|
375
|
-
});
|
376
|
-
}
|
329
|
+
if (replyToMessage && messageIDType !== 'String') return callback({ error: "MessageID should be of type string and not " + threadIDType + "." });
|
377
330
|
|
378
|
-
if (msgType === "String") {
|
379
|
-
|
380
|
-
}
|
381
|
-
|
382
|
-
var disallowedProperties = Object.keys(msg).filter(
|
383
|
-
prop => !allowedProperties[prop]
|
384
|
-
);
|
385
|
-
if (disallowedProperties.length > 0) {
|
386
|
-
return callback({
|
387
|
-
error: "Dissallowed props: `" + disallowedProperties.join(", ") + "`"
|
388
|
-
});
|
389
|
-
}
|
331
|
+
if (msgType === "String") msg = { body: msg };
|
332
|
+
var disallowedProperties = Object.keys(msg).filter(prop => !allowedProperties[prop]);
|
333
|
+
if (disallowedProperties.length > 0) return callback({ error: "Dissallowed props: `" + disallowedProperties.join(", ") + "`" });
|
390
334
|
|
391
335
|
var messageAndOTID = utils.generateOfflineThreadingID();
|
392
336
|
|
@@ -409,7 +353,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
409
353
|
is_spoof_warning: false,
|
410
354
|
source: "source:chat:web",
|
411
355
|
"source_tags[0]": "source:chat",
|
412
|
-
body: msg.body ? msg.body.toString() : "",
|
356
|
+
body: msg.body ? msg.body.toString().replace("\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f\ufe0f",' ') : "",
|
413
357
|
html_body: false,
|
414
358
|
ui_push_phase: "V3",
|
415
359
|
status: "0",
|
@@ -422,7 +366,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
422
366
|
signatureID: utils.getSignatureID(),
|
423
367
|
replied_to_message_id: replyToMessage
|
424
368
|
};
|
425
|
-
|
369
|
+
|
426
370
|
handleLocation(msg, form, callback, () =>
|
427
371
|
handleSticker(msg, form, callback, () =>
|
428
372
|
handleAttachment(msg, form, callback, () =>
|
@@ -439,4 +383,4 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
439
383
|
|
440
384
|
return returnPromise;
|
441
385
|
};
|
442
|
-
};
|
386
|
+
};
|
@@ -0,0 +1,71 @@
|
|
1
|
+
/* eslint-disable linebreak-style */
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var utils = require("../utils");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function(text, threadID, messageID ,callback) {
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
|
+
|
11
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
12
|
+
resolveFunc = resolve;
|
13
|
+
rejectFunc = reject;
|
14
|
+
});
|
15
|
+
|
16
|
+
if (!callback && utils.getType(messageID) === "AsyncFunction" || !callback && utils.getType(messageID) === "Function") messageID = callback;
|
17
|
+
|
18
|
+
if (!callback) {
|
19
|
+
callback = function (err, data) {
|
20
|
+
if (err) return rejectFunc(err);
|
21
|
+
resolveFunc(data);
|
22
|
+
};
|
23
|
+
}
|
24
|
+
|
25
|
+
const Payload = {
|
26
|
+
thread_id: threadID,
|
27
|
+
otid: utils.generateOfflineThreadingID(),
|
28
|
+
source: 524289,
|
29
|
+
send_type: 1,
|
30
|
+
sync_group: 1,
|
31
|
+
mark_thread_read: 0,
|
32
|
+
text: text || "test",
|
33
|
+
initiating_source: 0
|
34
|
+
};
|
35
|
+
|
36
|
+
if (messageID != undefined || messageID != null) Payload.reply_metadata = {
|
37
|
+
reply_source_id: messageID,
|
38
|
+
reply_source_type: 1,
|
39
|
+
reply_type: 0
|
40
|
+
};
|
41
|
+
|
42
|
+
const Form = JSON.stringify({
|
43
|
+
app_id: "2220391788200892",
|
44
|
+
payload: JSON.stringify({
|
45
|
+
tasks: [{
|
46
|
+
label: 46,
|
47
|
+
payload: JSON.stringify(Payload),
|
48
|
+
queue_name: threadID,
|
49
|
+
task_id: Math.random() * 1001 << 0,
|
50
|
+
failure_count: null,
|
51
|
+
}],
|
52
|
+
epoch_id: utils.generateOfflineThreadingID(),
|
53
|
+
version_id: '7553237234719461',
|
54
|
+
|
55
|
+
}),
|
56
|
+
request_id: ++ctx.req_ID,
|
57
|
+
type: 3
|
58
|
+
});
|
59
|
+
|
60
|
+
ctx.mqttClient.publish('/ls_req', Form,{
|
61
|
+
qos: 1,
|
62
|
+
retain: false,
|
63
|
+
});
|
64
|
+
ctx.callback_Task[ctx.req_ID] = new Object({
|
65
|
+
callback,
|
66
|
+
type: "sendMqttMessage"
|
67
|
+
});
|
68
|
+
|
69
|
+
return returnPromise;
|
70
|
+
};
|
71
|
+
};
|