chomens-bot-js/plugins/tellraw.js

13 lines
415 B
JavaScript
Raw Permalink Normal View History

function inject (bot, dcclient, config) {
const ChatMessage = require('prismarine-chat')(bot.version)
2022-11-27 02:35:28 -05:00
bot.tellraw = function (selector, message) {
2023-03-01 07:51:24 -05:00
if (bot.options.useChat && selector === '@a') {
bot.chat(ChatMessage.fromNotch(message).toMotd().replaceAll('\xa7', '&'))
return
}
bot.core.run(`minecraft:tellraw ${selector} ${JSON.stringify(message)}`)
2022-11-27 02:35:28 -05:00
}
};
2022-11-27 02:35:28 -05:00
module.exports = { inject }