const mineflayer = require('mineflayer')
const options = {
host: 'localhost',
port: 25565,
username: 'TDKMakinesi'
}
const bot = mineflayer.createBot(options)
bot.once('spawn', () => {
bot.chat('/login --------')
setTimeout(() => bot.chat('/skyblock'), 8000);
})
const brain = require('brain.js');
const fs = require('fs');
const net = new brain.recurrent.LSTM();
var array = [];
bot.on('chat', (username, message) => {
if(message.search("tdk") != null){
fs.readFile("output.json",(error,data) => {
if(error) return console.log(error);
if(data.toString() === ""){
console.log("herhangi bir sinir ağı eğitimi bulunamadı");
train();
} else {
net.fromJSON(JSON.parse(data.toString()));
bot.chat(net.run(message));
}
});
}
});
const train = () => {
console.log("Sinir ağı eğitiiyor...");
fs.readFile("input.txt",(error,data) => {
array = data.toString().split(".");
net.train(array,{
iterations: 1300,
log: true,
errorThresh: 0.01
});
fs.writeFile("output.json",JSON.stringify(net.toJSON()),(error,result) => {
if(error) console.log(error);
});
console.log("Sinir eğitimi tamamlandı");
});
}
Her şey çalışıyor ama net.run() çalışmıyor yardım lazım
const options = {
host: 'localhost',
port: 25565,
username: 'TDKMakinesi'
}
const bot = mineflayer.createBot(options)
bot.once('spawn', () => {
bot.chat('/login --------')
setTimeout(() => bot.chat('/skyblock'), 8000);
})
const brain = require('brain.js');
const fs = require('fs');
const net = new brain.recurrent.LSTM();
var array = [];
bot.on('chat', (username, message) => {
if(message.search("tdk") != null){
fs.readFile("output.json",(error,data) => {
if(error) return console.log(error);
if(data.toString() === ""){
console.log("herhangi bir sinir ağı eğitimi bulunamadı");
train();
} else {
net.fromJSON(JSON.parse(data.toString()));
bot.chat(net.run(message));
}
});
}
});
const train = () => {
console.log("Sinir ağı eğitiiyor...");
fs.readFile("input.txt",(error,data) => {
array = data.toString().split(".");
net.train(array,{
iterations: 1300,
log: true,
errorThresh: 0.01
});
fs.writeFile("output.json",JSON.stringify(net.toJSON()),(error,result) => {
if(error) console.log(error);
});
console.log("Sinir eğitimi tamamlandı");
});
}
Her şey çalışıyor ama net.run() çalışmıyor yardım lazım
Son düzenleme: