LookAtMySuitBot/js/node_modules/mineflayer/examples/ansi.js

23 lines
525 B
JavaScript
Raw Normal View History

2023-12-24 20:08:39 -05:00
/*
*
* A simple bot that logs everything that is said to the console.
*
*/
const mineflayer = require('mineflayer')
if (process.argv.length < 4 || process.argv.length > 6) {
console.log('Usage : node ansi.js <host> <port> [<name>] [<password>]')
process.exit(1)
}
const bot = mineflayer.createBot({
host: process.argv[2],
port: parseInt(process.argv[3]),
username: process.argv[4] ? process.argv[4] : 'ansi',
password: process.argv[5]
})
bot.on('message', (message) => {
console.log(message.toAnsi())
})