mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
5d2a06b424
not 1.19.3 because formattedMessage doesn't exist on kaboom so prefixes like [OP] doesn't appear
16 lines
523 B
JavaScript
16 lines
523 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('systemChat', listener)
|
|
target.on('chat', listener)
|
|
|
|
target.on('message', (message, packet) => {
|
|
parsePlayerMessages(message, packet, target)
|
|
})
|
|
};
|
|
|
|
module.exports = { inject }
|