Facebook
From YTBRGamer_xbee, 2 Years ago, written in JavaScript.
This paste is a reply to server.js aternos 7/24 from Minvoy - view diff
Embed
Download Paste or View Raw
Hits: 167
  1. var mineflayer = require("mineflayer");
  2. var db = require("quick.db");
  3.  
  4. var ayar = {
  5.   host: "Gamer_World_Offical.aternos.me",
  6.   port: 23452,
  7.   username: ".HiBot",
  8.   version: false
  9. };
  10.  
  11. var kayit = {
  12.   authme: "var",
  13.   sifre: "ADMIN"
  14. };
  15.  
  16. var automessage = true;
  17.  
  18. var bot = mineflayer.createBot(ayar);
  19.  
  20. bot.on("chat", function(username, message) {
  21.   if (username === bot.username) return;
  22.   function intervalFunc() {
  23.     bot.setControlState("sprint", true);
  24.   }
  25.   setInterval(intervalFunc, 7000);
  26.  
  27.   if (kayit.authme == "var") {
  28.     let giris = db.fetch(`giris_${ayar.host}_${ayar.username}`);
  29.     if (!giris) {
  30.       bot.chat(`/register ${kayit.sifre} ${kayit.sifre}`);
  31.       console.log("Bot kayıt oldu!");
  32.       db.set(`giris_${ayar.host}_${ayar.username}`, "tm");
  33.  
  34.       if (automessage == true) {
  35.         setInterval(() => {
  36.           bot.chat("-Turkish Faction- |1.12.2|");
  37.         }, 300000);
  38.       }
  39.     }
  40.     if (giris) {
  41.       bot.chat(`/login ${kayit.sifre}`);
  42.       console.log("Bot giriş yaptı!");
  43.  
  44.       if (automessage == true) {
  45.         setInterval(() => {
  46.           bot.chat("Sa");
  47.         }, 300000);
  48.       }
  49.     }
  50.   }
  51. });
  52.  
  53. bindEvents(bot);
  54. function bindEvents(bot) {
  55.   bot.on("error", function(err) {
  56.     console.log("Bir hata oluştu!");
  57.   });
  58.  
  59.   bot.on("end", function() {
  60.     console.log("Bot sunucudan atıldı!");
  61.     setTimeout(relog, 5000);
  62.   });
  63.  
  64.   function relog() {
  65.     console.log("Sunucuya Tekrardan Baglaniliyor...");
  66.     bot = mineflayer.createBot(ayar);
  67.     bot.on("chat", function(username, message) {
  68.       if (username === bot.username) return;
  69.  
  70.       console.log("Bot tekrardan oyuna giriş yaptı!");
  71.       bot.chat(`/login ${kayit.sifre}`);
  72.        
  73.       bot.setControlState('sprint', true)
  74.     });
  75.  
  76.     bindEvents(bot);
  77.   }
  78. }
  79.  
  80.   -----------------------------------------------------------
  81. const http = require('http');
  82. const express = require('express');
  83. const app = express();
  84. app.get("/", (request, response) => {
  85.   response.sendStatus(200);
  86.    
  87. });
  88. app.listen(process.env.PORT);
  89. setInterval(() => {
  90.   http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
  91. }, 150000);
  92.  
  93.  
  94.  
  95.  
captcha