INNER CODE UNIT · JavaScript
createBot
PrismarineJS/mineflayer · lib/loader.js:68
function createBot (options = {}) {
options.username = options.username ?? 'Player'
options.version = options.version ?? false
options.plugins = options.plugins ?? {}
options.hideErrors = options.hideErrors ?? false
options.logErrors = options.logErrors ?? true
options.loadInternalPlugins = options.loadInternalPlugins ?? true
options.client = options.client ?? null
options.brand = options.brand ?? 'vanilla'
options.respawn = options.respawn ?? true
const bot = new EventEmitter()
bot._client = options.client
bot.end = (reason) => bot._client.end(reason)
bot._warn = function (...message) {
if (options.hideErrors) return
console.warn('[mineflayer]', ...message)
}
if (options.logErrors) {