var mineflayer = require("mineflayer"); var db = require("quick.db"); var ayar = { host: "Gamer_World_Offical.aternos.me", port: 23452, username: ".HiBot", version: false }; var kayit = { authme: "var", sifre: "ADMIN" }; var automessage = true; var bot = mineflayer.createBot(ayar); bot.on("chat", function(username, message) { if (username === bot.username) return; function intervalFunc() { bot.setControlState("sprint", true); } setInterval(intervalFunc, 7000); if (kayit.authme == "var") { let giris = db.fetch(`giris_${ayar.host}_${ayar.username}`); if (!giris) { bot.chat(`/register ${kayit.sifre} ${kayit.sifre}`); console.log("Bot kayıt oldu!"); db.set(`giris_${ayar.host}_${ayar.username}`, "tm"); if (automessage == true) { setInterval(() => { bot.chat("-Turkish Faction- |1.12.2|"); }, 300000); } } if (giris) { bot.chat(`/login ${kayit.sifre}`); console.log("Bot giriş yaptı!"); if (automessage == true) { setInterval(() => { bot.chat("Sa"); }, 300000); } } } }); bindEvents(bot); function bindEvents(bot) { bot.on("error", function(err) { console.log("Bir hata oluştu!"); }); bot.on("end", function() { console.log("Bot sunucudan atıldı!"); setTimeout(relog, 5000); }); function relog() { console.log("Sunucuya Tekrardan Baglaniliyor..."); bot = mineflayer.createBot(ayar); bot.on("chat", function(username, message) { if (username === bot.username) return; console.log("Bot tekrardan oyuna giriş yaptı!"); bot.chat(`/login ${kayit.sifre}`); bot.setControlState('sprint', true) }); bindEvents(bot); } } ----------------------------------------------------------- const http = require('http'); const express = require('express'); const app = express(); app.get("/", (request, response) => { response.sendStatus(200); }); app.listen(process.env.PORT); setInterval(() => { http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`); }, 150000);