meta-horizonn 1.2.7 → 1.3.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/Html/Classic/script.js +38 -33
- package/Extra/Src/Check_Update.js +13 -13
- package/Extra/Src/Instant_Update.js +12 -12
- package/Main.js +5 -9
- package/README.md +37 -40
- package/broadcast.js +10 -0
- package/font-handler.js +25 -3
- package/index.js +8 -8
- package/logger.js +52 -3
- package/package.json +1 -1
- package/src/sendMessage.js +14 -6
- package/utils.js +55 -55
@@ -13,45 +13,48 @@ c.height = 100; // Set to font size
|
|
13
13
|
|
14
14
|
var whitePixels = [];
|
15
15
|
var points = [];
|
16
|
-
var point = function(x,y,vx,vy){
|
16
|
+
var point = function(x, y, vx, vy) {
|
17
17
|
this.x = x;
|
18
18
|
this.y = y;
|
19
19
|
this.vx = vx || 1;
|
20
20
|
this.vy = vy || 1;
|
21
21
|
};
|
22
|
+
|
22
23
|
point.prototype.update = function() {
|
23
24
|
ctx.beginPath();
|
24
25
|
ctx.fillStyle = "#95a5a6";
|
25
|
-
ctx.arc(this.x,this.y,1,0,2*Math.PI);
|
26
|
+
ctx.arc(this.x, this.y, 1, 0, 2 * Math.PI);
|
26
27
|
ctx.fill();
|
27
28
|
ctx.closePath();
|
28
29
|
|
29
30
|
// Change direction if running into black pixel
|
30
|
-
if (this.x+this.vx >= c.width || this.x+this.vx < 0 || mask.data[coordsToI(this.x+this.vx, this.y, mask.width)] != 255) {
|
31
|
+
if (this.x + this.vx >= c.width || this.x + this.vx < 0 || mask.data[coordsToI(this.x + this.vx, this.y, mask.width)] != 255) {
|
31
32
|
this.vx *= -1;
|
32
|
-
this.x += this.vx*2;
|
33
|
-
}
|
34
|
-
|
33
|
+
this.x += this.vx * 2;
|
34
|
+
};
|
35
|
+
|
36
|
+
if (this.y + this.vy >= c.height || this.y + this.vy < 0 || mask.data[coordsToI(this.x, this.y + this.vy, mask.width)] != 255) {
|
35
37
|
this.vy *= -1;
|
36
|
-
this.y += this.vy*2;
|
38
|
+
this.y += this.vy * 2;
|
37
39
|
}
|
38
40
|
|
39
|
-
for (var k = 0, m = points.length; k<m; k++) {
|
41
|
+
for (var k = 0, m = points.length; k < m; k++) {
|
40
42
|
if (points[k]===this) continue;
|
41
43
|
|
42
|
-
var d = Math.sqrt(Math.pow(this.x-points[k].x,2)+Math.pow(this.y-points[k].y,2));
|
44
|
+
var d = Math.sqrt(Math.pow(this.x - points[k].x, 2) + Math.pow(this.y - points[k].y, 2));
|
43
45
|
if (d < 5) {
|
44
46
|
ctx.lineWidth = .2;
|
45
47
|
ctx.beginPath();
|
46
|
-
ctx.moveTo(this.x,this.y);
|
47
|
-
ctx.lineTo(points[k].x,points[k].y);
|
48
|
+
ctx.moveTo(this.x, this.y);
|
49
|
+
ctx.lineTo(points[k].x, points[k].y);
|
48
50
|
ctx.stroke();
|
49
51
|
}
|
52
|
+
|
50
53
|
if (d < 20) {
|
51
54
|
ctx.lineWidth = .1;
|
52
55
|
ctx.beginPath();
|
53
|
-
ctx.moveTo(this.x,this.y);
|
54
|
-
ctx.lineTo(points[k].x,points[k].y);
|
56
|
+
ctx.moveTo(this.x, this.y);
|
57
|
+
ctx.lineTo(points[k].x, points[k].y);
|
55
58
|
ctx.stroke();
|
56
59
|
}
|
57
60
|
}
|
@@ -61,7 +64,7 @@ point.prototype.update = function() {
|
|
61
64
|
};
|
62
65
|
|
63
66
|
function loop() {
|
64
|
-
ctx.clearRect(0,0,c.width,c.height);
|
67
|
+
ctx.clearRect(0, 0, c.width, c.height);
|
65
68
|
for (var k = 0, m = points.length; k < m; k++) {
|
66
69
|
points[k].update();
|
67
70
|
}
|
@@ -71,24 +74,24 @@ function init() {
|
|
71
74
|
// Draw text
|
72
75
|
ctx.beginPath();
|
73
76
|
ctx.fillStyle = "#000";
|
74
|
-
ctx.rect(0,0,c.width,c.height);
|
77
|
+
ctx.rect(0, 0, c.width, c.height);
|
75
78
|
ctx.fill();
|
76
79
|
ctx.font = fontStr;
|
77
80
|
ctx.textAlign = "left";
|
78
81
|
ctx.fillStyle = "#fff";
|
79
|
-
ctx.fillText(str,0,c.height/2+(c.height / 2));
|
82
|
+
ctx.fillText(str, 0, c.height / 2 + (c.height / 2));
|
80
83
|
ctx.closePath();
|
81
84
|
|
82
85
|
// Save mask
|
83
|
-
mask = ctx.getImageData(0,0,c.width,c.height);
|
86
|
+
mask = ctx.getImageData(0, 0, c.width, c.height);
|
84
87
|
|
85
88
|
// Draw background
|
86
|
-
ctx.clearRect(0,0,c.width,c.height);
|
89
|
+
ctx.clearRect(0, 0, c.width, c.height);
|
87
90
|
|
88
91
|
// Save all white pixels in an array
|
89
92
|
for (var i = 0; i < mask.data.length; i += 4) {
|
90
|
-
if (mask.data[i] == 255 && mask.data[i+1] == 255 && mask.data[i+2] == 255 && mask.data[i+3] == 255) {
|
91
|
-
whitePixels.push([iToX(i,mask.width),iToY(i,mask.width)]);
|
93
|
+
if (mask.data[i] == 255 && mask.data[i + 1] == 255 && mask.data[i + 2] == 255 && mask.data[i + 3] == 255) {
|
94
|
+
whitePixels.push([iToX(i, mask.width), iToY(i, mask.width)]);
|
92
95
|
}
|
93
96
|
}
|
94
97
|
|
@@ -98,22 +101,24 @@ function init() {
|
|
98
101
|
}
|
99
102
|
|
100
103
|
function addPoint() {
|
101
|
-
var spawn = whitePixels[Math.floor(Math.random()*whitePixels.length)];
|
104
|
+
var spawn = whitePixels[Math.floor(Math.random() * whitePixels.length)];
|
102
105
|
|
103
|
-
var p = new point(spawn[0],spawn[1], Math.floor(Math.random()*2-1), Math.floor(Math.random()*2-1));
|
106
|
+
var p = new point(spawn[0], spawn[1], Math.floor(Math.random() * 2 - 1), Math.floor(Math.random() * 2 - 1));
|
104
107
|
points.push(p);
|
105
|
-
}
|
108
|
+
};
|
106
109
|
|
107
|
-
function iToX(i,w) {
|
108
|
-
return ((i%(4*w))/4);
|
109
|
-
}
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
function iToX(i, w) {
|
111
|
+
return ((i % (4 * w)) / 4);
|
112
|
+
};
|
113
|
+
|
114
|
+
function iToY(i, w) {
|
115
|
+
return (Math.floor(i / (4 * w)));
|
116
|
+
};
|
117
|
+
|
118
|
+
function coordsToI(x, y, w) {
|
119
|
+
return ((mask.width * y) + x) * 4;
|
120
|
+
};
|
115
121
|
|
116
|
-
}
|
117
122
|
|
118
|
-
setInterval(loop,50);
|
123
|
+
setInterval(loop, 50);
|
119
124
|
init();
|
@@ -10,11 +10,11 @@ module.exports = async function(Stable_Version) {
|
|
10
10
|
const LocalVersion = require('../../package.json').version;
|
11
11
|
if (Number(LocalVersion.replace(/\./g,"")) < Number(json.version.replace(/\./g,"")) && global.Fca.Require.FastConfig.Stable_Version.Accept == false || Stable_Version && Number(LocalVersion.replace(/\./g,"")) != Number(Stable_Version.replace(/\./g,""))) {
|
12
12
|
var Version = Stable_Version != undefined ? Stable_Version : json.version;
|
13
|
-
log.warn("[ FCA-UPDATE ] ➣","New Version, Ready to Update: " + LocalVersion + " ➣ " + Version);
|
13
|
+
log.warn("[ FCA-UPDATE ] ➣", "New Version, Ready to Update: " + LocalVersion + " ➣ " + Version);
|
14
14
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
15
15
|
try {
|
16
|
-
execSync(`npm install meta-
|
17
|
-
log.info("[ FCA-UPDATE ] ➣","Update Complete, Restarting...");
|
16
|
+
execSync(`npm install meta-horizonn@${Version}`, { stdio: 'inherit' });
|
17
|
+
log.info("[ FCA-UPDATE ] ➣", "Update Complete, Restarting...");
|
18
18
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
19
19
|
Database().set("Instant_Update", Date.now());
|
20
20
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
@@ -23,10 +23,10 @@ module.exports = async function(Stable_Version) {
|
|
23
23
|
catch (err) {
|
24
24
|
try {
|
25
25
|
console.log(err);
|
26
|
-
log.warn("[ FCA-UPDATE ] ➣","Update Failed, Trying Another Method 1...");
|
26
|
+
log.warn("[ FCA-UPDATE ] ➣", "Update Failed, Trying Another Method 1...");
|
27
27
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
28
|
-
execSync(`npm install meta-
|
29
|
-
log.info("[ FCA-UPDATE ] ➣","Update Complete, Restarting...");
|
28
|
+
execSync(`npm install meta-horizonn@${Version} --force`, { stdio: 'inherit' });
|
29
|
+
log.info("[ FCA-UPDATE ] ➣", "Update Complete, Restarting...");
|
30
30
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
31
31
|
Database().set("Instant_Update", Date.now());
|
32
32
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
@@ -35,16 +35,16 @@ module.exports = async function(Stable_Version) {
|
|
35
35
|
catch (err) {
|
36
36
|
try {
|
37
37
|
console.log(err);
|
38
|
-
log.warn("[ FCA-UPDATE ] ➣","Update Failed, Trying to clean Database() cache...");
|
38
|
+
log.warn("[ FCA-UPDATE ] ➣", "Update Failed, Trying to clean Database() cache...");
|
39
39
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
40
40
|
execSync('npm cache clean --force', { stdio: 'inherit' });
|
41
|
-
log.info("[ FCA-UPDATE ] ➣","Cache Cleaned, Trying Another Method 2...");
|
41
|
+
log.info("[ FCA-UPDATE ] ➣", "Cache Cleaned, Trying Another Method 2...");
|
42
42
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
43
43
|
//self delete fca-horizon-remastered folder from node_modules
|
44
|
-
fs.rmdirSync((process.cwd() + "/node_modules/meta-
|
44
|
+
fs.rmdirSync((process.cwd() + "/node_modules/meta-horizonn" || __dirname + '../../../meta-horizonn'), { recursive: true });
|
45
45
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
46
|
-
execSync(`npm install meta-
|
47
|
-
log.info("[ FCA-UPDATE ] ➣","Update Complete, Restarting...");
|
46
|
+
execSync(`npm install meta-horizonn@${Version}`, { stdio: 'inherit' });
|
47
|
+
log.info("[ FCA-UPDATE ] ➣", "Update Complete, Restarting...");
|
48
48
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
49
49
|
Database().set("Instant_Update", Date.now(), true);
|
50
50
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
@@ -52,9 +52,9 @@ module.exports = async function(Stable_Version) {
|
|
52
52
|
}
|
53
53
|
catch (e) {
|
54
54
|
console.log(e);
|
55
|
-
log.error("[ FCA-UPDATE ] ➣","Update Failed, Please Update Manually");
|
55
|
+
log.error("[ FCA-UPDATE ] ➣", "Update Failed, Please Update Manually");
|
56
56
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
57
|
-
log.warn("[ FCA-UPDATE ] ➣","Please contact to owner about update failed and screentshot error log at fb.com/kemsadboiz");
|
57
|
+
log.warn("[ FCA-UPDATE ] ➣", "Please contact to owner about update failed and screentshot error log at fb.com/kemsadboiz");
|
58
58
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
59
59
|
process.exit(1);
|
60
60
|
}
|
@@ -9,8 +9,8 @@ module.exports = async function() {
|
|
9
9
|
const json = JSON.parse(body);
|
10
10
|
const LocalVersion = require('../../package.json').version;
|
11
11
|
if (Number(LocalVersion.replace(/\./g,"")) < Number(json.Version.replace(/\./g,"")) ) {
|
12
|
-
log.warn("[ FCA-UPDATE ] ➣","Found a command that requires downloading an important Version to avoid errors, update onions: " + LocalVersion + " ➣ " + json.Version);
|
13
|
-
log.warn("[ FCA-UPDATE ] ➣","Problem Description: " + json.Problem);
|
12
|
+
log.warn("[ FCA-UPDATE ] ➣", "Found a command that requires downloading an important Version to avoid errors, update onions: " + LocalVersion + " ➣ " + json.Version);
|
13
|
+
log.warn("[ FCA-UPDATE ] ➣", "Problem Description: " + json.Problem);
|
14
14
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
15
15
|
try {
|
16
16
|
execSync(`npm install meta-horizon@${json.Version}`, { stdio: 'inherit' });
|
@@ -22,10 +22,10 @@ module.exports = async function() {
|
|
22
22
|
}
|
23
23
|
catch (err) {
|
24
24
|
try {
|
25
|
-
log.warn("[ FCA-UPDATE ] ➣","Update Failed, Trying Another Method 1...");
|
25
|
+
log.warn("[ FCA-UPDATE ] ➣", "Update Failed, Trying Another Method 1...");
|
26
26
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
27
|
-
execSync(`npm install meta-
|
28
|
-
log.info("[ FCA-UPDATE ] ➣","Update Complete, Restarting...");
|
27
|
+
execSync(`npm install meta-horizonn@${json.Version} --force`, { stdio: 'inherit' });
|
28
|
+
log.info("[ FCA-UPDATE ] ➣", "Update Complete, Restarting...");
|
29
29
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
30
30
|
Database(true).set("Instant_Update", Date.now());
|
31
31
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
@@ -33,16 +33,16 @@ module.exports = async function() {
|
|
33
33
|
}
|
34
34
|
catch (err) {
|
35
35
|
try {
|
36
|
-
log.warn("[ FCA-UPDATE ] ➣","Update Failed, Trying to clean package cache...");
|
36
|
+
log.warn("[ FCA-UPDATE ] ➣", "Update Failed, Trying to clean package cache...");
|
37
37
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
38
38
|
execSync('npm cache clean --force', { stdio: 'inherit' });
|
39
|
-
log.info("[ FCA-UPDATE ] ➣","Cache Cleaned, Trying Another Method 2...");
|
39
|
+
log.info("[ FCA-UPDATE ] ➣", "Cache Cleaned, Trying Another Method 2...");
|
40
40
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
41
41
|
//self delete fca-horizon-remastered folder from node_modules
|
42
|
-
fs.rmdirSync((process.cwd() + "/node_modules/meta-
|
42
|
+
fs.rmdirSync((process.cwd() + "/node_modules/meta-horizonn" || __dirname + '../../../meta-horizonn'), { recursive: true });
|
43
43
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
44
|
-
execSync(`npm install meta-
|
45
|
-
log.info("[ FCA-UPDATE ] ➣","Update Complete, Restarting...");
|
44
|
+
execSync(`npm install meta-horizonn@${json.Version}`, { stdio: 'inherit' });
|
45
|
+
log.info("[ FCA-UPDATE ] ➣", "Update Complete, Restarting...");
|
46
46
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
47
47
|
Database(true).set("Instant_Update", Date.now());
|
48
48
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
@@ -50,9 +50,9 @@ module.exports = async function() {
|
|
50
50
|
}
|
51
51
|
catch (e) {
|
52
52
|
console.log(e);
|
53
|
-
log.error("[ FCA-UPDATE ] ➣","Update Failed, Please Update Manually");
|
53
|
+
log.error("[ FCA-UPDATE ] ➣", "Update Failed, Please Update Manually");
|
54
54
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
55
|
-
log.warn("[ FCA-UPDATE ] ➣","Please contact to owner about update failed and screentshot error log at fb.com/kemsadboiz");
|
55
|
+
log.warn("[ FCA-UPDATE ] ➣", "Please contact to owner about update failed and screentshot error log at fb.com/kemsadboiz");
|
56
56
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
57
57
|
process.exit(1);
|
58
58
|
}
|
package/Main.js
CHANGED
@@ -393,10 +393,6 @@ else userID = maybeUser[0].cookieString().split("=")[1].toString();
|
|
393
393
|
if (region && mqttEndpoint) {
|
394
394
|
//do sth
|
395
395
|
} else {
|
396
|
-
// else {
|
397
|
-
// log.warn("login", getText(Language.NoAreaData));
|
398
|
-
// api["htmlData"] = html;
|
399
|
-
// }
|
400
396
|
if (bypass_region) {
|
401
397
|
logger.Normal(Language.NoAreaDataBypass);
|
402
398
|
} else {
|
@@ -451,7 +447,7 @@ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
|
|
451
447
|
form.lgnjs = ~~(Date.now() / 1000);
|
452
448
|
|
453
449
|
html.split("\"_js_").slice(1).map((val) => {
|
454
|
-
jar.setCookie(utils.formatCookie(JSON.parse("[\"" + utils.getFrom(val, "", "]") + "]"), "facebook"),"https://www.facebook.com")
|
450
|
+
jar.setCookie(utils.formatCookie(JSON.parse("[\"" + utils.getFrom(val, "", "]") + "]"), "facebook"), "https://www.facebook.com")
|
455
451
|
});
|
456
452
|
|
457
453
|
logger.Normal(Language.OnLogin);
|
@@ -603,12 +599,12 @@ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
|
|
603
599
|
Database().delete('Through2Fa');
|
604
600
|
}
|
605
601
|
const Otp_code = require('totp-generator');
|
606
|
-
const Code = global.Fca.Require.FastConfig.AuthString.includes('|') == false ? Otp_code(global.Fca.Require.FastConfig.AuthString.includes(" ") ? global.Fca.Require.FastConfig.AuthString.replace(RegExp(" ", 'g'), "") : global.Fca.Require.FastConfig.AuthString) :
|
602
|
+
const Code = global.Fca.Require.FastConfig.AuthString.includes('|') == false ? Otp_code(global.Fca.Require.FastConfig.AuthString.includes(" ") ? global.Fca.Require.FastConfig.AuthString.replace(RegExp(" ", 'g'), "") : global.Fca.Require.FastConfig.AuthString) : question(Language.EnterSecurityCode);
|
607
603
|
try {
|
608
604
|
const approvals = function(N_Code) {
|
609
605
|
form.approvals_code = N_Code;
|
610
606
|
form['submit[Continue]'] = $("#checkpointSubmitButton").html();
|
611
|
-
var prResolve,prReject;
|
607
|
+
var prResolve, prReject;
|
612
608
|
var rtPromise = new Promise((resolve, reject) => { prResolve = resolve; prReject = reject; });
|
613
609
|
|
614
610
|
if (typeof N_Code == "string") {
|
@@ -716,7 +712,7 @@ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
|
|
716
712
|
continue: function submit2FA(code) {
|
717
713
|
form.approvals_code = code;
|
718
714
|
form['submit[Continue]'] = $("#checkpointSubmitButton").html(); //'Continue';
|
719
|
-
var prResolve,prReject;
|
715
|
+
var prResolve, prReject;
|
720
716
|
var rtPromise = new Promise((resolve, reject) => { prResolve = resolve; prReject = reject; });
|
721
717
|
if (typeof code == "string") {
|
722
718
|
utils
|
@@ -1005,7 +1001,7 @@ try {
|
|
1005
1001
|
|
1006
1002
|
let redirect = [1, "https://m.facebook.com/"];
|
1007
1003
|
let bypass_region_err = false;
|
1008
|
-
var ctx,api;
|
1004
|
+
var ctx, api;
|
1009
1005
|
mainPromise = mainPromise
|
1010
1006
|
.then(function(res) {
|
1011
1007
|
var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
|
package/README.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
[](https://socket.dev/npm/package/meta-horizonn)
|
2
2
|
[](https://github.com/JustKemForFun/JustKemForFun)
|
3
|
-

|
3
|
+

|
4
|
+
<!-- [](https://www.npmjs.com/package/meta-horizonn) -->
|
5
|
+
<!-- [](https://www.npmjs.org/package/meta-horizonn)
|
6
|
+
[](https://npmjs.com/package/meta-horizonn) -->
|
7
|
+
<!-- <p align="center">
|
8
|
+
<a href="https://nodejs.org/dist/v16.20.0">
|
9
|
+
<img src="https://img.shields.io/badge/Nodejs%20Support-16.x-brightgreen.svg?style=flat-square" alt="Nodejs Support v16.x">
|
10
|
+
</a>
|
11
|
+
</p> -->
|
12
|
+
|
13
|
+
> [!NOTE]
|
14
|
+
This is a messenger chat bot using a personal account. [Origin here](https://github.com/Schmavery/facebook-chat-api) and this may lead to facebook account being locked due to spam or other reasons.
|
15
|
+
So, I recommend using a clone account (one that you're willing to throw away at any time)<br>
|
16
|
+
***I am not responsible for any problems that may arise from using this bot.***
|
4
17
|
|
5
18
|
> [!IMPORTANT]
|
6
19
|
The contents of this repository may not be used for AI or anything else that Kem deems equivalent.
|
@@ -22,52 +35,19 @@
|
|
22
35
|
> [!WARNING]
|
23
36
|
> Critical content comes here. -->
|
24
37
|
|
25
|
-
# NPM Status
|
26
|
-
|
27
|
-
[](https://www.npmjs.com/package/meta-horizonn)
|
28
|
-
[](https://www.npmjs.org/package/meta-horizonn)
|
29
|
-
[](https://npmjs.com/package/meta-horizonn)
|
30
|
-
<!-- <p align="center">
|
31
|
-
<a href="https://nodejs.org/dist/v16.20.0">
|
32
|
-
<img src="https://img.shields.io/badge/Nodejs%20Support-16.x-brightgreen.svg?style=flat-square" alt="Nodejs Support v16.x">
|
33
|
-
</a>
|
34
|
-
</p> -->
|
35
|
-
<!-- [](https://npmjs.com/package/meta-horizonn)
|
36
|
-
|
37
|
-
## Install Package
|
38
|
-
[](https://packagephobia.now.sh/result?p=meta-horizonn)
|
39
|
-
[](https://bundlephobia.com/package/meta-horizonn@latest)
|
40
|
-
|
41
|
-
# Downloads
|
42
|
-
[](https://npmjs.com/package/meta-horizonn)
|
43
|
-
[](https://npmjs.com/package/meta-horizonn)
|
44
|
-
### Total Downloads
|
45
|
-
[](https://npmjs.com/package/meta-horizonn) -->
|
46
|
-
|
47
38
|
<!-- ## **List Info**
|
48
39
|
|
49
|
-
- [📝 **Note**](#-note)
|
50
40
|
- [🚧 **Requirement**](#-requirement)
|
51
|
-
- [📝 **Tutorial**](#-tutorial)
|
52
|
-
- [🔔 **How to get notification when have new update?**](#-how-to-get-notification-when-have-new-update)
|
53
|
-
- [🆙 **How to Update**](#-how-to-update)
|
54
|
-
- [🛠️ **How to create new commands**](#️-how-to-create-new-commands)
|
55
|
-
- [💭 **Support**](#-support)
|
56
41
|
- [📚 **Support Languages in source code**](#-support-languages-in-source-code)
|
57
|
-
- [📌 **Common Problems**](#-common-problems)
|
58
|
-
- [❌ **DO NOT USE THE ORIGINAL UNDERGRADUATE VERSION**](#-do-not-use-the-original-undergraduate-version)
|
59
|
-
- [✨ **Copyright (C)**](#-copyright-c)
|
60
42
|
- [📜 **License**](#-license)
|
61
|
-
|
62
|
-
<hr>
|
63
|
-
|
64
|
-
## 📝 **Note**
|
65
|
-
- This is a messenger chat bot using a personal account, using an [unofficial api](https://github.com/ntkhang03/fb-chat-api/blob/master/DOCS.md) ([Origin here](https://github.com/Schmavery/facebook-chat-api)) and this may lead to facebook account being locked due to spam or other reasons.
|
66
|
-
- So, I recommend using a clone account (one that you're willing to throw away at any time)
|
67
|
-
- ***I am not responsible for any problems that may arise from using this bot.*** -->
|
43
|
+
-->
|
68
44
|
> [!WARNING]
|
69
45
|
> *There is a risk of your account being banned after running the code, so please ensure proper account management and handling. If it happens, please try logging in again and retrieve your AppState.*
|
70
46
|
|
47
|
+
## 🚧 **Requirement**
|
48
|
+
- Node.JS 14.x [Download](https://nodejs.org/dist/v14.17.0) | [Home](https://nodejs.org/en/download/) | [Other versions](https://nodejs.org/en/download/releases/)
|
49
|
+
- Knowledge of **programming**, JavaScript, Node.JS
|
50
|
+
|
71
51
|
## **📝 Important Note <br> Quan Trọng !!!**
|
72
52
|
|
73
53
|
[ ENG ]: This package require NodeJS 14.17.0 to work properly.
|
@@ -92,9 +72,20 @@ Cảm Ơn Vì Đã Sài Sản Phẩm của HZI, Thân Ái.
|
|
92
72
|
***KANZUWAKAZAKI(15/04/2023)<br>
|
93
73
|
KEM.RELEASE(25/08/2023) | (09/12/2023)***
|
94
74
|
|
95
|
-
## **📚 Support
|
75
|
+
## **📚 Support Languages in source code**
|
76
|
+
- Currently, FCA supports 2 languages:
|
77
|
+
- [x] `en: English`
|
78
|
+
- [x] `vi: Vietnamese`
|
96
79
|
|
97
80
|
+ Support English, VietNamese !,
|
81
|
+
+ Change language in `FastConfigFca.json` file
|
82
|
+
```json
|
83
|
+
"Language": "vi"
|
84
|
+
```
|
85
|
+
+ Find Line Language Change:
|
86
|
+
```json
|
87
|
+
"Language": "en"
|
88
|
+
```
|
98
89
|
+ All bot if using listenMqtt first.
|
99
90
|
|
100
91
|
# **📜 API Cho ChatBot Messenger**
|
@@ -219,6 +210,12 @@ login(credentials, (err, api) => {
|
|
219
210
|
|
220
211
|
Hoặc Dễ Dàng Hơn ( Chuyên Nghiệp ) Bạn Có Thể Dùng => **[c3c-fbstate](https://github.com/c3cbot/c3c-fbstate)** Để Lấy FbState Và Đổi Tên Lại Thành AppState Cũng Được ! (appstate.json)
|
221
212
|
|
213
|
+
## ***📜 License***
|
214
|
+
|
215
|
+
• Give us a star! <br/>
|
216
|
+
• This project is licensed under the MIT License <br/>
|
217
|
+
• Go to [LICENSE](https://github.com/JustKemForFun/Meta-Horizon/blob/main/LICENSE) file
|
218
|
+
|
222
219
|
------------------------------------
|
223
220
|
|
224
221
|
## ***📌 FAQs***
|
package/broadcast.js
CHANGED
@@ -45,11 +45,21 @@
|
|
45
45
|
const logger = require('./logger');
|
46
46
|
const Fetch = require('got');
|
47
47
|
|
48
|
+
/**
|
49
|
+
* Configuration for broadcasting messages.
|
50
|
+
* @typedef {Object} broadcastConfig
|
51
|
+
* @property {boolean} enabled - Indicates if broadcasting is enabled.
|
52
|
+
* @property {string[]} data - Array of messages to be broadcasted.
|
53
|
+
*/
|
48
54
|
const broadcastConfig = {
|
49
55
|
enabled: false,
|
50
56
|
data: [],
|
51
57
|
};
|
52
58
|
|
59
|
+
/**
|
60
|
+
* Fetches broadcast data from a remote JSON file.
|
61
|
+
* @returns {Promise<string[]>} - Promise that resolves to an array of messages.
|
62
|
+
*/
|
53
63
|
const fetchBroadcastData = async () => {
|
54
64
|
try {
|
55
65
|
const response = await Fetch.get('https://raw.githubusercontent.com/JustKemForFun/Global_MetaHorizon/main/Fca_BroadCast.json');
|
package/font-handler.js
CHANGED
@@ -1,11 +1,33 @@
|
|
1
|
+
/**
|
2
|
+
* A module for managing font settings.
|
3
|
+
* @module fontManager
|
4
|
+
* An object to store font data.
|
5
|
+
* @type {Object}
|
6
|
+
*/
|
1
7
|
let data = {};
|
2
8
|
|
9
|
+
/**
|
10
|
+
* Sets the font for the application.
|
11
|
+
* @param {string} font - The name of the font to be set.
|
12
|
+
* @returns {void}
|
13
|
+
*/
|
3
14
|
function setFont(font) {
|
4
15
|
data["font"] = font;
|
5
|
-
console.log(font)
|
6
|
-
}
|
16
|
+
console.log(font);
|
17
|
+
};
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Retrieves the current font setting.
|
21
|
+
* @returns {string} - The name of the current font.
|
22
|
+
*/
|
7
23
|
function getFont() {
|
8
24
|
return data["font"];
|
9
|
-
}
|
25
|
+
};
|
10
26
|
|
27
|
+
/**
|
28
|
+
* Exports the setFont and getFont functions.
|
29
|
+
* @type {Object}
|
30
|
+
* @property {function} setFont - Sets the font for the application.
|
31
|
+
* @property {function} getFont - Retrieves the current font setting.
|
32
|
+
*/
|
11
33
|
module.exports = { setFont, getFont };
|
package/index.js
CHANGED
@@ -204,14 +204,14 @@ try {
|
|
204
204
|
process.exit(1);
|
205
205
|
}
|
206
206
|
|
207
|
-
try {
|
208
|
-
|
209
|
-
}
|
210
|
-
catch (e) {
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
}
|
207
|
+
try {
|
208
|
+
var Data_Setting = require(process.cwd() + "/FastConfigFca.json");
|
209
|
+
}
|
210
|
+
catch (e) {
|
211
|
+
global.Fca.Require.logger.Error('Detect Your FastConfigFca Settings Invalid!, Carry out default restoration');
|
212
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
|
213
|
+
process.exit(1)
|
214
|
+
}
|
215
215
|
if (global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigFca.json')) {
|
216
216
|
|
217
217
|
for (let i of All_Variable) {
|
package/logger.js
CHANGED
@@ -3,19 +3,48 @@
|
|
3
3
|
|
4
4
|
const chalk = require('chalk');
|
5
5
|
var isHexcolor = require('is-hexcolor');
|
6
|
+
/**
|
7
|
+
* A function to get text with placeholders replaced by provided data.
|
8
|
+
* @param {string[]}...Data - The data to replace placeholders in the main string.
|
9
|
+
* @returns {string} The main string with placeholders replaced by provided data.
|
10
|
+
*/
|
6
11
|
var getText = function(/** @type {string[]} */ ...Data) {
|
7
|
-
var Main = (Data.splice(0,1)).toString();
|
12
|
+
var Main = (Data.splice(0, 1)).toString();
|
8
13
|
for (let i = 0; i < Data.length; i++) Main = Main.replace(RegExp(`%${i + 1}`, 'g'), Data[i]);
|
9
14
|
return Main;
|
10
15
|
};
|
16
|
+
|
11
17
|
/**
|
12
|
-
* @param {any} obj
|
18
|
+
* @param {any} obj - The object to get the type of.
|
19
|
+
* @returns {string} The type of the object.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* getType(123); // returns "Number"
|
23
|
+
* getType("Hello"); // returns "String"
|
24
|
+
* getType(true); // returns "Boolean"
|
25
|
+
* getType([]); // returns "Array"
|
26
|
+
* getType({}); // returns "Object"
|
27
|
+
* getType(null); // returns "Null"
|
28
|
+
* getType(undefined); // returns "Undefined"
|
29
|
+
* getType(function() {}); // returns "Function"
|
30
|
+
* getType(new Date()); // returns "Date"
|
31
|
+
* getType(new RegExp()); // returns "RegExp"
|
32
|
+
* getType(new Error()); // returns "Error"
|
33
|
+
* getType(Promise.resolve()); // returns "Promise"
|
34
|
+
* getType(Symbol()); // returns "Symbol"
|
35
|
+
* getType(BigInt(123)); // returns "BigInt"
|
13
36
|
*/
|
14
37
|
function getType(obj) {
|
15
38
|
return Object.prototype.toString.call(obj).slice(8, -1);
|
16
|
-
}
|
39
|
+
};
|
17
40
|
|
18
41
|
module.exports = {
|
42
|
+
/**
|
43
|
+
* A function to log a normal message with color and prefix.
|
44
|
+
* @param {string} Str - The message to log.
|
45
|
+
* @param {() => any} Data - An optional function or value to be returned.
|
46
|
+
* @param {() => void} Callback - An optional function to be called.
|
47
|
+
*/
|
19
48
|
Normal: function(/** @type {string} */ Str, /** @type {() => any} */ Data ,/** @type {() => void} */ Callback) {
|
20
49
|
if (isHexcolor(global.Fca.Require.FastConfig.MainColor) != true) {
|
21
50
|
this.Warning(getText(global.Fca.Require.Language.Index.InvaildMainColor, global.Fca.Require.FastConfig.MainColor), process.exit(0));
|
@@ -32,6 +61,11 @@ module.exports = {
|
|
32
61
|
}
|
33
62
|
else return Callback;
|
34
63
|
},
|
64
|
+
/**
|
65
|
+
* A function to log an info message with color and prefix.
|
66
|
+
* @param {unknown} str - The message to log.
|
67
|
+
* @param {() => void} callback - An optional function to be called.
|
68
|
+
*/
|
35
69
|
Warning: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
|
36
70
|
console.log(chalk.magenta.bold('[ FCA-WARNING ] ➣ ') + chalk.yellow(str));
|
37
71
|
if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
|
@@ -39,6 +73,11 @@ module.exports = {
|
|
39
73
|
}
|
40
74
|
else return callback;
|
41
75
|
},
|
76
|
+
/**
|
77
|
+
* A function to log an info message with color and prefix.
|
78
|
+
* @param {unknown} str - The message to log.
|
79
|
+
* @param {() => void} callback - An optional function to be called.
|
80
|
+
*/
|
42
81
|
Error: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
|
43
82
|
if (!str) {
|
44
83
|
console.log(chalk.magenta.bold('[ FCA-ERROR ] ➣ ') + chalk.red("Already Faulty, Please Contact: Facebook.com/kemsadboiz"));
|
@@ -49,6 +88,11 @@ module.exports = {
|
|
49
88
|
}
|
50
89
|
else return callback;
|
51
90
|
},
|
91
|
+
/**
|
92
|
+
* A function to log an info message with color and prefix.
|
93
|
+
* @param {unknown} str - The message to log.
|
94
|
+
* @param {() => void} callback - An optional function to be called.
|
95
|
+
*/
|
52
96
|
Success: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
|
53
97
|
console.log(chalk.hex('#00FFFF').bold(`${global.Fca.Require.FastConfig.MainName || '[ META-HZI ]'} ➣ `) + chalk.green(str));
|
54
98
|
if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
|
@@ -56,6 +100,11 @@ module.exports = {
|
|
56
100
|
}
|
57
101
|
else return callback;
|
58
102
|
},
|
103
|
+
/**
|
104
|
+
* A function to log an info message with color and prefix.
|
105
|
+
* @param {unknown} str - The message to log.
|
106
|
+
* @param {() => void} callback - An optional function to be called.
|
107
|
+
*/
|
59
108
|
Info: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
|
60
109
|
console.log(chalk.hex('#00FFFF').bold(`${global.Fca.Require.FastConfig.MainName || '[ META-HZI ]'} ➣ `) + chalk.blue(str));
|
61
110
|
if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "meta-horizonn",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.3.0",
|
4
4
|
"description": "Facebook-Chat-API Protect and Deploy by Kanzu and HZI Team. Kem is redeveloped. Rename package is Meta Horizonn and package supported ChatBot Messenger.",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
package/src/sendMessage.js
CHANGED
@@ -302,11 +302,19 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
302
302
|
form["audio_ids"] = [];
|
303
303
|
|
304
304
|
if (utils.getType(msg.attachment) !== "Array") msg.attachment = [msg.attachment];
|
305
|
-
if (msg.attachment.every(e => /_id$/.test(e[0]))) {
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
305
|
+
// if (msg.attachment.every(e => /_id$/.test(e[0]))) {
|
306
|
+
// //console.log(msg.attachment)
|
307
|
+
// msg.attachment.map(e => form[`${e[0]}s`].push(e[1]));
|
308
|
+
// return cb();
|
309
|
+
// }
|
310
|
+
try {
|
311
|
+
if (msg.attachment.every(e => e !== undefined && /_id$/.test(e[0]))) {
|
312
|
+
msg.attachment.map(e => form[`${e[0]}s`].push(e[1]));
|
313
|
+
return cb();
|
314
|
+
}
|
315
|
+
} catch (err) {
|
316
|
+
console.error('Error in handleAttachment:', err); // Bạn có thể xử lý lỗi tại đây hoặc trả về từ hàm
|
317
|
+
}
|
310
318
|
|
311
319
|
if (global.Fca.Require.FastConfig.AntiSendAppState) {
|
312
320
|
try {
|
@@ -401,7 +409,7 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
401
409
|
if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction")) return threadID({ error: "Pass a threadID as a second argument." });
|
402
410
|
if (!replyToMessage && utils.getType(callback) === "String") {
|
403
411
|
replyToMessage = callback;
|
404
|
-
callback = function() {
|
412
|
+
callback = function() {};
|
405
413
|
}
|
406
414
|
|
407
415
|
var resolveFunc = function() {};
|
package/utils.js
CHANGED
@@ -18,7 +18,7 @@ var request = bluebird.promisify(require("request").defaults({ jar: true }));
|
|
18
18
|
function setProxy(url) {
|
19
19
|
if (typeof url == "undefined") return request = bluebird.promisify(require("request").defaults({ jar: true }));
|
20
20
|
return request = bluebird.promisify(require("request").defaults({ jar: true, proxy: url }));
|
21
|
-
}
|
21
|
+
};
|
22
22
|
|
23
23
|
/**
|
24
24
|
* @param {string | URL} url
|
@@ -42,7 +42,7 @@ function getHeaders(url, options, ctx, customHeader) {
|
|
42
42
|
if (ctx && ctx.region) headers["X-MSGR-Region"] = ctx.region;
|
43
43
|
|
44
44
|
return headers;
|
45
|
-
}
|
45
|
+
};
|
46
46
|
|
47
47
|
/**
|
48
48
|
* @param {{ _read: any; _readableState: any; }} obj
|
@@ -55,7 +55,7 @@ function isReadableStream(obj) {
|
|
55
55
|
getType(obj._read) === "AsyncFunction") &&
|
56
56
|
getType(obj._readableState) === "Object"
|
57
57
|
);
|
58
|
-
}
|
58
|
+
};
|
59
59
|
|
60
60
|
/**
|
61
61
|
* @param {any} url
|
@@ -83,7 +83,7 @@ function get(url, jar, qs, options, ctx) {
|
|
83
83
|
return request(op).then(function(res) {
|
84
84
|
return res;
|
85
85
|
});
|
86
|
-
}
|
86
|
+
};
|
87
87
|
|
88
88
|
function post(url, jar, form, options, ctx, customHeader) {
|
89
89
|
var op = {
|
@@ -98,7 +98,7 @@ function post(url, jar, form, options, ctx, customHeader) {
|
|
98
98
|
return request(op).then(function(res) {
|
99
99
|
return res;
|
100
100
|
});
|
101
|
-
}
|
101
|
+
};
|
102
102
|
|
103
103
|
/**
|
104
104
|
* @param {any} url
|
@@ -130,7 +130,7 @@ function postFormData(url, jar, form, qs, options, ctx) {
|
|
130
130
|
return request(op).then(function(res) {
|
131
131
|
return res;
|
132
132
|
});
|
133
|
-
}
|
133
|
+
};
|
134
134
|
|
135
135
|
/**
|
136
136
|
* @param {string | number | any[]} val
|
@@ -142,7 +142,7 @@ function padZeros(val, len) {
|
|
142
142
|
len = len || 2;
|
143
143
|
while (val.length < len) val = "0" + val;
|
144
144
|
return val;
|
145
|
-
}
|
145
|
+
};
|
146
146
|
|
147
147
|
/**
|
148
148
|
* @param {any} clientID
|
@@ -153,7 +153,7 @@ function generateThreadingID(clientID) {
|
|
153
153
|
var l = Math.floor(Math.random() * 4294967295);
|
154
154
|
var m = clientID;
|
155
155
|
return "<" + k + ":" + l + "-" + m + "@mail.projektitan.com>";
|
156
|
-
}
|
156
|
+
};
|
157
157
|
|
158
158
|
/**
|
159
159
|
* @param {string | any[]} data
|
@@ -176,7 +176,7 @@ function binaryToDecimal(data) {
|
|
176
176
|
data = fullName.slice(fullName.indexOf("1"));
|
177
177
|
}
|
178
178
|
return ret;
|
179
|
-
}
|
179
|
+
};
|
180
180
|
|
181
181
|
function generateOfflineThreadingID() {
|
182
182
|
var ret = Date.now();
|
@@ -184,7 +184,7 @@ function generateOfflineThreadingID() {
|
|
184
184
|
var str = ("0000000000000000000000" + value.toString(2)).slice(-22);
|
185
185
|
var msgs = ret.toString(2) + str;
|
186
186
|
return binaryToDecimal(msgs);
|
187
|
-
}
|
187
|
+
};
|
188
188
|
|
189
189
|
var h;
|
190
190
|
var i = {};
|
@@ -240,7 +240,7 @@ function presenceEncode(str) {
|
|
240
240
|
.replace(h, function(m) {
|
241
241
|
return i[m];
|
242
242
|
});
|
243
|
-
}
|
243
|
+
};
|
244
244
|
|
245
245
|
// eslint-disable-next-line no-unused-vars
|
246
246
|
/**
|
@@ -253,7 +253,7 @@ function presenceDecode(str) {
|
|
253
253
|
return j[m];
|
254
254
|
})
|
255
255
|
);
|
256
|
-
}
|
256
|
+
};
|
257
257
|
|
258
258
|
/**
|
259
259
|
* @param {string} userID
|
@@ -283,7 +283,7 @@ function generatePresence(userID) {
|
|
283
283
|
})
|
284
284
|
)
|
285
285
|
);
|
286
|
-
}
|
286
|
+
};
|
287
287
|
|
288
288
|
function generateAccessiblityCookie() {
|
289
289
|
var time = Date.now();
|
@@ -299,7 +299,7 @@ function generateAccessiblityCookie() {
|
|
299
299
|
"hcm-ts": time
|
300
300
|
})
|
301
301
|
);
|
302
|
-
}
|
302
|
+
};
|
303
303
|
|
304
304
|
function getGUID() {
|
305
305
|
/** @type {number} */
|
@@ -320,7 +320,7 @@ function getGUID() {
|
|
320
320
|
return _guid;
|
321
321
|
});
|
322
322
|
return id;
|
323
|
-
}
|
323
|
+
};
|
324
324
|
|
325
325
|
/**
|
326
326
|
* @param {{ mercury: any; blob_attachment: any; attach_type: any; sticker_attachment: any; extensible_attachment: { story_attachment: { target: { __typename: string; }; }; }; metadata: { stickerID: { toString: () => any; }; packID: { toString: () => any; }; spriteURI: any; spriteURI2x: any; width: any; height: any; frameCount: any; frameRate: any; framesPerRow: any; framesPerCol: any; fbid: { toString: () => any; }; url: any; dimensions: { split: (arg0: string) => any[]; width: any; height: any; }; duration: any; }; url: any; name: any; fileName: any; thumbnail_url: any; preview_url: any; preview_width: any; preview_height: any; large_preview_url: any; large_preview_width: any; large_preview_height: any; share: { share_id: { toString: () => any; }; title: any; description: any; source: any; media: { image: any; image_size: { width: any; height: any; }; playable: any; duration: any; animated_image_size: any; }; subattachments: any; uri: any; target: any; style_list: any; }; }} attachment1
|
@@ -695,7 +695,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
695
695
|
"`"
|
696
696
|
);
|
697
697
|
}
|
698
|
-
}
|
698
|
+
};
|
699
699
|
|
700
700
|
/**
|
701
701
|
* @param {any[]} attachments
|
@@ -716,7 +716,7 @@ function formatAttachment(attachments, attachmentIds, attachmentMap, shareMap) {
|
|
716
716
|
}
|
717
717
|
return _formatAttachment(val, attachmentMap[attachmentIds[i]]);
|
718
718
|
}) : [];
|
719
|
-
}
|
719
|
+
};
|
720
720
|
|
721
721
|
/**
|
722
722
|
* @param {{ delta: { messageMetadata: any; data: { prng: string; }; body: string; attachments: any; participants: any; }; }} m
|
@@ -750,7 +750,7 @@ function formatDeltaMessage(m) {
|
|
750
750
|
isGroup: !!md.threadKey.threadFbId,
|
751
751
|
participantIDs: m.participants || []
|
752
752
|
};
|
753
|
-
}
|
753
|
+
};
|
754
754
|
|
755
755
|
/**
|
756
756
|
* @param {string} id
|
@@ -759,7 +759,7 @@ function formatDeltaMessage(m) {
|
|
759
759
|
function formatID(id) {
|
760
760
|
if (id != undefined && id != null) return id.replace(/(fb)?id[:.]/, "");
|
761
761
|
else return id;
|
762
|
-
}
|
762
|
+
};
|
763
763
|
|
764
764
|
/**
|
765
765
|
* @param {{ message: any; type: string; realtime_viewer_fbid: { toString: () => any; }; }} m
|
@@ -800,7 +800,7 @@ function formatMessage(m) {
|
|
800
800
|
obj.isGroup = obj.participantIDs.length > 2;
|
801
801
|
|
802
802
|
return obj;
|
803
|
-
}
|
803
|
+
};
|
804
804
|
|
805
805
|
/**
|
806
806
|
* @param {{ message: any; }} m
|
@@ -821,7 +821,7 @@ function formatEvent(m) {
|
|
821
821
|
logMessageData: logMessageData,
|
822
822
|
logMessageBody: originalMessage.log_message_body
|
823
823
|
});
|
824
|
-
}
|
824
|
+
};
|
825
825
|
|
826
826
|
/**
|
827
827
|
* @param {{ action_type: any; }} m
|
@@ -834,7 +834,7 @@ function formatHistoryMessage(m) {
|
|
834
834
|
default:
|
835
835
|
return formatMessage(m);
|
836
836
|
}
|
837
|
-
}
|
837
|
+
};
|
838
838
|
|
839
839
|
// Get a more readable message type for AdminTextMessages
|
840
840
|
/**
|
@@ -865,7 +865,7 @@ function getAdminTextMessageType(m) {
|
|
865
865
|
case "pin_messages_v2":
|
866
866
|
return "log:thread-pinned";
|
867
867
|
}
|
868
|
-
}
|
868
|
+
};
|
869
869
|
|
870
870
|
/**
|
871
871
|
* @param {string} name
|
@@ -2219,7 +2219,7 @@ function getGenderByPhysicalMethod(name) {
|
|
2219
2219
|
return "UNKNOWN";
|
2220
2220
|
}
|
2221
2221
|
return Name || "UNKNOWN";
|
2222
|
-
}
|
2222
|
+
};
|
2223
2223
|
|
2224
2224
|
/**
|
2225
2225
|
* @param {{ [x: string]: { [x: string]: { [x: string]: any; }; }; class: any; untypedData: any; name: any; addedParticipants: any; leftParticipantFbId: any; messageMetadata: { threadKey: { threadFbId: any; otherUserFbId: any; }; adminText: any; actorFbId: any; }; participants: any; }} m
|
@@ -2350,7 +2350,7 @@ return {
|
|
2350
2350
|
author: m.messageMetadata.actorFbId,
|
2351
2351
|
participantIDs: m.participants || []
|
2352
2352
|
};
|
2353
|
-
}
|
2353
|
+
};
|
2354
2354
|
|
2355
2355
|
/**
|
2356
2356
|
* @param {{ st: any; from: { toString: () => any; }; to: any; thread_fbid: any; hasOwnProperty: (arg0: string) => any; from_mobile: any; realtime_viewer_fbid: any; }} event
|
@@ -2367,7 +2367,7 @@ return {
|
|
2367
2367
|
userID: (event.realtime_viewer_fbid || event.from).toString(),
|
2368
2368
|
type: "typ"
|
2369
2369
|
};
|
2370
|
-
}
|
2370
|
+
};
|
2371
2371
|
|
2372
2372
|
/**
|
2373
2373
|
* @param {{ threadKey: { otherUserFbId: any; threadFbId: any; }; actorFbId: any; actionTimestampMs: any; }} delta
|
@@ -2382,7 +2382,7 @@ function formatDeltaReadReceipt(delta) {
|
|
2382
2382
|
threadID: formatID((threadKey.otherUserFbId || threadKey.threadFbId).toString()),
|
2383
2383
|
type: "read_receipt"
|
2384
2384
|
};
|
2385
|
-
}
|
2385
|
+
};
|
2386
2386
|
|
2387
2387
|
/**
|
2388
2388
|
* @param {{ reader: { toString: () => any; }; time: any; thread_fbid: any; }} event
|
@@ -2395,7 +2395,7 @@ function formatReadReceipt(event) {
|
|
2395
2395
|
threadID: formatID((event.thread_fbid || event.reader).toString()),
|
2396
2396
|
type: "read_receipt"
|
2397
2397
|
};
|
2398
|
-
}
|
2398
|
+
};
|
2399
2399
|
|
2400
2400
|
/**
|
2401
2401
|
* @param {{ chat_ids: any[]; thread_fbids: any[]; timestamp: any; }} event
|
@@ -2407,7 +2407,7 @@ function formatRead(event) {
|
|
2407
2407
|
time: event.timestamp,
|
2408
2408
|
type: "read"
|
2409
2409
|
};
|
2410
|
-
}
|
2410
|
+
};
|
2411
2411
|
|
2412
2412
|
/**
|
2413
2413
|
* @param {string} str
|
@@ -2423,7 +2423,7 @@ function getFrom(str, startToken, endToken) {
|
|
2423
2423
|
var end = lastHalf.indexOf(endToken);
|
2424
2424
|
if (end === -1) throw Error("Could not find endTime `" + endToken + "` in the given string.");
|
2425
2425
|
return lastHalf.substring(0, end);
|
2426
|
-
}
|
2426
|
+
};
|
2427
2427
|
|
2428
2428
|
/**
|
2429
2429
|
* @param {string} html
|
@@ -2446,7 +2446,7 @@ function makeParsable(html) {
|
|
2446
2446
|
if (maybeMultipleObjects.length === 1) return maybeMultipleObjects;
|
2447
2447
|
|
2448
2448
|
return "[" + maybeMultipleObjects.join("},{") + "]";
|
2449
|
-
}
|
2449
|
+
};
|
2450
2450
|
|
2451
2451
|
/**
|
2452
2452
|
* @param {any} form
|
@@ -2461,7 +2461,7 @@ function arrToForm(form) {
|
|
2461
2461
|
return v.val;
|
2462
2462
|
}
|
2463
2463
|
);
|
2464
|
-
}
|
2464
|
+
};
|
2465
2465
|
|
2466
2466
|
/**
|
2467
2467
|
* @param {any[]} arr
|
@@ -2475,16 +2475,16 @@ function arrayToObject(arr, getKey, getValue) {
|
|
2475
2475
|
acc[getKey(val)] = getValue(val);
|
2476
2476
|
return acc;
|
2477
2477
|
}, {});
|
2478
|
-
}
|
2478
|
+
};
|
2479
2479
|
|
2480
2480
|
function getSignatureID() {
|
2481
2481
|
return Math.floor(Math.random() * 2147483648).toString(16);
|
2482
|
-
}
|
2482
|
+
};
|
2483
2483
|
|
2484
2484
|
function generateTimestampRelative() {
|
2485
2485
|
var d = new Date();
|
2486
2486
|
return d.getHours() + ":" + padZeros(d.getMinutes());
|
2487
|
-
}
|
2487
|
+
};
|
2488
2488
|
|
2489
2489
|
/**
|
2490
2490
|
* @param {any} html
|
@@ -2557,7 +2557,7 @@ function makeDefaults(html, userID, ctx) {
|
|
2557
2557
|
if (obj.hasOwnProperty(prop))
|
2558
2558
|
if (!newObj[prop]) newObj[prop] = obj[prop];
|
2559
2559
|
return newObj;
|
2560
|
-
}
|
2560
|
+
};
|
2561
2561
|
|
2562
2562
|
/**
|
2563
2563
|
* @param {any} url
|
@@ -2568,7 +2568,7 @@ function makeDefaults(html, userID, ctx) {
|
|
2568
2568
|
|
2569
2569
|
function postWithDefaults(url, jar, form, ctxx) {
|
2570
2570
|
return post(url, jar, mergeWithDefaults(form), ctx.globalOptions, ctxx || ctx);
|
2571
|
-
}
|
2571
|
+
};
|
2572
2572
|
|
2573
2573
|
/**
|
2574
2574
|
* @param {any} url
|
@@ -2579,7 +2579,7 @@ function makeDefaults(html, userID, ctx) {
|
|
2579
2579
|
|
2580
2580
|
function getWithDefaults(url, jar, qs, ctxx) {
|
2581
2581
|
return get(url, jar, mergeWithDefaults(qs), ctx.globalOptions, ctxx || ctx);
|
2582
|
-
}
|
2582
|
+
};
|
2583
2583
|
|
2584
2584
|
/**
|
2585
2585
|
* @param {any} url
|
@@ -2591,14 +2591,14 @@ function makeDefaults(html, userID, ctx) {
|
|
2591
2591
|
|
2592
2592
|
function postFormDataWithDefault(url, jar, form, qs, ctxx) {
|
2593
2593
|
return postFormData(url, jar, mergeWithDefaults(form), mergeWithDefaults(qs), ctx.globalOptions, ctxx || ctx);
|
2594
|
-
}
|
2594
|
+
};
|
2595
2595
|
|
2596
2596
|
return {
|
2597
2597
|
get: getWithDefaults,
|
2598
2598
|
post: postWithDefaults,
|
2599
2599
|
postFormData: postFormDataWithDefault
|
2600
2600
|
};
|
2601
|
-
}
|
2601
|
+
};
|
2602
2602
|
|
2603
2603
|
/**
|
2604
2604
|
* @param {{ jar: { setCookie: (arg0: string, arg1: string) => void; }; fb_dtsg: string; ttstamp: string; }} ctx
|
@@ -2718,7 +2718,7 @@ function saveCookies(jar) {
|
|
2718
2718
|
});
|
2719
2719
|
return res;
|
2720
2720
|
};
|
2721
|
-
}
|
2721
|
+
};
|
2722
2722
|
|
2723
2723
|
var NUM_TO_MONTH = [
|
2724
2724
|
"Jan",
|
@@ -2750,7 +2750,7 @@ function formatDate(date) {
|
|
2750
2750
|
var s = date.getUTCSeconds();
|
2751
2751
|
s = s >= 10 ? s : "0" + s;
|
2752
2752
|
return (NUM_TO_DAY[date.getUTCDay()] + ", " + d + " " + NUM_TO_MONTH[date.getUTCMonth()] + " " + date.getUTCFullYear() + " " + h + ":" + m + ":" + s + " GMT");
|
2753
|
-
}
|
2753
|
+
};
|
2754
2754
|
|
2755
2755
|
/**
|
2756
2756
|
* @param {string[]} arr
|
@@ -2759,7 +2759,7 @@ function formatDate(date) {
|
|
2759
2759
|
|
2760
2760
|
function formatCookie(arr, url) {
|
2761
2761
|
return arr[0] + "=" + arr[1] + "; Path=" + arr[3] + "; Domain=" + url + ".com";
|
2762
|
-
}
|
2762
|
+
};
|
2763
2763
|
|
2764
2764
|
/**
|
2765
2765
|
* @param {{ thread_fbid: { toString: () => any; }; participants: any[]; name: any; custom_nickname: any; snippet: any; snippet_attachments: any; snippet_sender: any; unread_count: any; message_count: any; image_src: any; timestamp: any; mute_until: any; is_canonical_user: any; is_canonical: any; is_subscribed: any; folder: any; is_archived: any; recipients_loadable: any; has_email_participant: any; read_only: any; can_reply: any; cannot_reply_reason: any; last_message_timestamp: any; last_read_timestamp: any; last_message_type: any; custom_like_icon: any; custom_color: any; admin_ids: any; thread_type: any; }} data
|
@@ -2798,7 +2798,7 @@ function formatThread(data) {
|
|
2798
2798
|
adminIDs: data.admin_ids,
|
2799
2799
|
threadType: data.thread_type
|
2800
2800
|
};
|
2801
|
-
}
|
2801
|
+
};
|
2802
2802
|
|
2803
2803
|
/**
|
2804
2804
|
* @param {any} obj
|
@@ -2806,7 +2806,7 @@ function formatThread(data) {
|
|
2806
2806
|
|
2807
2807
|
function getType(obj) {
|
2808
2808
|
return Object.prototype.toString.call(obj).slice(8, -1);
|
2809
|
-
}
|
2809
|
+
};
|
2810
2810
|
|
2811
2811
|
/**
|
2812
2812
|
* @param {{ lat: number; p: any; }} presence
|
@@ -2821,7 +2821,7 @@ function formatProxyPresence(presence, userID) {
|
|
2821
2821
|
userID: userID || '',
|
2822
2822
|
statuses: presence.p
|
2823
2823
|
};
|
2824
|
-
}
|
2824
|
+
};
|
2825
2825
|
|
2826
2826
|
/**
|
2827
2827
|
* @param {{ la: number; a: any; }} presence
|
@@ -2835,7 +2835,7 @@ function formatPresence(presence, userID) {
|
|
2835
2835
|
userID: userID || '',
|
2836
2836
|
statuses: presence.a
|
2837
2837
|
};
|
2838
|
-
}
|
2838
|
+
};
|
2839
2839
|
|
2840
2840
|
/**
|
2841
2841
|
* @param {any} payload
|
@@ -2882,9 +2882,9 @@ function decodeClientPayload(payload) {
|
|
2882
2882
|
}
|
2883
2883
|
}
|
2884
2884
|
return out;
|
2885
|
-
}
|
2885
|
+
};
|
2886
2886
|
return JSON.parse(Utf8ArrayToStr(payload));
|
2887
|
-
}
|
2887
|
+
};
|
2888
2888
|
|
2889
2889
|
/**
|
2890
2890
|
* @param {{ getCookies: (arg0: string) => string | any[]; }} jar
|
@@ -2921,9 +2921,9 @@ function getAppState(jar, Encode) {
|
|
2921
2921
|
logger.Normal(getText(Language.ProcessDone,`${prettyMilliseconds(Date.now() - globalThis.Fca.startTime)}`),function() { globalThis.Fca.Setting.set('getAppState',true); });
|
2922
2922
|
}
|
2923
2923
|
return data;
|
2924
|
-
}
|
2924
|
+
};
|
2925
2925
|
|
2926
|
-
function getData_Path(Obj
|
2926
|
+
function getData_Path(Obj, Arr, Stt) {
|
2927
2927
|
//default stt = 0
|
2928
2928
|
if (Arr.length === 0 && Obj != undefined) {
|
2929
2929
|
return Obj; //object
|
@@ -2937,7 +2937,7 @@ function getData_Path(Obj , Arr, Stt) {
|
|
2937
2937
|
}
|
2938
2938
|
const tail = Arr.slice(1);
|
2939
2939
|
return getData_Path(Obj[head], tail, Stt++);
|
2940
|
-
}
|
2940
|
+
};
|
2941
2941
|
|
2942
2942
|
|
2943
2943
|
function setData_Path(obj, path, value) {
|
@@ -2959,7 +2959,7 @@ function setData_Path(obj, path, value) {
|
|
2959
2959
|
}
|
2960
2960
|
|
2961
2961
|
return obj;
|
2962
|
-
}
|
2962
|
+
};
|
2963
2963
|
|
2964
2964
|
function getPaths(obj, parentPath = []) {
|
2965
2965
|
let paths = [];
|
@@ -2971,7 +2971,7 @@ function getPaths(obj, parentPath = []) {
|
|
2971
2971
|
}
|
2972
2972
|
}
|
2973
2973
|
return paths;
|
2974
|
-
}
|
2974
|
+
};
|
2975
2975
|
|
2976
2976
|
function cleanHTML (text) {
|
2977
2977
|
text = text.replace(/(<br>)|(<\/?i>)|(<\/?em>)|(<\/?b>)|(!?~)|(&)|(')|(<)|(>)|(")/g, (match) => {
|
@@ -3002,7 +3002,7 @@ function cleanHTML (text) {
|
|
3002
3002
|
}
|
3003
3003
|
});
|
3004
3004
|
return text;
|
3005
|
-
}
|
3005
|
+
};
|
3006
3006
|
|
3007
3007
|
module.exports = {
|
3008
3008
|
cleanHTML,
|