Minecraft Coding : Chat bot

const mineflayer = require('mineflayer')

const bot=mineflayer.createBot({
  host:'soranamihut.com',
  username:'mitica'
})
var texts=[]
texts.push('salut')
texts.push('ce mai faci?')
texts.push('succes')

let target = null

bot.on('chat', (username, message) => {
    console.log(username,message)
})
bot.once('spawn', () => {
  // keep your eyes on the target, so creepy!
  setInterval(watchTarget, 50)

  function watchTarget () {
    if (!target) return
    bot.lookAt(target.position.offset(0, target.height, 0))
  }
})

let i = -1;
function next () {
  if (i < texts.length) {
    i++
    setTimeout(() => {
      bot.chat(texts[i])
      next();
    }, 10000);
  }
}
next();