chomens-bot-js/plugins/tellraw.js

13 lines
455 B
JavaScript
Raw 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) {
if (config.chat.useChat && selector === '@a') {
bot.chat(ChatMessage.fromNotch(message).toMotd().replaceAll('\xa7', '&'))
return
}
2022-11-27 02:35:28 -05:00
bot.core.run(`minecraft:tellraw ${selector} ${typeof message === 'string' ? message : JSON.stringify(message)}`)
}
};
2022-11-27 02:35:28 -05:00
module.exports = { inject }