Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bot.on('playerCollect', (collector, collected) => {
if (collector.type === 'player' && collected.type === 'object') {
const rawItem = collected.metadata[10]
const item = mineflayer.Item.fromNotch(rawItem)
bot.chat(`${collector.username !== bot.username ? ("I'm so jealous. " + collector.username) : 'I '} collected ${item.count} ${item.displayName}`)
}
})