chomens-bot-js/plugins/proxy/chat.js
ChomeNS e1a1d92723 1.19 support for both bot and proxy
this somehow took 1 hour(?)
2022-12-10 13:31:01 +07:00

16 lines
528 B
JavaScript

const { chatPacketListener, parsePlayerMessages } = require('../../util/chat')
const minecraftVersionToNumber = require('../../util/minecraftVersionToNumber')
function inject (bot, client, target) {
function listener (packet) {
chatPacketListener(packet, target, minecraftVersionToNumber(target.version) >= 1.19)
}
target.on('chat', listener)
target.on('system_chat', listener)
target.on('parsed_chat', (message, packet) => {
parsePlayerMessages(message, packet, target)
})
};
module.exports = { inject }