mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 18:54:55 -05:00
e1a1d92723
this somehow took 1 hour(?)
16 lines
528 B
JavaScript
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 }
|