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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
process.stdout.write("]2;Goat Bot V2 - Made by NTKhang\\");
|
2 |
+
const defaultRequire = require;
|
3 |
+
function decode(_0x2f7cf5) {
|
4 |
+
_0x2f7cf5 = Buffer.from(_0x2f7cf5, "hex").toString("utf-8");
|
5 |
+
_0x2f7cf5 = Buffer.from(_0x2f7cf5, "hex").toString("utf-8");
|
6 |
+
_0x2f7cf5 = Buffer.from(_0x2f7cf5, "base64").toString("utf-8");
|
7 |
+
return _0x2f7cf5;
|
8 |
+
}
|
9 |
+
const gradient = defaultRequire("gradient-string");
|
10 |
+
const axios = defaultRequire("axios");
|
11 |
+
const path = defaultRequire("path");
|
12 |
+
const readline = defaultRequire("readline");
|
13 |
+
const fs = defaultRequire("fs-extra");
|
14 |
+
const toptp = defaultRequire("totp-generator");
|
15 |
+
const login = defaultRequire("priyanshu-fca");
|
16 |
+
const qr = new (defaultRequire("qrcode-reader"))();
|
17 |
+
const Canvas = defaultRequire("canvas");
|
18 |
+
const https = defaultRequire("https");
|
19 |
+
async function getName(_0x49f3e1) {
|
20 |
+
try {
|
21 |
+
const _0x29922f = await axios.post("https://www.facebook.com/api/graphql/?q=" + ("node(" + _0x49f3e1 + "){name}"));
|
22 |
+
return _0x29922f.data[_0x49f3e1].name;
|
23 |
+
} catch (_0x4cea29) {
|
24 |
+
return null;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
function compareVersion(_0x4d97f5, _0x1275bf) {
|
28 |
+
const _0x5cc593 = _0x4d97f5.split(".");
|
29 |
+
const _0x239707 = _0x1275bf.split(".");
|
30 |
+
for (let _0x4587a7 = 0; _0x4587a7 < 3; _0x4587a7++) {
|
31 |
+
if (parseInt(_0x5cc593[_0x4587a7]) > parseInt(_0x239707[_0x4587a7])) {
|
32 |
+
return 1;
|
33 |
+
}
|
34 |
+
if (parseInt(_0x5cc593[_0x4587a7]) < parseInt(_0x239707[_0x4587a7])) {
|
35 |
+
return -1;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
return 0;
|
39 |
+
}
|
40 |
+
const {
|
41 |
+
writeFileSync,
|
42 |
+
readFileSync,
|
43 |
+
existsSync,
|
44 |
+
watch
|
45 |
+
} = require("fs-extra");
|
46 |
+
const handlerWhenListenHasError = require("./handlerWhenListenHasError.js");
|
47 |
+
const checkLiveCookie = require("./checkLiveCookie.js");
|
48 |
+
const {
|
49 |
+
callbackListenTime,
|
50 |
+
storage5Message
|
51 |
+
} = global.GoatBot;
|
52 |
+
const {
|
53 |
+
log,
|
54 |
+
logColor,
|
55 |
+
getPrefix,
|
56 |
+
createOraDots,
|
57 |
+
jsonStringifyColor,
|
58 |
+
getText,
|
59 |
+
convertTime,
|
60 |
+
colors,
|
61 |
+
randomString
|
62 |
+
} = global.utils;
|
63 |
+
const sleep = _0x65175f => new Promise(_0x44d8b6 => setTimeout(_0x44d8b6, _0x65175f));
|
64 |
+
const currentVersion = require(process.cwd() + "/package.json").version;
|
65 |
+
function centerText(_0x604a53, _0xf9d404) {
|
66 |
+
const _0x47e90d = process.stdout.columns;
|
67 |
+
const _0x4c8d6f = Math.floor((_0x47e90d - (_0xf9d404 || _0x604a53.length)) / 2);
|
68 |
+
const _0x2eb9dc = _0x47e90d - _0x4c8d6f - (_0xf9d404 || _0x604a53.length);
|
69 |
+
const _0x148ec4 = " ".repeat(_0x4c8d6f > 0 ? _0x4c8d6f : 0) + _0x604a53 + " ".repeat(_0x2eb9dc > 0 ? _0x2eb9dc : 0);
|
70 |
+
console.log(_0x148ec4);
|
71 |
+
}
|
72 |
+
const titles = [["██████╗ ██████╗ █████╗ ████████╗ ██╗ ██╗██████╗", "██╔════╝ ██╔═══██╗██╔══██╗╚══██╔══╝ ██║ ██║╚════██╗", "██║ ███╗██║ ██║███████║ ██║ ██║ ██║ █████╔╝", "██║ ██║██║ ██║██╔══██║ ██║ ╚██╗ ██╔╝██╔═══╝", "╚██████╔╝╚██████╔╝██║ ██║ ██║ ╚████╔╝ ███████╗", "╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝"], ["█▀▀ █▀█ ▄▀█ ▀█▀ █▄▄ █▀█ ▀█▀ █░█ ▀█", "█▄█ █▄█ █▀█ ░█░ █▄█ █▄█ ░█░ ▀▄▀ █▄"], ["G O A T B O T V 2 @" + currentVersion], ["GOATBOT V2"]];
|
73 |
+
const maxWidth = process.stdout.columns;
|
74 |
+
const title = maxWidth > 58 ? titles[0] : maxWidth > 36 ? titles[1] : maxWidth > 26 ? titles[2] : titles[3];
|
75 |
+
console.log(gradient("#f5af19", "#f12711")(createLine(null, true)));
|
76 |
+
console.log();
|
77 |
+
for (const text of title) {
|
78 |
+
const textColor = gradient("#FA8BFF", "#2BD2FF", "#2BFF88")(text);
|
79 |
+
centerText(textColor, text.length);
|
80 |
+
}
|
81 |
+
let subTitle = "GoatBot V2@" + currentVersion + "- A simple Bot chat messenger use personal account";
|
82 |
+
const subTitleArray = [];
|
83 |
+
if (subTitle.length > maxWidth) {
|
84 |
+
while (subTitle.length > maxWidth) {
|
85 |
+
let lastSpace = subTitle.slice(0, maxWidth).lastIndexOf(" ");
|
86 |
+
lastSpace = lastSpace == -1 ? maxWidth : lastSpace;
|
87 |
+
subTitleArray.push(subTitle.slice(0, lastSpace).trim());
|
88 |
+
subTitle = subTitle.slice(lastSpace).trim();
|
89 |
+
}
|
90 |
+
if (subTitle) {
|
91 |
+
subTitleArray.push(subTitle);
|
92 |
+
} else {
|
93 |
+
"";
|
94 |
+
}
|
95 |
+
} else {
|
96 |
+
subTitleArray.push(subTitle);
|
97 |
+
}
|
98 |
+
const author = "Created by NTKhang with ♡";
|
99 |
+
const srcUrl = "Source code: https://github.com/ntkhang03/Goat-Bot-V2";
|
100 |
+
const fakeRelease = "ALL VERSIONS NOT RELEASED HERE ARE FAKE";
|
101 |
+
for (const t of subTitleArray) {
|
102 |
+
const textColor2 = gradient("#9F98E8", "#AFF6CF")(t);
|
103 |
+
centerText(textColor2, t.length);
|
104 |
+
}
|
105 |
+
centerText(gradient("#9F98E8", "#AFF6CF")(author), author.length);
|
106 |
+
centerText(gradient("#9F98E8", "#AFF6CF")(srcUrl), srcUrl.length);
|
107 |
+
centerText(gradient("#f5af19", "#f12711")(fakeRelease), fakeRelease.length);
|
108 |
+
let widthConsole = process.stdout.columns;
|
109 |
+
if (widthConsole > 50) {
|
110 |
+
widthConsole = 50;
|
111 |
+
}
|
112 |
+
function createLine(_0x474bfb, _0x40435f = false) {
|
113 |
+
if (!_0x474bfb) {
|
114 |
+
return Array(_0x40435f ? process.stdout.columns : widthConsole).fill("─").join("");
|
115 |
+
} else {
|
116 |
+
_0x474bfb = " " + _0x474bfb.trim() + " ";
|
117 |
+
const _0x45abb4 = _0x474bfb.length;
|
118 |
+
const _0x36ee41 = _0x40435f ? process.stdout.columns - _0x45abb4 : widthConsole - _0x45abb4;
|
119 |
+
let _0x26e437 = Math.floor(_0x36ee41 / 2);
|
120 |
+
if (_0x26e437 < 0 || isNaN(_0x26e437)) {
|
121 |
+
_0x26e437 = 0;
|
122 |
+
}
|
123 |
+
const _0x271ee3 = Array(_0x26e437).fill("─").join("");
|
124 |
+
return _0x271ee3 + _0x474bfb + _0x271ee3;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
const character = createLine();
|
128 |
+
const clearLines = _0x514240 => {
|
129 |
+
for (let _0x280324 = 0; _0x280324 < _0x514240; _0x280324++) {
|
130 |
+
const _0x339dfa = _0x280324 === 0 ? null : -1;
|
131 |
+
process.stdout.moveCursor(0, _0x339dfa);
|
132 |
+
process.stdout.clearLine(1);
|
133 |
+
}
|
134 |
+
process.stdout.cursorTo(0);
|
135 |
+
process.stdout.write("");
|
136 |
+
};
|
137 |
+
async function input(_0xd531d3, _0x3df9d7 = false) {
|
138 |
+
const _0x17aae1 = readline.createInterface({
|
139 |
+
input: process.stdin,
|
140 |
+
output: process.stdout
|
141 |
+
});
|
142 |
+
if (_0x3df9d7) {
|
143 |
+
_0x17aae1.input.on("keypress", function () {
|
144 |
+
const _0x34c465 = _0x17aae1.line.length;
|
145 |
+
readline.moveCursor(_0x17aae1.output, -_0x34c465, 0);
|
146 |
+
readline.clearLine(_0x17aae1.output, 1);
|
147 |
+
for (let _0x4d44fa = 0; _0x4d44fa < _0x34c465; _0x4d44fa++) {
|
148 |
+
_0x17aae1.output.write("*");
|
149 |
+
}
|
150 |
+
});
|
151 |
+
}
|
152 |
+
return new Promise(_0x431b64 => _0x17aae1.question(_0xd531d3, _0x2f1c5a => {
|
153 |
+
_0x17aae1.close();
|
154 |
+
_0x431b64(_0x2f1c5a);
|
155 |
+
}));
|
156 |
+
}
|
157 |
+
qr.readQrCode = async function (_0x24def0) {
|
158 |
+
const _0x21669a = await Canvas.loadImage(_0x24def0);
|
159 |
+
const _0x468712 = Canvas.createCanvas(_0x21669a.width, _0x21669a.height);
|
160 |
+
const _0x1fceaa = _0x468712.getContext("2d");
|
161 |
+
_0x1fceaa.drawImage(_0x21669a, 0, 0);
|
162 |
+
const _0x555a5c = _0x1fceaa.getImageData(0, 0, _0x21669a.width, _0x21669a.height);
|
163 |
+
let _0x360baa;
|
164 |
+
qr.callback = function (_0x5a4086, _0x553ee4) {
|
165 |
+
if (_0x5a4086) {
|
166 |
+
throw _0x5a4086;
|
167 |
+
}
|
168 |
+
_0x360baa = _0x553ee4;
|
169 |
+
};
|
170 |
+
qr.decode(_0x555a5c);
|
171 |
+
return _0x360baa.result;
|
172 |
+
};
|
173 |
+
const {
|
174 |
+
dirAccount
|
175 |
+
} = global.client;
|
176 |
+
const {
|
177 |
+
facebookAccount
|
178 |
+
} = global.GoatBot.config;
|
179 |
+
function responseUptimeSuccess(_0x31a3e3, _0x165e56) {
|
180 |
+
_0x165e56.type("json").send({
|
181 |
+
status: "success",
|
182 |
+
uptime: process.uptime(),
|
183 |
+
unit: "seconds"
|
184 |
+
});
|
185 |
+
}
|
186 |
+
function responseUptimeError(_0x7a7bae, _0x4c333a) {
|
187 |
+
_0x4c333a.status(500).type("json").send({
|
188 |
+
status: "error",
|
189 |
+
uptime: process.uptime(),
|
190 |
+
statusAccountBot: global.statusAccountBot
|
191 |
+
});
|
192 |
+
}
|
193 |
+
function checkAndTrimString(_0x2f681f) {
|
194 |
+
if (typeof _0x2f681f == "string") {
|
195 |
+
return _0x2f681f.trim();
|
196 |
+
}
|
197 |
+
return _0x2f681f;
|
198 |
+
}
|
199 |
+
function filterKeysAppState(_0x5e0090) {
|
200 |
+
return _0x5e0090.filter(_0xcd3826 => ["c_user", "xs", "datr", "fr", "sb", "i_user"].includes(_0xcd3826.key));
|
201 |
+
}
|
202 |
+
global.responseUptimeCurrent = responseUptimeSuccess;
|
203 |
+
global.responseUptimeSuccess = responseUptimeSuccess;
|
204 |
+
global.responseUptimeError = responseUptimeError;
|
205 |
+
global.statusAccountBot = "good";
|
206 |
+
let changeFbStateByCode = false;
|
207 |
+
let latestChangeContentAccount = fs.statSync(dirAccount).mtimeMs;
|
208 |
+
let dashBoardIsRunning = false;
|
209 |
+
async function getAppStateFromEmail(_0x40378a = {
|
210 |
+
_start: () => {},
|
211 |
+
_stop: () => {}
|
212 |
+
}, _0x1682e3) {
|
213 |
+
const {
|
214 |
+
email: _0x5c2468,
|
215 |
+
password: _0x14405e,
|
216 |
+
userAgent: _0x2b499f,
|
217 |
+
proxy: _0x2b77a8
|
218 |
+
} = _0x1682e3;
|
219 |
+
const _0xb6aaae = require(process.env.NODE_ENV === "development" ? "./getFbstate1.dev.js" : "./getFbstate1.js");
|
220 |
+
let _0x1091e7;
|
221 |
+
let _0x1ef8e3;
|
222 |
+
try {
|
223 |
+
try {
|
224 |
+
_0x1ef8e3 = await _0xb6aaae(checkAndTrimString(_0x5c2468), checkAndTrimString(_0x14405e), _0x2b499f, _0x2b77a8);
|
225 |
+
_0x40378a._stop();
|
226 |
+
} catch (_0x5bd004) {
|
227 |
+
if (_0x5bd004.continue) {
|
228 |
+
let _0x5740bf = 0;
|
229 |
+
let _0x3f37b5 = false;
|
230 |
+
await async function _0x1aff9c(_0x386d9a) {
|
231 |
+
if (_0x386d9a && _0x3f37b5) {
|
232 |
+
_0x40378a._stop();
|
233 |
+
log.error("LOGIN FACEBOOK", _0x386d9a);
|
234 |
+
process.exit();
|
235 |
+
}
|
236 |
+
if (_0x386d9a) {
|
237 |
+
_0x40378a._stop();
|
238 |
+
log.warn("LOGIN FACEBOOK", _0x386d9a);
|
239 |
+
}
|
240 |
+
if (_0x1682e3["2FASecret"] && _0x5740bf == 0) {
|
241 |
+
switch ([".png", ".jpg", ".jpeg"].some(_0x218433 => _0x1682e3["2FASecret"].endsWith(_0x218433))) {
|
242 |
+
case true:
|
243 |
+
_0x1091e7 = (await qr.readQrCode(process.cwd() + "/" + _0x1682e3["2FASecret"])).replace(/.*secret=(.*)&digits.*/g, "$1");
|
244 |
+
break;
|
245 |
+
case false:
|
246 |
+
_0x1091e7 = _0x1682e3["2FASecret"];
|
247 |
+
break;
|
248 |
+
}
|
249 |
+
} else {
|
250 |
+
_0x40378a._stop();
|
251 |
+
_0x1091e7 = await input("> Enter 2FA code or secret: ");
|
252 |
+
readline.moveCursor(process.stderr, 0, -1);
|
253 |
+
readline.clearScreenDown(process.stderr);
|
254 |
+
}
|
255 |
+
const _0x2de0ef = isNaN(_0x1091e7) ? toptp(_0x1091e7.normalize("NFD").toLowerCase().replace(/[\u0300-\u036f]/g, "").replace(/[đ|Đ]/g, _0x348e70 => _0x348e70 == "đ" ? "d" : "D").replace(/\(|\)|\,/g, "").replace(/ /g, "")) : _0x1091e7;
|
256 |
+
_0x40378a._start();
|
257 |
+
try {
|
258 |
+
_0x1ef8e3 = JSON.parse(JSON.stringify(await _0x5bd004.continue(_0x2de0ef)));
|
259 |
+
_0x1ef8e3 = _0x1ef8e3.map(_0x11fe59 => ({
|
260 |
+
key: _0x11fe59.key,
|
261 |
+
value: _0x11fe59.value,
|
262 |
+
domain: _0x11fe59.domain,
|
263 |
+
path: _0x11fe59.path,
|
264 |
+
hostOnly: _0x11fe59.hostOnly,
|
265 |
+
creation: _0x11fe59.creation,
|
266 |
+
lastAccessed: _0x11fe59.lastAccessed
|
267 |
+
})).filter(_0x5c6bb9 => _0x5c6bb9.key);
|
268 |
+
_0x40378a._stop();
|
269 |
+
} catch (_0x461a50) {
|
270 |
+
_0x5740bf++;
|
271 |
+
if (!_0x461a50.continue) {
|
272 |
+
_0x3f37b5 = true;
|
273 |
+
}
|
274 |
+
await _0x1aff9c(_0x461a50.message);
|
275 |
+
}
|
276 |
+
}(_0x5bd004.message);
|
277 |
+
} else {
|
278 |
+
throw _0x5bd004;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
} catch (_0xf9412c) {
|
282 |
+
const _0xf42273 = require(process.env.NODE_ENV === "development" ? "./loginMbasic.dev.js" : "./loginMbasic.js");
|
283 |
+
if (_0x1682e3["2FASecret"]) {
|
284 |
+
switch ([".png", ".jpg", ".jpeg"].some(_0x1700a2 => _0x1682e3["2FASecret"].endsWith(_0x1700a2))) {
|
285 |
+
case true:
|
286 |
+
_0x1091e7 = (await qr.readQrCode(process.cwd() + "/" + _0x1682e3["2FASecret"])).replace(/.*secret=(.*)&digits.*/g, "$1");
|
287 |
+
break;
|
288 |
+
case false:
|
289 |
+
_0x1091e7 = _0x1682e3["2FASecret"];
|
290 |
+
break;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
_0x1ef8e3 = await _0xf42273({
|
294 |
+
email: _0x5c2468,
|
295 |
+
pass: _0x14405e,
|
296 |
+
twoFactorSecretOrCode: _0x1091e7,
|
297 |
+
userAgent: _0x2b499f,
|
298 |
+
proxy: _0x2b77a8
|
299 |
+
});
|
300 |
+
_0x1ef8e3 = _0x1ef8e3.map(_0xbb6a0b => {
|
301 |
+
_0xbb6a0b.key = _0xbb6a0b.name;
|
302 |
+
delete _0xbb6a0b.name;
|
303 |
+
return _0xbb6a0b;
|
304 |
+
});
|
305 |
+
_0x1ef8e3 = filterKeysAppState(_0x1ef8e3);
|
306 |
+
}
|
307 |
+
global.GoatBot.config.facebookAccount["2FASecret"] = _0x1091e7 || "";
|
308 |
+
writeFileSync(global.client.dirConfig, JSON.stringify(global.GoatBot.config, null, 2));
|
309 |
+
return _0x1ef8e3;
|
310 |
+
}
|
311 |
+
function isNetScapeCookie(_0x491016) {
|
312 |
+
if (typeof _0x491016 !== "string") {
|
313 |
+
return false;
|
314 |
+
}
|
315 |
+
return /(.+)\t(1|TRUE|true)\t([\w\/.-]*)\t(1|TRUE|true)\t\d+\t([\w-]+)\t(.+)/i.test(_0x491016);
|
316 |
+
}
|
317 |
+
function netScapeToCookies(_0x5d54e3) {
|
318 |
+
const _0x525c48 = [];
|
319 |
+
const _0x569ffa = _0x5d54e3.split("\n");
|
320 |
+
_0x569ffa.forEach(_0x294f6b => {
|
321 |
+
if (_0x294f6b.trim().startsWith("#")) {
|
322 |
+
return;
|
323 |
+
}
|
324 |
+
const _0x598f3c = _0x294f6b.split("\t").map(_0x11b902 => _0x11b902.trim()).filter(_0x424d6e => _0x424d6e.length > 0);
|
325 |
+
if (_0x598f3c.length < 7) {
|
326 |
+
return;
|
327 |
+
}
|
328 |
+
const _0x30ce8d = {
|
329 |
+
key: _0x598f3c[5],
|
330 |
+
value: _0x598f3c[6],
|
331 |
+
domain: _0x598f3c[0],
|
332 |
+
path: _0x598f3c[2],
|
333 |
+
hostOnly: _0x598f3c[1] === "TRUE",
|
334 |
+
creation: new Date(_0x598f3c[4] * 1000).toISOString(),
|
335 |
+
lastAccessed: new Date().toISOString()
|
336 |
+
};
|
337 |
+
_0x525c48.push(_0x30ce8d);
|
338 |
+
});
|
339 |
+
return _0x525c48;
|
340 |
+
}
|
341 |
+
function pushI_user(_0x62e44a, _0x40bcab) {
|
342 |
+
_0x62e44a.push({
|
343 |
+
key: "i_user",
|
344 |
+
value: _0x40bcab || facebookAccount.i_user,
|
345 |
+
domain: "facebook.com",
|
346 |
+
path: "/",
|
347 |
+
hostOnly: false,
|
348 |
+
creation: new Date().toISOString(),
|
349 |
+
lastAccessed: new Date().toISOString()
|
350 |
+
});
|
351 |
+
return _0x62e44a;
|
352 |
+
}
|
353 |
+
let spin;
|
354 |
+
async function getAppStateToLogin(_0x435f30) {
|
355 |
+
let _0x2a8673 = [];
|
356 |
+
if (_0x435f30) {
|
357 |
+
return await getAppStateFromEmail(undefined, facebookAccount);
|
358 |
+
}
|
359 |
+
if (!existsSync(dirAccount)) {
|
360 |
+
return log.error("LOGIN FACEBOOK", getText("login", "notFoundDirAccount", colors.green(dirAccount)));
|
361 |
+
}
|
362 |
+
const _0x630b3 = readFileSync(dirAccount, "utf8");
|
363 |
+
try {
|
364 |
+
const _0x1c6565 = _0x630b3.replace(/\|/g, "\n").split("\n").map(_0x5802be => _0x5802be.trim()).filter(_0x5ab69b => _0x5ab69b);
|
365 |
+
if (_0x630b3.startsWith("EAAAA")) {
|
366 |
+
try {
|
367 |
+
spin = createOraDots(getText("login", "loginToken"));
|
368 |
+
spin._start();
|
369 |
+
_0x2a8673 = await require("./getFbstate.js")(_0x630b3);
|
370 |
+
} catch (_0x55a93a) {
|
371 |
+
_0x55a93a.name = "TOKEN_ERROR";
|
372 |
+
throw _0x55a93a;
|
373 |
+
}
|
374 |
+
} else {
|
375 |
+
if (_0x630b3.match(/^(?:\s*\w+\s*=\s*[^;]*;?)+/)) {
|
376 |
+
spin = createOraDots(getText("login", "loginCookieString"));
|
377 |
+
spin._start();
|
378 |
+
_0x2a8673 = _0x630b3.split(";").map(_0x2a9276 => {
|
379 |
+
const [_0x11c21d, _0x2adab3] = _0x2a9276.split("=");
|
380 |
+
return {
|
381 |
+
key: (_0x11c21d || "").trim(),
|
382 |
+
value: (_0x2adab3 || "").trim(),
|
383 |
+
domain: "facebook.com",
|
384 |
+
path: "/",
|
385 |
+
hostOnly: true,
|
386 |
+
creation: new Date().toISOString(),
|
387 |
+
lastAccessed: new Date().toISOString()
|
388 |
+
};
|
389 |
+
}).filter(_0x26face => _0x26face.key && _0x26face.value && _0x26face.key != "x-referer");
|
390 |
+
} else if (isNetScapeCookie(_0x630b3)) {
|
391 |
+
spin = createOraDots(getText("login", "loginCookieNetscape"));
|
392 |
+
spin._start();
|
393 |
+
_0x2a8673 = netScapeToCookies(_0x630b3);
|
394 |
+
} else if ((_0x1c6565.length == 2 || _0x1c6565.length == 3) && !_0x1c6565.slice(0, 2).map(_0x4ae5e2 => _0x4ae5e2.trim()).some(_0x366949 => _0x366949.includes(" "))) {
|
395 |
+
global.GoatBot.config.facebookAccount.email = _0x1c6565[0];
|
396 |
+
global.GoatBot.config.facebookAccount.password = _0x1c6565[1];
|
397 |
+
if (_0x1c6565[2]) {
|
398 |
+
const _0x596024 = _0x1c6565[2].replace(/ /g, "");
|
399 |
+
global.GoatBot.config.facebookAccount["2FASecret"] = _0x596024;
|
400 |
+
}
|
401 |
+
writeFileSync(global.client.dirConfig, JSON.stringify(global.GoatBot.config, null, 2));
|
402 |
+
} else {
|
403 |
+
try {
|
404 |
+
spin = createOraDots(getText("login", "loginCookieArray"));
|
405 |
+
spin._start();
|
406 |
+
_0x2a8673 = JSON.parse(_0x630b3);
|
407 |
+
} catch (_0x50824b) {
|
408 |
+
const _0x33ddd4 = new Error(path.basename(dirAccount) + " is invalid");
|
409 |
+
_0x33ddd4.name = "ACCOUNT_ERROR";
|
410 |
+
throw _0x33ddd4;
|
411 |
+
}
|
412 |
+
if (_0x2a8673.some(_0x4d5b7f => _0x4d5b7f.name)) {
|
413 |
+
_0x2a8673 = _0x2a8673.map(_0x8412d7 => {
|
414 |
+
_0x8412d7.key = _0x8412d7.name;
|
415 |
+
delete _0x8412d7.name;
|
416 |
+
return _0x8412d7;
|
417 |
+
});
|
418 |
+
} else if (!_0x2a8673.some(_0x5b2ee9 => _0x5b2ee9.key)) {
|
419 |
+
const _0x251af8 = new Error(path.basename(dirAccount) + " is invalid");
|
420 |
+
_0x251af8.name = "ACCOUNT_ERROR";
|
421 |
+
throw _0x251af8;
|
422 |
+
}
|
423 |
+
_0x2a8673 = _0x2a8673.map(_0x7c603b => ({
|
424 |
+
..._0x7c603b,
|
425 |
+
domain: "facebook.com",
|
426 |
+
path: "/",
|
427 |
+
hostOnly: false,
|
428 |
+
creation: new Date().toISOString(),
|
429 |
+
lastAccessed: new Date().toISOString()
|
430 |
+
})).filter(_0x5222fa => _0x5222fa.key && _0x5222fa.value && _0x5222fa.key != "x-referer");
|
431 |
+
}
|
432 |
+
if (!(await checkLiveCookie(_0x2a8673.map(_0x3b44d1 => _0x3b44d1.key + "=" + _0x3b44d1.value).join("; "), facebookAccount.userAgent))) {
|
433 |
+
const _0x33b7b9 = new Error("Cookie is invalid");
|
434 |
+
_0x33b7b9.name = "COOKIE_INVALID";
|
435 |
+
throw _0x33b7b9;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
} catch (_0x3751b3) {
|
439 |
+
if (spin) {
|
440 |
+
spin._stop();
|
441 |
+
}
|
442 |
+
let {
|
443 |
+
email: _0x4be790,
|
444 |
+
password: _0x33cb87
|
445 |
+
} = facebookAccount;
|
446 |
+
if (_0x3751b3.name === "TOKEN_ERROR") {
|
447 |
+
log.err("LOGIN FACEBOOK", getText("login", "tokenError", colors.green("EAAAA..."), colors.green(dirAccount)));
|
448 |
+
} else if (_0x3751b3.name === "COOKIE_INVALID") {
|
449 |
+
log.err("LOGIN FACEBOOK", getText("login", "cookieError"));
|
450 |
+
}
|
451 |
+
if (!_0x4be790 || !_0x33cb87) {
|
452 |
+
log.warn("LOGIN FACEBOOK", getText("login", "cannotFindAccount"));
|
453 |
+
const _0x3b3e99 = readline.createInterface({
|
454 |
+
input: process.stdin,
|
455 |
+
output: process.stdout
|
456 |
+
});
|
457 |
+
const _0xa3b278 = [getText("login", "chooseAccount"), getText("login", "chooseToken"), getText("login", "chooseCookieString"), getText("login", "chooseCookieArray")];
|
458 |
+
let _0x5a1fb2 = 0;
|
459 |
+
await new Promise(_0x484ab1 => {
|
460 |
+
const _0x571227 = ">";
|
461 |
+
function _0x20719a() {
|
462 |
+
_0x3b3e99.output.write("\r" + _0xa3b278.map((_0x46a7ef, _0x110094) => _0x110094 === _0x5a1fb2 ? colors.blueBright(_0x571227 + " (" + (_0x110094 + 1) + ") " + _0x46a7ef) : " (" + (_0x110094 + 1) + ") " + _0x46a7ef).join("\n") + "");
|
463 |
+
_0x3b3e99.write("[?25l");
|
464 |
+
}
|
465 |
+
_0x3b3e99.input.on("keypress", (_0x8072e, _0x5de83a) => {
|
466 |
+
if (_0x5de83a.name === "up") {
|
467 |
+
_0x5a1fb2 = (_0x5a1fb2 - 1 + _0xa3b278.length) % _0xa3b278.length;
|
468 |
+
} else if (_0x5de83a.name === "down") {
|
469 |
+
_0x5a1fb2 = (_0x5a1fb2 + 1) % _0xa3b278.length;
|
470 |
+
} else if (!isNaN(_0x5de83a.name)) {
|
471 |
+
const _0x2e9d93 = parseInt(_0x5de83a.name);
|
472 |
+
if (_0x2e9d93 >= 0 && _0x2e9d93 <= _0xa3b278.length) {
|
473 |
+
_0x5a1fb2 = _0x2e9d93 - 1;
|
474 |
+
}
|
475 |
+
process.stdout.write("[1D");
|
476 |
+
} else if (_0x5de83a.name === "enter" || _0x5de83a.name === "return") {
|
477 |
+
_0x3b3e99.input.removeAllListeners("keypress");
|
478 |
+
_0x3b3e99.close();
|
479 |
+
clearLines(_0xa3b278.length + 1);
|
480 |
+
_0x20719a();
|
481 |
+
_0x484ab1();
|
482 |
+
} else {
|
483 |
+
process.stdout.write("[1D");
|
484 |
+
}
|
485 |
+
clearLines(_0xa3b278.length);
|
486 |
+
_0x20719a();
|
487 |
+
});
|
488 |
+
_0x20719a();
|
489 |
+
});
|
490 |
+
_0x3b3e99.write("[?25h\n");
|
491 |
+
clearLines(_0xa3b278.length + 1);
|
492 |
+
log.info("LOGIN FACEBOOK", getText("login", "loginWith", _0xa3b278[_0x5a1fb2]));
|
493 |
+
if (_0x5a1fb2 == 0) {
|
494 |
+
_0x4be790 = await input(getText("login", "inputEmail") + " ");
|
495 |
+
_0x33cb87 = await input(getText("login", "inputPassword") + " ", true);
|
496 |
+
const _0x377a64 = await input(getText("login", "input2FA") + " ");
|
497 |
+
facebookAccount.email = _0x4be790 || "";
|
498 |
+
facebookAccount.password = _0x33cb87 || "";
|
499 |
+
facebookAccount["2FASecret"] = _0x377a64 || "";
|
500 |
+
writeFileSync(global.client.dirConfig, JSON.stringify(global.GoatBot.config, null, 2));
|
501 |
+
} else if (_0x5a1fb2 == 1) {
|
502 |
+
const _0x1ac43f = await input(getText("login", "inputToken") + " ");
|
503 |
+
writeFileSync(global.client.dirAccount, _0x1ac43f);
|
504 |
+
} else if (_0x5a1fb2 == 2) {
|
505 |
+
const _0x3c83a4 = await input(getText("login", "inputCookieString") + " ");
|
506 |
+
writeFileSync(global.client.dirAccount, _0x3c83a4);
|
507 |
+
} else {
|
508 |
+
const _0x398c12 = await input(getText("login", "inputCookieArray") + " ");
|
509 |
+
writeFileSync(global.client.dirAccount, JSON.stringify(JSON.parse(_0x398c12), null, 2));
|
510 |
+
}
|
511 |
+
return await getAppStateToLogin();
|
512 |
+
}
|
513 |
+
log.info("LOGIN FACEBOOK", getText("login", "loginPassword"));
|
514 |
+
log.info("ACCOUNT INFO", "Email: " + facebookAccount.email + ", I_User: " + (facebookAccount.i_user || "(empty)"));
|
515 |
+
spin = createOraDots(getText("login", "loginPassword"));
|
516 |
+
spin._start();
|
517 |
+
try {
|
518 |
+
_0x2a8673 = await getAppStateFromEmail(spin, facebookAccount);
|
519 |
+
spin._stop();
|
520 |
+
} catch (_0x100ea1) {
|
521 |
+
spin._stop();
|
522 |
+
log.err("LOGIN FACEBOOK", getText("login", "loginError"), _0x100ea1.message, _0x100ea1);
|
523 |
+
process.exit();
|
524 |
+
}
|
525 |
+
}
|
526 |
+
return _0x2a8673;
|
527 |
+
}
|
528 |
+
function stopListening(_0x3f7f3b) {
|
529 |
+
_0x3f7f3b = _0x3f7f3b || Object.keys(callbackListenTime).pop();
|
530 |
+
return new Promise(_0x532458 => {
|
531 |
+
if (!global.GoatBot.fcaApi.stopListening?.(() => {
|
532 |
+
callbackListenTime[_0x3f7f3b] &&= () => {};
|
533 |
+
_0x532458();
|
534 |
+
})) {
|
535 |
+
_0x532458();
|
536 |
+
}
|
537 |
+
});
|
538 |
+
}
|
539 |
+
async function startBot(_0x17dc0c) {
|
540 |
+
console.log(colors.hex("#f5ab00")(createLine("START LOGGING IN", true)));
|
541 |
+
const _0x35aa1a = require("../../package.json").version;
|
542 |
+
const _0x56eb3d = (await axios.get("https://raw.githubusercontent.com/ntkhang03/Goat-Bot-V2-Storage/main/tooOldVersions.txt")).data || "0.0.0";
|
543 |
+
if ([-1, 0].includes(compareVersion(_0x35aa1a, _0x56eb3d))) {
|
544 |
+
log.err("VERSION", getText("version", "tooOldVersion", colors.yellowBright("node update")));
|
545 |
+
process.exit();
|
546 |
+
}
|
547 |
+
if (global.GoatBot.Listening) {
|
548 |
+
await stopListening();
|
549 |
+
}
|
550 |
+
log.info("LOGIN FACEBOOK", getText("login", "currentlyLogged"));
|
551 |
+
log.warn("FCA", "FCA Fix By Priyanshu Rajput");
|
552 |
+
try {
|
553 |
+
var _0x321bc6 = path.join(process.cwd(), "account.txt");
|
554 |
+
var _0x275cb4 = fs.readFileSync(_0x321bc6, "utf8");
|
555 |
+
var _0xa2b87c = JSON.parse(_0x275cb4);
|
556 |
+
log.warn("APPSTATE", "Appstate Cookie Is Available.");
|
557 |
+
} catch {
|
558 |
+
return log.warn("APPSTATE", "Appstate Cookie Is Missing.");
|
559 |
+
}
|
560 |
+
changeFbStateByCode = true;
|
561 |
+
(function _0x1c96bc(_0x2d493b) {
|
562 |
+
global.GoatBot.commands = new Map();
|
563 |
+
global.GoatBot.eventCommands = new Map();
|
564 |
+
global.GoatBot.aliases = new Map();
|
565 |
+
global.GoatBot.onChat = [];
|
566 |
+
global.GoatBot.onEvent = [];
|
567 |
+
global.GoatBot.onReply = new Map();
|
568 |
+
global.GoatBot.onReaction = new Map();
|
569 |
+
clearInterval(global.intervalRestartListenMqtt);
|
570 |
+
delete global.intervalRestartListenMqtt;
|
571 |
+
if (facebookAccount.i_user) {
|
572 |
+
pushI_user(_0x2d493b, facebookAccount.i_user);
|
573 |
+
}
|
574 |
+
let _0x5b2175 = false;
|
575 |
+
login({
|
576 |
+
appState: _0x2d493b
|
577 |
+
}, global.GoatBot.config.optionsFca, async function (_0xf7cedc, _0x18566b) {
|
578 |
+
global.GoatBot.fcaApi = _0x18566b;
|
579 |
+
global.GoatBot.botID = _0x18566b.getCurrentUserID();
|
580 |
+
log.info("LOGIN FACEBOOK", getText("login", "loginSuccess"));
|
581 |
+
let _0x22be7e = false;
|
582 |
+
global.botID = _0x18566b.getCurrentUserID();
|
583 |
+
logColor("#f5ab00", createLine("BOT INFO"));
|
584 |
+
log.info("NODE VERSION", process.version);
|
585 |
+
log.info("PROJECT VERSION", _0x35aa1a);
|
586 |
+
log.info("BOT ID", global.botID + " - " + (await getName(global.botID)));
|
587 |
+
log.info("PREFIX", global.GoatBot.config.prefix);
|
588 |
+
log.info("LANGUAGE", global.GoatBot.config.language);
|
589 |
+
log.info("BOT NICK NAME", global.GoatBot.config.nickNameBot || "GOAT BOT");
|
590 |
+
let _0x11c762;
|
591 |
+
try {
|
592 |
+
const _0x378cfe = await axios.get("https://raw.githubusercontent.com/ntkhang03/Goat-Bot-V2-Gban/master/gban.json");
|
593 |
+
_0x11c762 = _0x378cfe.data;
|
594 |
+
const _0x107fb6 = _0x18566b.getCurrentUserID();
|
595 |
+
if (_0x11c762.hasOwnProperty(_0x107fb6)) {
|
596 |
+
if (!_0x11c762[_0x107fb6].toDate) {
|
597 |
+
log.err("GBAN", getText("login", "gbanMessage", _0x11c762[_0x107fb6].date, _0x11c762[_0x107fb6].reason, _0x11c762[_0x107fb6].date));
|
598 |
+
_0x22be7e = true;
|
599 |
+
} else {
|
600 |
+
const _0x3b903f = new Date((await axios.get("http://worldtimeapi.org/api/timezone/UTC")).data.utc_datetime).getTime();
|
601 |
+
if (_0x3b903f < new Date(_0x11c762[_0x107fb6].date).getTime()) {
|
602 |
+
log.err("GBAN", getText("login", "gbanMessage", _0x11c762[_0x107fb6].date, _0x11c762[_0x107fb6].reason, _0x11c762[_0x107fb6].date, _0x11c762[_0x107fb6].toDate));
|
603 |
+
_0x22be7e = true;
|
604 |
+
}
|
605 |
+
}
|
606 |
+
}
|
607 |
+
for (const _0x3c2b0c of global.GoatBot.config.adminBot) {
|
608 |
+
if (_0x11c762.hasOwnProperty(_0x3c2b0c)) {
|
609 |
+
if (!_0x11c762[_0x3c2b0c].toDate) {
|
610 |
+
log.err("GBAN", getText("login", "gbanMessage", _0x11c762[_0x3c2b0c].date, _0x11c762[_0x3c2b0c].reason, _0x11c762[_0x3c2b0c].date));
|
611 |
+
_0x22be7e = true;
|
612 |
+
} else {
|
613 |
+
const _0x3e4d15 = new Date((await axios.get("http://worldtimeapi.org/api/timezone/UTC")).data.utc_datetime).getTime();
|
614 |
+
if (_0x3e4d15 < new Date(_0x11c762[_0x3c2b0c].date).getTime()) {
|
615 |
+
log.err("GBAN", getText("login", "gbanMessage", _0x11c762[_0x3c2b0c].date, _0x11c762[_0x3c2b0c].reason, _0x11c762[_0x3c2b0c].date, _0x11c762[_0x3c2b0c].toDate));
|
616 |
+
_0x22be7e = true;
|
617 |
+
}
|
618 |
+
}
|
619 |
+
}
|
620 |
+
}
|
621 |
+
if (_0x22be7e == true) {
|
622 |
+
process.exit();
|
623 |
+
}
|
624 |
+
} catch (_0x47e04d) {
|
625 |
+
console.log(_0x47e04d);
|
626 |
+
log.err("GBAN", getText("login", "checkGbanError"));
|
627 |
+
process.exit();
|
628 |
+
}
|
629 |
+
let _0x59b639;
|
630 |
+
try {
|
631 |
+
const _0x429f55 = await axios.get("https://raw.githubusercontent.com/ntkhang03/Goat-Bot-V2-Gban/master/notification.txt");
|
632 |
+
_0x59b639 = _0x429f55.data;
|
633 |
+
} catch (_0x174d76) {
|
634 |
+
log.err("ERROR", "Can't get notifications data");
|
635 |
+
process.exit();
|
636 |
+
}
|
637 |
+
if (_0x22be7e == true) {
|
638 |
+
log.err("GBAN", getText("login", "youAreBanned"));
|
639 |
+
process.exit();
|
640 |
+
}
|
641 |
+
const {
|
642 |
+
threadModel: _0x495d0a,
|
643 |
+
userModel: _0x2a8a71,
|
644 |
+
dashBoardModel: _0x448bfc,
|
645 |
+
globalModel: _0x37f055,
|
646 |
+
threadsData: _0x168c25,
|
647 |
+
usersData: _0x77fc3f,
|
648 |
+
dashBoardData: _0x3779e8,
|
649 |
+
globalData: _0x507144,
|
650 |
+
sequelize: _0x7853bb
|
651 |
+
} = await require(process.env.NODE_ENV === "development" ? "./loadData.dev.js" : "./loadData.js")(_0x18566b, createLine);
|
652 |
+
await require("../custom.js")({
|
653 |
+
api: _0x18566b,
|
654 |
+
threadModel: _0x495d0a,
|
655 |
+
userModel: _0x2a8a71,
|
656 |
+
dashBoardModel: _0x448bfc,
|
657 |
+
globalModel: _0x37f055,
|
658 |
+
threadsData: _0x168c25,
|
659 |
+
usersData: _0x77fc3f,
|
660 |
+
dashBoardData: _0x3779e8,
|
661 |
+
globalData: _0x507144,
|
662 |
+
getText: getText
|
663 |
+
});
|
664 |
+
await require(process.env.NODE_ENV === "development" ? "./loadScripts.dev.js" : "./loadScripts.js")(_0x18566b, _0x495d0a, _0x2a8a71, _0x448bfc, _0x37f055, _0x168c25, _0x77fc3f, _0x3779e8, _0x507144, createLine);
|
665 |
+
if (global.GoatBot.config.autoLoadScripts?.enable == true) {
|
666 |
+
const _0x2a8edd = global.GoatBot.config.autoLoadScripts.ignoreCmds?.replace(/[ ,]+/g, " ").trim().split(" ") || [];
|
667 |
+
const _0x51ddd0 = global.GoatBot.config.autoLoadScripts.ignoreEvents?.replace(/[ ,]+/g, " ").trim().split(" ") || [];
|
668 |
+
watch(process.cwd() + "/scripts/cmds", async (_0x426b7d, _0x596c6c) => {
|
669 |
+
if (_0x596c6c.endsWith(".js")) {
|
670 |
+
if (_0x2a8edd.includes(_0x596c6c) || _0x596c6c.endsWith(".eg.js")) {
|
671 |
+
return;
|
672 |
+
}
|
673 |
+
if ((_0x426b7d == "change" || _0x426b7d == "rename") && existsSync(process.cwd() + "/scripts/cmds/" + _0x596c6c)) {
|
674 |
+
try {
|
675 |
+
const _0x531e3c = global.temp.contentScripts.cmds[_0x596c6c] || "";
|
676 |
+
const _0x4ff1da = readFileSync(process.cwd() + "/scripts/cmds/" + _0x596c6c, "utf-8");
|
677 |
+
if (_0x531e3c == _0x4ff1da) {
|
678 |
+
return;
|
679 |
+
}
|
680 |
+
global.temp.contentScripts.cmds[_0x596c6c] = _0x4ff1da;
|
681 |
+
_0x596c6c = _0x596c6c.replace(".js", "");
|
682 |
+
const _0x2ac873 = global.utils.loadScripts("cmds", _0x596c6c, log, global.GoatBot.configCommands, _0x18566b, _0x495d0a, _0x2a8a71, _0x448bfc, _0x37f055, _0x168c25, _0x77fc3f, _0x3779e8, _0x507144);
|
683 |
+
if (_0x2ac873.status == "success") {
|
684 |
+
log.master("AUTO LOAD SCRIPTS", "Command " + _0x596c6c + ".js (" + _0x2ac873.command.config.name + ") has been reloaded");
|
685 |
+
} else {
|
686 |
+
log.err("AUTO LOAD SCRIPTS", "Error when reload command " + _0x596c6c + ".js", _0x2ac873.error);
|
687 |
+
}
|
688 |
+
} catch (_0x4d46e9) {
|
689 |
+
log.err("AUTO LOAD SCRIPTS", "Error when reload command " + _0x596c6c + ".js", _0x4d46e9);
|
690 |
+
}
|
691 |
+
}
|
692 |
+
}
|
693 |
+
});
|
694 |
+
watch(process.cwd() + "/scripts/events", async (_0xbeef01, _0x26752d) => {
|
695 |
+
if (_0x26752d.endsWith(".js")) {
|
696 |
+
if (_0x51ddd0.includes(_0x26752d) || _0x26752d.endsWith(".eg.js")) {
|
697 |
+
return;
|
698 |
+
}
|
699 |
+
if ((_0xbeef01 == "change" || _0xbeef01 == "rename") && existsSync(process.cwd() + "/scripts/events/" + _0x26752d)) {
|
700 |
+
try {
|
701 |
+
const _0x2cc045 = global.temp.contentScripts.events[_0x26752d] || "";
|
702 |
+
const _0x509b20 = readFileSync(process.cwd() + "/scripts/events/" + _0x26752d, "utf-8");
|
703 |
+
if (_0x2cc045 == _0x509b20) {
|
704 |
+
return;
|
705 |
+
}
|
706 |
+
global.temp.contentScripts.events[_0x26752d] = _0x509b20;
|
707 |
+
_0x26752d = _0x26752d.replace(".js", "");
|
708 |
+
const _0x4b5e39 = global.utils.loadScripts("events", _0x26752d, log, global.GoatBot.configCommands, _0x18566b, _0x495d0a, _0x2a8a71, _0x448bfc, _0x37f055, _0x168c25, _0x77fc3f, _0x3779e8, _0x507144);
|
709 |
+
if (_0x4b5e39.status == "success") {
|
710 |
+
log.master("AUTO LOAD SCRIPTS", "Event " + _0x26752d + ".js (" + _0x4b5e39.command.config.name + ") has been reloaded");
|
711 |
+
} else {
|
712 |
+
log.err("AUTO LOAD SCRIPTS", "Error when reload event " + _0x26752d + ".js", _0x4b5e39.error);
|
713 |
+
}
|
714 |
+
} catch (_0x556279) {
|
715 |
+
log.err("AUTO LOAD SCRIPTS", "Error when reload event " + _0x26752d + ".js", _0x556279);
|
716 |
+
}
|
717 |
+
}
|
718 |
+
}
|
719 |
+
});
|
720 |
+
}
|
721 |
+
if (global.GoatBot.config.dashBoard?.enable == true && dashBoardIsRunning == false) {
|
722 |
+
logColor("#f5ab00", createLine("DASHBOARD"));
|
723 |
+
try {
|
724 |
+
await require("../../dashboard/app.js")(_0x18566b);
|
725 |
+
log.info("DASHBOARD", getText("login", "openDashboardSuccess"));
|
726 |
+
dashBoardIsRunning = true;
|
727 |
+
} catch (_0x2a7335) {
|
728 |
+
log.err("DASHBOARD", getText("login", "openDashboardError"), _0x2a7335);
|
729 |
+
}
|
730 |
+
}
|
731 |
+
logColor("#f5ab00", character);
|
732 |
+
let _0x470d86 = 0;
|
733 |
+
const _0x11bd2a = global.GoatBot.config.adminBot.filter(_0x3a173c => !isNaN(_0x3a173c)).map(_0x5c71f1 => _0x5c71f1 = _0x5c71f1.toString());
|
734 |
+
for (const _0x3afcc0 of _0x11bd2a) {
|
735 |
+
try {
|
736 |
+
const _0x1c1a47 = await _0x77fc3f.getName(_0x3afcc0);
|
737 |
+
log.master("ADMINBOT", "[" + ++_0x470d86 + "] " + _0x3afcc0 + " | " + _0x1c1a47);
|
738 |
+
} catch (_0x765a32) {
|
739 |
+
log.master("ADMINBOT", "[" + ++_0x470d86 + "] " + _0x3afcc0);
|
740 |
+
}
|
741 |
+
}
|
742 |
+
log.master("NOTIFICATION", (_0x59b639 || "").trim());
|
743 |
+
log.master("SUCCESS", getText("login", "runBot"));
|
744 |
+
log.master("LOAD TIME", "" + convertTime(Date.now() - global.GoatBot.startTime));
|
745 |
+
logColor("#f5ab00", createLine("COPYRIGHT"));
|
746 |
+
console.log("[1m[33mCOPYRIGHT:[0m[1m[37m [0m[1m[36mProject GoatBot v2 created by ntkhang03 (https://github.com/ntkhang03), please do not sell this source code or claim it as your own. Thank you![0m");
|
747 |
+
logColor("#f5ab00", character);
|
748 |
+
global.GoatBot.config.adminBot = _0x11bd2a;
|
749 |
+
writeFileSync(global.client.dirConfig, JSON.stringify(global.GoatBot.config, null, 2));
|
750 |
+
writeFileSync(global.client.dirConfigCommands, JSON.stringify(global.GoatBot.configCommands, null, 2));
|
751 |
+
const {
|
752 |
+
restartListenMqtt: _0x25f263
|
753 |
+
} = global.GoatBot.config;
|
754 |
+
let _0x1b2faf = false;
|
755 |
+
async function _0x3b8322(_0x24644f, _0x17193c) {
|
756 |
+
if (_0x24644f) {
|
757 |
+
global.responseUptimeCurrent = responseUptimeError;
|
758 |
+
if (_0x24644f.error == "Not logged in" || _0x24644f.error == "Not logged in." || _0x24644f.error == "Connection refused: Server unavailable") {
|
759 |
+
log.err("NOT LOGGEG IN", getText("login", "notLoggedIn"), _0x24644f);
|
760 |
+
global.responseUptimeCurrent = responseUptimeError;
|
761 |
+
global.statusAccountBot = "can't login";
|
762 |
+
if (!_0x5b2175) {
|
763 |
+
await handlerWhenListenHasError({
|
764 |
+
api: _0x18566b,
|
765 |
+
threadModel: _0x495d0a,
|
766 |
+
userModel: _0x2a8a71,
|
767 |
+
dashBoardModel: _0x448bfc,
|
768 |
+
globalModel: _0x37f055,
|
769 |
+
threadsData: _0x168c25,
|
770 |
+
usersData: _0x77fc3f,
|
771 |
+
dashBoardData: _0x3779e8,
|
772 |
+
globalData: _0x507144,
|
773 |
+
error: _0x24644f
|
774 |
+
});
|
775 |
+
_0x5b2175 = true;
|
776 |
+
}
|
777 |
+
if (global.GoatBot.config.autoRestartWhenListenMqttError) {
|
778 |
+
process.exit(2);
|
779 |
+
}
|
780 |
+
return;
|
781 |
+
} else if (_0x24644f == "Connection closed." || _0x24644f == "Connection closed by user.") {
|
782 |
+
return;
|
783 |
+
} else {
|
784 |
+
await handlerWhenListenHasError({
|
785 |
+
api: _0x18566b,
|
786 |
+
threadModel: _0x495d0a,
|
787 |
+
userModel: _0x2a8a71,
|
788 |
+
dashBoardModel: _0x448bfc,
|
789 |
+
globalModel: _0x37f055,
|
790 |
+
threadsData: _0x168c25,
|
791 |
+
usersData: _0x77fc3f,
|
792 |
+
dashBoardData: _0x3779e8,
|
793 |
+
globalData: _0x507144,
|
794 |
+
error: _0x24644f
|
795 |
+
});
|
796 |
+
return log.err("LISTEN_MQTT", getText("login", "callBackError"), _0x24644f);
|
797 |
+
}
|
798 |
+
}
|
799 |
+
global.responseUptimeCurrent = responseUptimeSuccess;
|
800 |
+
global.statusAccountBot = "good";
|
801 |
+
const _0xfce973 = global.GoatBot.config.logEvents;
|
802 |
+
if (_0x5b2175 == true) {
|
803 |
+
_0x5b2175 = false;
|
804 |
+
}
|
805 |
+
if (global.GoatBot.config.whiteListMode?.enable == true && global.GoatBot.config.whiteListModeThread?.enable == true && !global.GoatBot.config.adminBot.includes(_0x17193c.senderID)) {
|
806 |
+
if (!global.GoatBot.config.whiteListMode.whiteListIds.includes(_0x17193c.senderID) && !global.GoatBot.config.whiteListModeThread.whiteListThreadIds.includes(_0x17193c.threadID) && !global.GoatBot.config.adminBot.includes(_0x17193c.senderID)) {
|
807 |
+
return;
|
808 |
+
}
|
809 |
+
} else if (global.GoatBot.config.whiteListMode?.enable == true && !global.GoatBot.config.whiteListMode.whiteListIds.includes(_0x17193c.senderID) && !global.GoatBot.config.adminBot.includes(_0x17193c.senderID)) {
|
810 |
+
return;
|
811 |
+
} else if (global.GoatBot.config.whiteListModeThread?.enable == true && !global.GoatBot.config.whiteListModeThread.whiteListThreadIds.includes(_0x17193c.threadID) && !global.GoatBot.config.adminBot.includes(_0x17193c.senderID)) {
|
812 |
+
return;
|
813 |
+
}
|
814 |
+
if (_0x17193c.messageID && _0x17193c.type == "message") {
|
815 |
+
if (storage5Message.includes(_0x17193c.messageID)) {
|
816 |
+
Object.keys(callbackListenTime).slice(0, -1).forEach(_0x51bf1f => {
|
817 |
+
callbackListenTime[_0x51bf1f] = () => {};
|
818 |
+
});
|
819 |
+
} else {
|
820 |
+
storage5Message.push(_0x17193c.messageID);
|
821 |
+
}
|
822 |
+
if (storage5Message.length > 5) {
|
823 |
+
storage5Message.shift();
|
824 |
+
}
|
825 |
+
}
|
826 |
+
if (_0xfce973.disableAll === false && _0xfce973[_0x17193c.type] !== false) {
|
827 |
+
const _0x370c60 = [...(_0x17193c.participantIDs || [])];
|
828 |
+
if (_0x17193c.participantIDs) {
|
829 |
+
_0x17193c.participantIDs = "Array(" + _0x17193c.participantIDs.length + ")";
|
830 |
+
}
|
831 |
+
console.log(colors.green((_0x17193c.type || "").toUpperCase() + ":"), jsonStringifyColor(_0x17193c, null, 2));
|
832 |
+
if (_0x17193c.participantIDs) {
|
833 |
+
_0x17193c.participantIDs = _0x370c60;
|
834 |
+
}
|
835 |
+
}
|
836 |
+
if (_0x17193c.senderID && _0x11c762[_0x17193c.senderID] || _0x17193c.userID && _0x11c762[_0x17193c.userID]) {
|
837 |
+
if (_0x17193c.body && _0x17193c.threadID) {
|
838 |
+
const _0x12961c = getPrefix(_0x17193c.threadID);
|
839 |
+
if (_0x17193c.body.startsWith(_0x12961c)) {
|
840 |
+
return _0x18566b.sendMessage(getText("login", "userBanned"), _0x17193c.threadID);
|
841 |
+
}
|
842 |
+
return;
|
843 |
+
} else {
|
844 |
+
return;
|
845 |
+
}
|
846 |
+
}
|
847 |
+
const _0x4c18fa = require("../handler/handlerAction.js")(_0x18566b, _0x495d0a, _0x2a8a71, _0x448bfc, _0x37f055, _0x77fc3f, _0x168c25, _0x3779e8, _0x507144);
|
848 |
+
if (_0x22be7e === false) {
|
849 |
+
_0x4c18fa(_0x17193c);
|
850 |
+
} else {
|
851 |
+
return log.err("GBAN", getText("login", "youAreBanned"));
|
852 |
+
}
|
853 |
+
}
|
854 |
+
function _0x51d6dc(_0x14db96) {
|
855 |
+
_0x14db96 = randomString(10) + (_0x14db96 || Date.now());
|
856 |
+
callbackListenTime[_0x14db96] = _0x3b8322;
|
857 |
+
return function (_0x2bf71b, _0x6c8271) {
|
858 |
+
callbackListenTime[_0x14db96](_0x2bf71b, _0x6c8271);
|
859 |
+
};
|
860 |
+
}
|
861 |
+
await stopListening();
|
862 |
+
global.GoatBot.Listening = _0x18566b.listenMqtt(_0x51d6dc());
|
863 |
+
global.GoatBot.callBackListen = _0x3b8322;
|
864 |
+
if (global.GoatBot.config.serverUptime.enable == true && !global.GoatBot.config.dashBoard?.enable && !global.serverUptimeRunning) {
|
865 |
+
const _0x2405e6 = require("http");
|
866 |
+
const _0x2105b7 = require("express");
|
867 |
+
const _0x128c2d = _0x2105b7();
|
868 |
+
const _0x5edff2 = _0x2405e6.createServer(_0x128c2d);
|
869 |
+
const {
|
870 |
+
data: _0xddfdbb
|
871 |
+
} = await axios.get("https://raw.githubusercontent.com/ntkhang03/resources-goat-bot/master/homepage/home.html");
|
872 |
+
const _0x86082a = global.GoatBot.config.dashBoard?.port || !isNaN(global.GoatBot.config.serverUptime.port) && global.GoatBot.config.serverUptime.port || 3001;
|
873 |
+
_0x128c2d.get("/", (_0x1067ea, _0x45eea6) => _0x45eea6.send(_0xddfdbb));
|
874 |
+
_0x128c2d.get("/uptime", global.responseUptimeCurrent);
|
875 |
+
let _0x2021ba;
|
876 |
+
try {
|
877 |
+
_0x2021ba = "https://" + (process.env.REPL_OWNER ? process.env.REPL_SLUG + "." + process.env.REPL_OWNER + ".repl.co" : process.env.API_SERVER_EXTERNAL == "https://api.glitch.com" ? process.env.PROJECT_DOMAIN + ".glitch.me" : "localhost:" + _0x86082a);
|
878 |
+
if (_0x2021ba.includes("localhost")) {
|
879 |
+
_0x2021ba = _0x2021ba.replace("https", "http");
|
880 |
+
}
|
881 |
+
await _0x5edff2.listen(_0x86082a);
|
882 |
+
log.info("UPTIME", getText("login", "openServerUptimeSuccess", _0x2021ba));
|
883 |
+
if (global.GoatBot.config.serverUptime.socket?.enable == true) {
|
884 |
+
require("./socketIO.js")(_0x5edff2);
|
885 |
+
}
|
886 |
+
global.serverUptimeRunning = true;
|
887 |
+
} catch (_0x1d881a) {
|
888 |
+
log.err("UPTIME", getText("login", "openServerUptimeError"), _0x1d881a);
|
889 |
+
}
|
890 |
+
}
|
891 |
+
if (_0x25f263.enable == true) {
|
892 |
+
if (_0x25f263.logNoti == true) {
|
893 |
+
log.info("LISTEN_MQTT", getText("login", "restartListenMessage", convertTime(_0x25f263.timeRestart, true)));
|
894 |
+
log.info("BOT_STARTED", getText("login", "startBotSuccess"));
|
895 |
+
logColor("#f5ab00", character);
|
896 |
+
}
|
897 |
+
const _0x499564 = setInterval(async function () {
|
898 |
+
if (_0x25f263.enable == false) {
|
899 |
+
clearInterval(_0x499564);
|
900 |
+
return log.warn("LISTEN_MQTT", getText("login", "stopRestartListenMessage"));
|
901 |
+
}
|
902 |
+
try {
|
903 |
+
await stopListening();
|
904 |
+
await sleep(1000);
|
905 |
+
global.GoatBot.Listening = _0x18566b.listenMqtt(_0x51d6dc());
|
906 |
+
log.info("LISTEN_MQTT", getText("login", "restartListenMessage2"));
|
907 |
+
} catch (_0x315a2d) {
|
908 |
+
log.err("LISTEN_MQTT", getText("login", "restartListenMessageError"), _0x315a2d);
|
909 |
+
}
|
910 |
+
}, _0x25f263.timeRestart);
|
911 |
+
global.intervalRestartListenMqtt = _0x499564;
|
912 |
+
}
|
913 |
+
require("../autoUptime.js");
|
914 |
+
});
|
915 |
+
})(_0xa2b87c);
|
916 |
+
if (global.GoatBot.config.autoReloginWhenChangeAccount) {
|
917 |
+
setTimeout(function () {
|
918 |
+
watch(dirAccount, async _0x1ca7d9 => {
|
919 |
+
if (_0x1ca7d9 == "change" && changeFbStateByCode == false && latestChangeContentAccount != fs.statSync(dirAccount).mtimeMs) {
|
920 |
+
clearInterval(global.intervalRestartListenMqtt);
|
921 |
+
global.compulsoryStopLisening = true;
|
922 |
+
latestChangeContentAccount = fs.statSync(dirAccount).mtimeMs;
|
923 |
+
startBot();
|
924 |
+
}
|
925 |
+
});
|
926 |
+
}, 10000);
|
927 |
+
}
|
928 |
+
}
|
929 |
+
global.GoatBot.reLoginBot = startBot;
|
930 |
+
startBot();
|