meta-fca 2.4.9 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Extra/Database/index.js +3 -3
- package/package.json +1 -1
- package/src/sendMessage.js +161 -210
package/Extra/Database/index.js
CHANGED
@@ -7,9 +7,9 @@ const fs = require('fs-extra');
|
|
7
7
|
const request = require('request');
|
8
8
|
const deasync = require('deasync');
|
9
9
|
|
10
|
-
if (!fs.existsSync(process.cwd() + '/
|
11
|
-
fs.mkdirSync(process.cwd() + '/
|
12
|
-
fs.writeFileSync(process.cwd() + '/
|
10
|
+
if (!fs.existsSync(process.cwd() + '/includes/database')) {
|
11
|
+
fs.mkdirSync(process.cwd() + '/includes/database');
|
12
|
+
fs.writeFileSync(process.cwd() + '/includes/database/A_README.md', 'This folder is used by ChernobyL(NANI =)) ) to store data. Do not delete this folder or any of the files in it.', 'utf8');
|
13
13
|
}
|
14
14
|
var db = new BetterDB(process.cwd() + "/includes/database/metaFca.sqlite");
|
15
15
|
|
package/package.json
CHANGED
package/src/sendMessage.js
CHANGED
@@ -1,26 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
/**
|
4
|
-
* Được Fix Hay Làm Màu Bởi: @HarryWakazaki | @Kem
|
5
|
-
* 21/4/2022
|
6
|
-
*/
|
7
|
-
|
8
|
-
// var { getFont } = require("../font-handler");
|
9
3
|
var utils = require("../utils");
|
10
4
|
var log = require("npmlog");
|
11
5
|
var bluebird = require("bluebird");
|
12
|
-
var fs = require('fs-extra');
|
13
|
-
|
14
|
-
/!-[ Custom Font ]-!/
|
15
|
-
if (global.Fca.Require.FastConfig.CustomFont) {
|
16
|
-
var horizon = {
|
17
|
-
CustomFont: true
|
18
|
-
}
|
19
|
-
} else {
|
20
|
-
var horizon = {
|
21
|
-
CustomFont: false
|
22
|
-
}
|
23
|
-
}
|
24
6
|
|
25
7
|
var allowedProperties = {
|
26
8
|
attachment: true,
|
@@ -31,105 +13,50 @@ var allowedProperties = {
|
|
31
13
|
body: true,
|
32
14
|
mentions: true,
|
33
15
|
location: true,
|
34
|
-
font: true
|
35
16
|
};
|
36
17
|
|
37
|
-
|
38
|
-
var Location_Stack;
|
39
|
-
|
40
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
41
|
-
let font = {
|
42
|
-
a: "𝖺",
|
43
|
-
b: "𝖻",
|
44
|
-
c: "𝖼",
|
45
|
-
d: "𝖽",
|
46
|
-
e: "𝖾",
|
47
|
-
f: "𝖿",
|
48
|
-
g: "𝗀",
|
49
|
-
h: "𝗁",
|
50
|
-
i: "𝗂",
|
51
|
-
j: "𝗃",
|
52
|
-
k: "𝗄",
|
53
|
-
l: "𝗅",
|
54
|
-
m: "𝗆",
|
55
|
-
n: "𝗇",
|
56
|
-
o: "𝗈",
|
57
|
-
p: "𝗉",
|
58
|
-
q: "𝗊",
|
59
|
-
r: "𝗋",
|
60
|
-
s: "𝗌",
|
61
|
-
t: "𝗍",
|
62
|
-
u: "𝗎",
|
63
|
-
v: "𝗏",
|
64
|
-
w: "𝗐",
|
65
|
-
x: "𝗑",
|
66
|
-
y: "𝗒",
|
67
|
-
z: "𝗓",
|
68
|
-
A: "𝖠",
|
69
|
-
B: "𝖡",
|
70
|
-
C: "𝖢",
|
71
|
-
D: "𝖣",
|
72
|
-
E: "𝖤",
|
73
|
-
F: "𝖥",
|
74
|
-
G: "𝖦",
|
75
|
-
H: "𝖧",
|
76
|
-
I: "𝖨",
|
77
|
-
J: "𝖩",
|
78
|
-
K: "𝖪",
|
79
|
-
L: "𝖫",
|
80
|
-
M: "𝖬",
|
81
|
-
N: "𝖭",
|
82
|
-
O: "𝖮",
|
83
|
-
P: "𝖯",
|
84
|
-
Q: "𝖰",
|
85
|
-
R: "𝖱",
|
86
|
-
S: "𝖲",
|
87
|
-
T: "𝖳",
|
88
|
-
U: "𝖴",
|
89
|
-
V: "𝖵",
|
90
|
-
W: "𝖶",
|
91
|
-
X: "𝖷",
|
92
|
-
Y: "𝖸",
|
93
|
-
Z: "𝖹",
|
94
|
-
};
|
95
|
-
function replaceCharacters(inputString) {
|
96
|
-
const replacedString = inputString.replace(/[A-Za-z]/g, (char) => {
|
97
|
-
return font[char] || char;
|
98
|
-
});
|
99
|
-
return replacedString;
|
100
|
-
}
|
101
|
-
// 8/12/2023
|
102
|
-
// module.exports = function (defaultFuncs, api, ctx) {
|
18
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
103
19
|
function uploadAttachment(attachments, callback) {
|
104
20
|
var uploads = [];
|
105
21
|
|
106
22
|
// create an array of promises
|
107
23
|
for (var i = 0; i < attachments.length; i++) {
|
108
|
-
if (!utils.isReadableStream(attachments[i]))
|
24
|
+
if (!utils.isReadableStream(attachments[i]))
|
25
|
+
throw {
|
26
|
+
error:
|
27
|
+
"Attachment should be a readable stream and not " +
|
28
|
+
utils.getType(attachments[i]) +
|
29
|
+
".",
|
30
|
+
};
|
109
31
|
var form = {
|
110
32
|
upload_1024: attachments[i],
|
111
|
-
voice_clip: "true"
|
33
|
+
voice_clip: "true",
|
112
34
|
};
|
113
35
|
|
114
36
|
uploads.push(
|
115
37
|
defaultFuncs
|
116
|
-
.postFormData(
|
38
|
+
.postFormData(
|
39
|
+
"https://upload.facebook.com/ajax/mercury/upload.php",
|
40
|
+
ctx.jar,
|
41
|
+
form,
|
42
|
+
{},
|
43
|
+
{},
|
44
|
+
)
|
117
45
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
118
|
-
.then(function(resData) {
|
46
|
+
.then(function (resData) {
|
119
47
|
if (resData.error) throw resData;
|
120
48
|
// We have to return the data unformatted unless we want to change it
|
121
49
|
// back in sendMessage.
|
122
50
|
return resData.payload.metadata[0];
|
123
|
-
})
|
51
|
+
}),
|
124
52
|
);
|
125
53
|
}
|
126
54
|
|
127
55
|
// resolve all promises
|
128
56
|
bluebird
|
129
57
|
.all(uploads)
|
130
|
-
.then(resData => callback(null, resData)
|
131
|
-
)
|
132
|
-
.catch(function(err) {
|
58
|
+
.then((resData) => callback(null, resData))
|
59
|
+
.catch(function (err) {
|
133
60
|
log.error("uploadAttachment", err);
|
134
61
|
return callback(err);
|
135
62
|
});
|
@@ -139,18 +66,22 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
139
66
|
var form = {
|
140
67
|
image_height: 960,
|
141
68
|
image_width: 960,
|
142
|
-
uri: url
|
69
|
+
uri: url,
|
143
70
|
};
|
144
71
|
|
145
72
|
defaultFuncs
|
146
|
-
.post(
|
73
|
+
.post(
|
74
|
+
"https://www.facebook.com/message_share_attachment/fromURI/",
|
75
|
+
ctx.jar,
|
76
|
+
form,
|
77
|
+
)
|
147
78
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
148
|
-
.then(function(resData) {
|
79
|
+
.then(function (resData) {
|
149
80
|
if (resData.error) return callback(resData);
|
150
81
|
if (!resData.payload) return callback({ error: "Invalid url" });
|
151
82
|
callback(null, resData.payload.share_data.share_params);
|
152
83
|
})
|
153
|
-
.catch(function(err) {
|
84
|
+
.catch(function (err) {
|
154
85
|
log.error("getUrl", err);
|
155
86
|
return callback(err);
|
156
87
|
});
|
@@ -163,20 +94,19 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
163
94
|
// 2. User is sending a message to a specific user.
|
164
95
|
// 3. No additional form params and the message goes to an existing group chat.
|
165
96
|
if (utils.getType(threadID) === "Array") {
|
166
|
-
for (var i = 0; i < threadID.length; i++)
|
97
|
+
for (var i = 0; i < threadID.length; i++)
|
98
|
+
form["specific_to_list[" + i + "]"] = "fbid:" + threadID[i];
|
167
99
|
form["specific_to_list[" + threadID.length + "]"] = "fbid:" + ctx.userID;
|
168
100
|
form["client_thread_id"] = "root:" + messageAndOTID;
|
169
101
|
log.info("sendMessage", "Sending message to multiple users: " + threadID);
|
170
|
-
}
|
171
|
-
else {
|
102
|
+
} else {
|
172
103
|
// This means that threadID is the id of a user, and the chat
|
173
104
|
// is a single person chat
|
174
105
|
if (isSingleUser) {
|
175
106
|
form["specific_to_list[0]"] = "fbid:" + threadID;
|
176
107
|
form["specific_to_list[1]"] = "fbid:" + ctx.userID;
|
177
108
|
form["other_user_fbid"] = threadID;
|
178
|
-
}
|
179
|
-
else form["thread_fbid"] = threadID;
|
109
|
+
} else form["thread_fbid"] = threadID;
|
180
110
|
}
|
181
111
|
|
182
112
|
if (ctx.globalOptions.pageID) {
|
@@ -187,89 +117,88 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
187
117
|
form["creator_info[labelType]"] = "sent_message";
|
188
118
|
form["creator_info[pageID]"] = ctx.globalOptions.pageID;
|
189
119
|
form["request_user_id"] = ctx.globalOptions.pageID;
|
190
|
-
form["creator_info[profileURI]"] =
|
191
|
-
|
192
|
-
|
193
|
-
if (global.Fca.Require.FastConfig.AntiSendAppState == true) {
|
194
|
-
try {
|
195
|
-
if (Location_Stack != undefined || Location_Stack != null) {
|
196
|
-
let location = (((Location_Stack).replace("Error",'')).split('\n')[7]).split(' ');
|
197
|
-
let format = {
|
198
|
-
Source: (location[6]).split('s:')[0].replace("(", '') + 's',
|
199
|
-
Line: (location[6]).split('s:')[1].replace(")", '')
|
200
|
-
};
|
201
|
-
form.body = AntiText + "\n- Source: " + format.Source + "\n- Line: " + format.Line;
|
202
|
-
}
|
203
|
-
}
|
204
|
-
catch (e) {}
|
120
|
+
form["creator_info[profileURI]"] =
|
121
|
+
"https://www.facebook.com/profile.php?id=" + ctx.userID;
|
205
122
|
}
|
206
123
|
|
207
124
|
defaultFuncs
|
208
125
|
.post("https://www.facebook.com/messaging/send/", ctx.jar, form)
|
209
126
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
210
|
-
.then(function(resData) {
|
211
|
-
Location_Stack = undefined;
|
127
|
+
.then(function (resData) {
|
212
128
|
if (!resData) return callback({ error: "Send message failed." });
|
213
129
|
if (resData.error) {
|
214
|
-
if (resData.error === 1545012)
|
130
|
+
if (resData.error === 1545012) {
|
131
|
+
log.warn(
|
132
|
+
"sendMessage",
|
133
|
+
"Got error 1545012. This might mean that you're not part of the conversation " +
|
134
|
+
threadID,
|
135
|
+
);
|
136
|
+
} else {
|
137
|
+
log.error("sendMessage", resData);
|
138
|
+
}
|
215
139
|
return callback(resData);
|
216
140
|
}
|
217
141
|
|
218
|
-
var messageInfo = resData.payload.actions.reduce(function(p, v) {
|
142
|
+
var messageInfo = resData.payload.actions.reduce(function (p, v) {
|
219
143
|
return (
|
220
144
|
{
|
221
145
|
threadID: v.thread_fbid,
|
222
146
|
messageID: v.message_id,
|
223
|
-
timestamp: v.timestamp
|
147
|
+
timestamp: v.timestamp,
|
224
148
|
} || p
|
225
149
|
);
|
226
150
|
}, null);
|
151
|
+
|
227
152
|
return callback(null, messageInfo);
|
228
153
|
})
|
229
|
-
.catch(function(err) {
|
154
|
+
.catch(function (err) {
|
230
155
|
log.error("sendMessage", err);
|
231
|
-
if (utils.getType(err) == "Object" && err.error === "Not logged in.")
|
232
|
-
|
156
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in.")
|
157
|
+
ctx.loggedIn = false;
|
158
|
+
return callback(err);
|
233
159
|
});
|
234
|
-
|
160
|
+
}
|
235
161
|
|
236
162
|
function send(form, threadID, messageAndOTID, callback, isGroup) {
|
237
|
-
//
|
238
|
-
|
163
|
+
// We're doing a query to this to check if the given id is the id of
|
164
|
+
// a user or of a group chat. The form will be different depending
|
165
|
+
// on that.
|
166
|
+
if (utils.getType(threadID) === "Array")
|
167
|
+
sendContent(form, threadID, false, messageAndOTID, callback);
|
239
168
|
else {
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
sendContent(form, threadID, !isGroup, messageAndOTID, callback);
|
250
|
-
global.Fca.isUser.push(threadID);
|
251
|
-
}
|
252
|
-
}
|
169
|
+
if (utils.getType(isGroup) != "Boolean")
|
170
|
+
sendContent(
|
171
|
+
form,
|
172
|
+
threadID,
|
173
|
+
threadID.length === 15,
|
174
|
+
messageAndOTID,
|
175
|
+
callback,
|
176
|
+
);
|
177
|
+
else sendContent(form, threadID, !isGroup, messageAndOTID, callback);
|
253
178
|
}
|
254
179
|
}
|
255
|
-
|
180
|
+
|
256
181
|
function handleUrl(msg, form, callback, cb) {
|
257
182
|
if (msg.url) {
|
258
183
|
form["shareable_attachment[share_type]"] = "100";
|
259
|
-
getUrl(msg.url, function(err, params) {
|
184
|
+
getUrl(msg.url, function (err, params) {
|
260
185
|
if (err) return callback(err);
|
261
186
|
form["shareable_attachment[share_params]"] = params;
|
262
187
|
cb();
|
263
188
|
});
|
264
|
-
}
|
265
|
-
else cb();
|
189
|
+
} else cb();
|
266
190
|
}
|
267
191
|
|
268
192
|
function handleLocation(msg, form, callback, cb) {
|
269
193
|
if (msg.location) {
|
270
|
-
if (msg.location.latitude == null || msg.location.longitude == null)
|
271
|
-
|
272
|
-
|
194
|
+
if (msg.location.latitude == null || msg.location.longitude == null)
|
195
|
+
return callback({
|
196
|
+
error: "location property needs both latitude and longitude",
|
197
|
+
});
|
198
|
+
form["location_attachment[coordinates][latitude]"] =
|
199
|
+
msg.location.latitude;
|
200
|
+
form["location_attachment[coordinates][longitude]"] =
|
201
|
+
msg.location.longitude;
|
273
202
|
form["location_attachment[is_current_location]"] = !!msg.location.current;
|
274
203
|
}
|
275
204
|
cb();
|
@@ -281,11 +210,18 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
281
210
|
}
|
282
211
|
|
283
212
|
function handleEmoji(msg, form, callback, cb) {
|
284
|
-
if (msg.emojiSize != null && msg.emoji == null)
|
213
|
+
if (msg.emojiSize != null && msg.emoji == null)
|
214
|
+
return callback({ error: "emoji property is empty" });
|
285
215
|
if (msg.emoji) {
|
286
216
|
if (msg.emojiSize == null) msg.emojiSize = "medium";
|
287
|
-
if (
|
288
|
-
|
217
|
+
if (
|
218
|
+
msg.emojiSize != "small" &&
|
219
|
+
msg.emojiSize != "medium" &&
|
220
|
+
msg.emojiSize != "large"
|
221
|
+
)
|
222
|
+
return callback({ error: "emojiSize property is invalid" });
|
223
|
+
if (form["body"] != null && form["body"] != "")
|
224
|
+
return callback({ error: "body is not empty" });
|
289
225
|
form["body"] = msg.emoji;
|
290
226
|
form["tags[0]"] = "hot_emoji_size:" + msg.emojiSize;
|
291
227
|
}
|
@@ -300,36 +236,15 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
300
236
|
form["video_ids"] = [];
|
301
237
|
form["audio_ids"] = [];
|
302
238
|
|
303
|
-
if (utils.getType(msg.attachment) !== "Array")
|
304
|
-
|
305
|
-
if (
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
var Has;
|
310
|
-
for (let i = 0; i < (msg.attachment).length; i++) {
|
311
|
-
if (utils.isReadableStream((msg.attachment)[i])) {
|
312
|
-
var path = (msg.attachment)[i].path != undefined ? (msg.attachment)[i].path : "nonpath";
|
313
|
-
if (AllowList.some(i => path.includes(i))) continue;
|
314
|
-
else if (CheckList.some(i => path.includes(i))) {
|
315
|
-
let data = fs.readFileSync(path, 'utf-8');
|
316
|
-
if (data.includes("datr")) {
|
317
|
-
Has = true;
|
318
|
-
var err = new Error();
|
319
|
-
Location_Stack = err.stack;
|
320
|
-
}
|
321
|
-
else continue;
|
322
|
-
}
|
323
|
-
}
|
324
|
-
}
|
325
|
-
if (Has == true) {
|
326
|
-
msg.attachment = [fs.createReadStream(__dirname + "/../Extra/Src/Image/checkmate.jpg")];
|
327
|
-
}
|
328
|
-
}
|
329
|
-
catch (e) {}
|
239
|
+
if (utils.getType(msg.attachment) !== "Array")
|
240
|
+
msg.attachment = [msg.attachment];
|
241
|
+
if (msg.attachment.every((e) => /_id$/.test(e[0]))) {
|
242
|
+
//console.log(msg.attachment)
|
243
|
+
msg.attachment.map((e) => form[`${e[0]}s`].push(e[1]));
|
244
|
+
return cb();
|
330
245
|
}
|
331
246
|
uploadAttachment(msg.attachment, function (err, files) {
|
332
|
-
|
247
|
+
if (err) return callback(err);
|
333
248
|
files.forEach(function (file) {
|
334
249
|
var key = Object.keys(file);
|
335
250
|
var type = key[0]; // image_id, file_id, etc
|
@@ -337,8 +252,7 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
337
252
|
});
|
338
253
|
cb();
|
339
254
|
});
|
340
|
-
}
|
341
|
-
else cb();
|
255
|
+
} else cb();
|
342
256
|
}
|
343
257
|
|
344
258
|
function handleMention(msg, form, callback, cb) {
|
@@ -346,13 +260,19 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
346
260
|
for (let i = 0; i < msg.mentions.length; i++) {
|
347
261
|
const mention = msg.mentions[i];
|
348
262
|
const tag = mention.tag;
|
349
|
-
if (typeof tag !== "string")
|
263
|
+
if (typeof tag !== "string")
|
264
|
+
return callback({ error: "Mention tags must be strings." });
|
350
265
|
const offset = msg.body.indexOf(tag, mention.fromIndex || 0);
|
351
|
-
if (offset < 0)
|
352
|
-
|
266
|
+
if (offset < 0)
|
267
|
+
log.warn(
|
268
|
+
"handleMention",
|
269
|
+
'Mention for "' + tag + '" not found in message string.',
|
270
|
+
);
|
271
|
+
if (mention.id == null)
|
272
|
+
log.warn("handleMention", "Mention id should be non-null.");
|
353
273
|
|
354
274
|
const id = mention.id || 0;
|
355
|
-
const emptyChar =
|
275
|
+
const emptyChar = "\u200E";
|
356
276
|
form["body"] = emptyChar + msg.body;
|
357
277
|
form["profile_xmd[" + i + "][offset]"] = offset + 1;
|
358
278
|
form["profile_xmd[" + i + "][length]"] = tag.length;
|
@@ -363,23 +283,34 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
363
283
|
cb();
|
364
284
|
}
|
365
285
|
|
366
|
-
return function sendMessage(
|
367
|
-
|
368
|
-
|
286
|
+
return function sendMessage(
|
287
|
+
msg,
|
288
|
+
threadID,
|
289
|
+
callback,
|
290
|
+
replyToMessage,
|
291
|
+
isGroup,
|
292
|
+
) {
|
293
|
+
typeof isGroup == "undefined" ? (isGroup = null) : "";
|
294
|
+
if (
|
295
|
+
!callback &&
|
296
|
+
(utils.getType(threadID) === "Function" ||
|
297
|
+
utils.getType(threadID) === "AsyncFunction")
|
298
|
+
)
|
299
|
+
return threadID({ error: "Pass a threadID as a second argument." });
|
369
300
|
if (!replyToMessage && utils.getType(callback) === "String") {
|
370
301
|
replyToMessage = callback;
|
371
|
-
callback = function() {
|
302
|
+
callback = function () {};
|
372
303
|
}
|
373
304
|
|
374
|
-
var resolveFunc = function() {
|
375
|
-
var rejectFunc = function() {
|
376
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
305
|
+
var resolveFunc = function () {};
|
306
|
+
var rejectFunc = function () {};
|
307
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
377
308
|
resolveFunc = resolve;
|
378
309
|
rejectFunc = reject;
|
379
310
|
});
|
380
311
|
|
381
312
|
if (!callback) {
|
382
|
-
callback = function(err, data) {
|
313
|
+
callback = function (err, data) {
|
383
314
|
if (err) return rejectFunc(err);
|
384
315
|
resolveFunc(data);
|
385
316
|
};
|
@@ -389,16 +320,39 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
389
320
|
var threadIDType = utils.getType(threadID);
|
390
321
|
var messageIDType = utils.getType(replyToMessage);
|
391
322
|
|
392
|
-
if (msgType !== "String" && msgType !== "Object")
|
323
|
+
if (msgType !== "String" && msgType !== "Object")
|
324
|
+
return callback({
|
325
|
+
error:
|
326
|
+
"Message should be of type string or object and not " + msgType + ".",
|
327
|
+
});
|
393
328
|
|
394
329
|
// Changing this to accomodate an array of users
|
395
|
-
if (
|
330
|
+
if (
|
331
|
+
threadIDType !== "Array" &&
|
332
|
+
threadIDType !== "Number" &&
|
333
|
+
threadIDType !== "String"
|
334
|
+
)
|
335
|
+
return callback({
|
336
|
+
error:
|
337
|
+
"ThreadID should be of type number, string, or array and not " +
|
338
|
+
threadIDType +
|
339
|
+
".",
|
340
|
+
});
|
396
341
|
|
397
|
-
if (replyToMessage && messageIDType !==
|
342
|
+
if (replyToMessage && messageIDType !== "String")
|
343
|
+
return callback({
|
344
|
+
error:
|
345
|
+
"MessageID should be of type string and not " + threadIDType + ".",
|
346
|
+
});
|
398
347
|
|
399
348
|
if (msgType === "String") msg = { body: msg };
|
400
|
-
var disallowedProperties = Object.keys(msg).filter(
|
401
|
-
|
349
|
+
var disallowedProperties = Object.keys(msg).filter(
|
350
|
+
(prop) => !allowedProperties[prop],
|
351
|
+
);
|
352
|
+
if (disallowedProperties.length > 0)
|
353
|
+
return callback({
|
354
|
+
error: "Dissallowed props: `" + disallowedProperties.join(", ") + "`",
|
355
|
+
});
|
402
356
|
|
403
357
|
var messageAndOTID = utils.generateOfflineThreadingID();
|
404
358
|
|
@@ -421,9 +375,7 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
421
375
|
is_spoof_warning: false,
|
422
376
|
source: "source:chat:web",
|
423
377
|
"source_tags[0]": "source:chat",
|
424
|
-
|
425
|
-
// body: msg.body ? replaceCharacters(msg.body.toString()) : "",
|
426
|
-
body: msg.body ? horizon.CustomFont ? replaceCharacters(msg.body.toString()) : 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", ' ') : "",
|
378
|
+
body: msg.body ? msg.body.toString() : "",
|
427
379
|
html_body: false,
|
428
380
|
ui_push_phase: "V3",
|
429
381
|
status: "0",
|
@@ -434,23 +386,22 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
434
386
|
manual_retry_cnt: "0",
|
435
387
|
has_attachment: !!(msg.attachment || msg.url || msg.sticker),
|
436
388
|
signatureID: utils.getSignatureID(),
|
437
|
-
replied_to_message_id: replyToMessage
|
389
|
+
replied_to_message_id: replyToMessage,
|
438
390
|
};
|
439
|
-
|
391
|
+
|
440
392
|
handleLocation(msg, form, callback, () =>
|
441
393
|
handleSticker(msg, form, callback, () =>
|
442
394
|
handleAttachment(msg, form, callback, () =>
|
443
395
|
handleUrl(msg, form, callback, () =>
|
444
396
|
handleEmoji(msg, form, callback, () =>
|
445
397
|
handleMention(msg, form, callback, () =>
|
446
|
-
send(form, threadID, messageAndOTID, callback, isGroup)
|
447
|
-
)
|
448
|
-
)
|
449
|
-
)
|
450
|
-
)
|
451
|
-
)
|
398
|
+
send(form, threadID, messageAndOTID, callback, isGroup),
|
399
|
+
),
|
400
|
+
),
|
401
|
+
),
|
402
|
+
),
|
403
|
+
),
|
452
404
|
);
|
453
|
-
|
454
405
|
return returnPromise;
|
455
406
|
};
|
456
407
|
};
|