Ошибка компилятора js

Пишу бота на mineflayer, при попытке запуска этого кода получаю ошибку:

(node:22767) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'minus' of undefined
    at EventEmitter.bot.lookAt (/home/anton/node_modules/mineflayer/lib/plugins/physics.js:251:25)
    at attackNearMob (/home/anton/projects/mineflayer/index.js:41:13)
    at farmerLogic (/home/anton/projects/mineflayer/index.js:46:42)
    at EventEmitter.<anonymous> (/home/anton/projects/mineflayer/index.js:102:11)
    at EventEmitter.emit (events.js:400:28)
    at EventEmitter.<anonymous> (/home/anton/node_modules/mineflayer/lib/plugins/chat.js:82:104)
    at EventEmitter.emit (events.js:400:28)
    at Client.<anonymous> (/home/anton/node_modules/mineflayer/lib/plugins/chat.js:120:9)
    at Client.emit (events.js:400:28)
    at FullPacketParser.<anonymous> (/home/anton/node_modules/minecraft-protocol/src/client.js:91:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:22767) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:22767) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code

Бот имеет в своем функционале обработку игрового чата, и вылет происходит при попытке запуска функции farmerLogic. Буду рад любой помощи! Вот весь исходный код:

"use strict";

const mineflayer = require('mineflayer')

const mineflayerViewer = require('prismarine-viewer').mineflayer

const bot = mineflayer.createBot
({
    host: 'localhost',
    port: 33857,
    username: 'Bot',
})

function sleep(milliseconds) {
  const date = Date.now();
  let currentDate = null;
  do {
    currentDate = Date.now();
  } while (currentDate - date < milliseconds);
}

bot.once("spawn", () => 
{
  mineflayerViewer(bot, { port: 3007, firstPerson: false });
})

async function eating() {
  const foodItem = bot.inventory[1]; // Выбираем первый предмет из инвенторя

  await bot.equip(foodItem, "hand"); // Берем в руку нашу еду

  await bot.consume(); // Употребляем, то что у нас в руке
} 

async function attackNearMob() {
  const mobFilter = (e) => e.type === "mob";

  const mob = bot.nearestEntity(mobFilter);
  const pos = mob.postion;
  await bot.lookAt(pos);
  await bot.attack(mob);
}

async function farmerLogic() {
  bot.food <= 6 ? await eating() : await attackNearMob(); // Если показатель еды опустился до 6 (из 20), то кушаем иначе атакуем

  await new Promise((res) => setTimeout(res, 1000));

  return farmerLogic(); // Создаем бесконечный цикл
}

bot.on('chat', (username, message) => 
{
    if (username === 'nick')
    {
        var arr = message.split(' ')
        if (arr[0] == 'Бей')
        {
            console.log("бью")
            bot.swingArm()
        }
        
        if (arr[0] == 'Слот')
        {
          console.log("Меняю активный слот на " + arr[1])
          bot.setQuickBarSlot(Number(arr[1]) - 1);
        }

        if (arr[0] == 'Используй')
        {
          console.log("Использую")
          bot.activateItem();
        }

        if (arr[0] == 'Скажи')
        {
          console.log("Говорю");
          arr.shift();
          var str = arr.join(' ');
          bot.chat(str)
        }

        if (message == "Фарми") 
        {
          farmerLogic();
        }
    }
})

Ответы (0 шт):