Datasets:
File size: 1,202 Bytes
29a3912 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
const { spawn: s } = require("child_process");
const fs = require("fs");
const l = require("./utils/log");
const moment = require('moment-timezone');
const file = './utils/check.json';
if (!fs.existsSync(file)) fs.writeFileSync(file, JSON.stringify({}));
const time = () => {
const ctime = moment().tz('Asia/Ho_Chi_Minh').format('YYYY-MM-DD HH:mm:ss');
fs.writeFileSync(file, JSON.stringify({ datetime: ctime }));
};
setInterval(time, 30 * 1000);
const sr = () => {
l('🌸 ĐANG KHỞI ĐỘNG BOT', "⟦ KÍCH HOẠT ⟧⪼ ");
const c = s("node", ["--trace-warnings", "--async-stack-traces", "mirai.js"], {
cwd: __dirname,
stdio: "inherit",
shell: true
});
c.on("close", async (e) => {
if (e == 1) return sr("🔄 BOT ĐANG KHỞI ĐỘNG LẠI!!!");
else if (String(e).startsWith("2")) {
await new Promise((r) => setTimeout(r, parseInt(e.replace('2', '')) * 1000));
sr("🌸 BOT ĐÃ ĐƯỢC KÍCH HOẠT, VUI LÒNG CHỜ MỘT CHÚT!!!");
}
});
c.on("error", (error) => l("Đã xảy ra lỗi: " + JSON.stringify(error), "[ Khởi động ]"));
};
sr(); |