Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 12 additions & 41 deletions index.js
Original file line number Diff line number Diff line change
@@ -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);