diff --git a/index.js b/index.js index effbaa0..0877d4f 100644 --- a/index.js +++ b/index.js @@ -1,48 +1,19 @@ -/** - * @author NTKhang - * ! The source code is written by NTKhang, please don't change the author's name everywhere. Thank you for using - * ! Official source code: https://github.com/ntkhang03/Goat-Bot-V2 - * ! If you do not download the source code from the above address, you are using an unknown version and at risk of having your account hacked - * - * English: - * ! Please do not change the below code, it is very important for the project. - * It is my motivation to maintain and develop the project for free. - * ! If you change it, you will be banned forever - * Thank you for using - * - * Vietnamese: - * ! Vui lòng không thay đổi mã bên dưới, nó rất quan trọng đối với dự án. - * Nó là động lực để tôi duy trì và phát triển dự án miễn phí. - * ! Nếu thay đổi nó, bạn sẽ bị cấm vĩnh viễn - * Cảm ơn bạn đã sử dụng - */ - -const { spawn } = require("child_process"); -const log = require("./logger/log.js"); - -function startProject() { - const child = spawn("node", ["Goat.js"], { - cwd: __dirname, - stdio: "inherit", - shell: true - }); - - child.on("close", (code) => { - if (code == 2) { - log.info("Restarting Project..."); - startProject(); - } - }); -} - -startProject(); const express = require('express'); +const http = require('http'); const app = express(); +const port = process.env.PORT || 3000; +// Anti-sleep Railway + Ping auto toutes 5min app.get('/', (req, res) => { - res.send('Bot is running!'); + res.send('GoatBot-Pro is alive - Uptime: OK'); }); -app.listen(3000, () => { - console.log('Uptime server running on port 3000'); +http.createServer(app).listen(port, () => { + console.log(`[UPTIME] Server running on port ${port}`); }); + +// Self-ping toutes 5min pour rester actif 20+ jours +setInterval(() => { + http.get(`http://localhost:${port}/`); + console.log('[UPTIME] Self-ping OK'); +}, 300000);