This commit is contained in:
ChomeNS 2022-12-09 18:03:29 +07:00
parent 5c15e0dc4b
commit bad7207eaf

3
bot.js
View file

@ -27,7 +27,6 @@ const mineflayer = require('mineflayer')
*/ */
async function createBot (server, config, getBots, setNewBot, dcclient, rl) { async function createBot (server, config, getBots, setNewBot, dcclient, rl) {
const bot = new EventEmitter() const bot = new EventEmitter()
bot.setMaxListeners(Infinity) // is this bad code?
bot.options = { bot.options = {
username: !server.kaboom username: !server.kaboom
? 'ChomeNS_Bot' ? 'ChomeNS_Bot'
@ -42,6 +41,8 @@ async function createBot (server, config, getBots, setNewBot, dcclient, rl) {
hideErrors: true hideErrors: true
} }
bot._client = mc.createClient(bot.options) bot._client = mc.createClient(bot.options)
bot.setMaxListeners(Infinity) // is this bad code?
bot._client.setMaxListeners(Infinity) // this too
bot.version = bot._client.version bot.version = bot._client.version
bot.write = (name, data) => bot._client.write(name, data) bot.write = (name, data) => bot._client.write(name, data)
bot.end = (reason = 'end', event) => { bot.end = (reason = 'end', event) => {