Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function craftItem (name, amount) {
amount = parseInt(amount, 10)
const item = require('minecraft-data')(bot.version).findItemOrBlockByName(name)
const craftingTable = bot.findBlock({
matching: 58
})
if (item) {
const recipe = bot.recipesFor(item.id, null, 1, craftingTable)[0]
if (recipe) {
bot.chat(`I can make ${name}`)
bot.craft(recipe, amount, craftingTable, (err) => {
if (err) {
bot.chat(`error making ${name}`)
} else {
bot.chat(`did the recipe for ${name} ${amount} times`)
}
})
} else {