chomens-bot-js/plugins/proxy/chat.js

17 lines
523 B
JavaScript
Raw Normal View History

2022-11-30 06:01:46 -05:00
const { chatPacketListener, parsePlayerMessages } = require('../../util/chat')
const minecraftVersionToNumber = require('../../util/minecraftVersionToNumber')
2022-11-30 06:01:46 -05:00
function inject (bot, client, target) {
function listener (packet) {
chatPacketListener(packet, target, minecraftVersionToNumber(target.version) >= 1.19)
}
target.on('systemChat', listener)
target.on('chat', listener)
2022-11-30 06:01:46 -05:00
2022-12-12 03:06:50 -05:00
target.on('message', (message, packet) => {
2022-11-30 06:01:46 -05:00
parsePlayerMessages(message, packet, target)
})
};
module.exports = { inject }