owobot/plugins/cq.js

25 lines
652 B
JavaScript
Raw Normal View History

2024-09-19 22:21:01 -04:00
const protover = require('../util/getProtocolVersion.js')
2024-07-30 05:56:23 -04:00
module.exports = {
load: (b) => {
b._client.on('login', () => {
b.interval.chatQueue = setInterval(() => {
if (b.chatqueue.length !== 0) {
b._client.chat(b.chatqueue[0])
b.chatqueue.splice(0, 1)
}
2024-08-04 17:40:00 -04:00
}, 100)
2024-07-30 05:56:23 -04:00
})
2024-09-19 22:21:01 -04:00
b.matcherRegex = /.{1,99}/g
if (protover(b._client.version) >= 306) { // 16w38a
2024-09-12 00:40:05 -04:00
b.matcherRegex = /.{1,255}/g
}
2024-07-30 05:56:23 -04:00
b.chatqueue = []
b.chat = function chat (msg) {
if (msg.length === 0) return
2024-09-12 00:40:05 -04:00
msg.match(b.matcherRegex).forEach(element => {
2024-07-30 05:56:23 -04:00
b.chatqueue.push(element)
})
}
}
}