PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

How can i control the bot wiht being on the server #1505

Closed apprehensivetarget closed 3 years ago

apprehensivetarget commented 3 years ago

How can I send commands to the bot without sending messages through the in-game server chat. Is it possible to send it through the cmd window, or is there a feature that I haven't discovered

TheDudeFromCI commented 3 years ago

Checkout the repl example. https://github.com/PrismarineJS/mineflayer/blob/master/examples/repl.js This allows you to write code directly into the console to be executed instantly. You can use this for executing functions on the bot and such.

apprehensivetarget commented 3 years ago

Thanks!!

apprehensivetarget commented 3 years ago

This is quite helpful, but is there a way to control the bot with commands like 'goto x y z', or is the only way to control it through sending javascript through the cmd window

ghost commented 3 years ago

This is quite helpful, but is there a way to control the bot with commands like 'goto x y z', or is the only way to control it through sending javascript through the cmd window

const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

  rl.on('line', (input) => {

// Processing entered data here (input)

  });
TheDudeFromCI commented 3 years ago

This is quite helpful, but is there a way to control the bot with commands like 'goto x y z', or is the only way to control it through sending javascript through the cmd window

There is also the mineflayer-cmd plugin.

apprehensivetarget commented 3 years ago

Thanks again