owobot/util/parseNBT.js

11 lines
300 B
JavaScript
Executable file

const { processNbtMessage } = require('prismarine-chat')
const parse = function (data) {
if (typeof data.type === 'string') {
return JSON.parse(processNbtMessage(data))
} else if (typeof data === 'string') {
return JSON.parse(data)
} else {
return data
}
}
module.exports = parse