owobot/util/parseNBT.js

12 lines
300 B
JavaScript
Raw Normal View History

2024-08-12 04:33:43 -04:00
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