Change chat length based on version

This commit is contained in:
7cc5c4f330d47060 2024-09-12 00:40:05 -04:00
parent e609a1b716
commit 54fd31f890
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA

View file

@ -1,3 +1,4 @@
const protover = require("../util/getProtocolVersion.js")
module.exports = {
load: (b) => {
b._client.on('login', () => {
@ -8,10 +9,14 @@ module.exports = {
}
}, 100)
})
b.matcherRegex = /.{1,99}/g;
if(protover(b._client.version) >= 306){ // 16w38a
b.matcherRegex = /.{1,255}/g
}
b.chatqueue = []
b.chat = function chat (msg) {
if (msg.length === 0) return
msg.match(/.{1,255}/g).forEach(element => {
msg.match(b.matcherRegex).forEach(element => {
b.chatqueue.push(element)
})
}