Download index.js from SekoMirson/TurkBot: direct link, hf CLI and curl.
- Browser
- Download file 2.83 kB
-
https://huggingface.co/SekoMirson/TurkBot/resolve/main/index.js
- Command line
-
hf download hf://SekoMirson/TurkBot/index.js
-
curl -L -o index.js https://huggingface.co/SekoMirson/TurkBot/resolve/main/index.js
2.83 kB
| const mineflayer = require('mineflayer') | |
| const { pathfinder, Movements, goals } = require('mineflayer-pathfinder') | |
| const GoalBlock = goals.GoalBlock | |
| console.log('= Bot Starting =') | |
| let Botusername = 'Buse_AI'; | |
| const bot = mineflayer.createBot({ | |
| host: "xdrakensmp.aternos.me", | |
| //port: 25565, | |
| username: Botusername, | |
| version: "1.21.4", | |
| auth: 'offline' | |
| }); | |
| const mcData = require('minecraft-data')(bot.version) | |
| // Pathfinder plugin'ini yükle | |
| bot.loadPlugin(pathfinder) | |
| // Bot başlatıldığında | |
| bot.once('spawn', () => { | |
| console.log('Bot oyuna bağlandı!') | |
| const defaultMove = new Movements(bot, mcData) | |
| bot.pathfinder.setMovements(defaultMove) | |
| }) | |
| // Tarla koordinatları (5x5) | |
| const farmArea = { | |
| start: { x: 591, y: 103, z: -2928 }, // 591 103 -2928 | |
| end: { x: 595, y: 103, z: -2936 } // 595 103 -2936 | |
| } | |
| // Ekinleri kontrol et ve hasat et | |
| async function checkAndHarvestCrops() { | |
| for (let x = farmArea.start.x; x <= farmArea.end.x; x++) { | |
| for (let z = farmArea.start.z; z <= farmArea.end.z; z++) { | |
| const block = bot.blockAt(bot.vec3(x, farmArea.start.y, z)) | |
| if (!block) continue | |
| // Buğday, havuç, patates gibi olgun ekinleri kontrol et | |
| if (block.name === 'wheat' || block.name === 'carrots' || block.name === 'potatoes') { | |
| if (block.metadata === 7) { // Olgun ekin | |
| try { | |
| await bot.pathfinder.goto(new GoalBlock(x, farmArea.start.y, z)) | |
| await bot.dig(block) | |
| console.log(`${block.name} hasadı yapıldı!`) | |
| // Yeniden ek | |
| const seedItem = bot.inventory.items().find(item => { | |
| return item.name === block.name + '_seeds' || item.name === block.name | |
| }) | |
| if (seedItem) { | |
| await bot.equip(seedItem, 'hand') | |
| await bot.placeBlock(block, new bot.vec3(0, 1, 0)) // Yeni ek | |
| console.log(`Yeni ${block.name} ekildi!`) | |
| } | |
| } catch (err) { | |
| console.log(`Hata: ${err.message}`) | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| // Her 30 saniyede bir tarla kontrolü yap | |
| setInterval(checkAndHarvestCrops, 10000) | |
| // Debug için mesaj olaylarını dinle | |
| bot.on('message', (message) => { | |
| console.log('Mesaj alındı:', message.toString()) | |
| if (message.toString() === '1') { | |
| console.log('1 komutu alındı') | |
| bot.chat('Merhaba!') | |
| } | |
| if (message.toString() === 'hasat başlat') { | |
| console.log('Hasat komutu alındı') | |
| checkAndHarvestCrops() | |
| bot.chat('Hasat başlatılıyor...') | |
| } | |
| }) | |
| // Hata yakalama | |
| bot.on('error', (err) => { | |
| console.log(`Bot hatası: ${err.message}`) | |
| }) | |
| bot.on('kicked', (reason) => { | |
| console.log(`Bot kicklendi: ${reason}`) | |
| }) | |
| bot.on('end', () => { | |
| console.log('Bot bağlantısı kesildi') | |
| }) |