refactor(informer): ♻️ reorder config loading

This commit is contained in:
jay 2021-05-07 12:40:17 +05:00
parent df193da779
commit e879d1f4ad

View File

@ -1,9 +1,19 @@
let cfg
let bot
let mcData
let quiet
// import v from 'vec3'
const v = require('vec3')
let cfg = {
info: {
quiet: quiet,
recentCommand: null,
},
// to satisfy typescript
quiet: null,
bot: bot
}
function block(pos) {
const block = pos ? bot.blockAt(v(pos)) : bot.blockAtCursor()
console.log(block, block && block.getProperties())
@ -133,12 +143,9 @@ function command(message_parts, player) {
}
const load = (config) => {
config.info = cfg.info
cfg = config
bot = cfg.bot
cfg.info = {
quiet: cfg.quiet,
recentCommand: null,
}
mcData = bot.mcData || (bot.mcData = require('minecraft-data')(bot.version))
}