botv12/plugins/chatqueue.js

19 lines
461 B
JavaScript
Raw Normal View History

2024-10-23 22:59:54 -04:00
export default function load (b) {
2024-10-20 19:02:13 -04:00
b._client.on('login', () => {
b.interval.chatQueue = setInterval(() => {
if (b.chatqueue.length !== 0) {
b._client.chat(b.chatqueue[0])
b.chatqueue.splice(0, 1)
}
}, 100)
})
b.matcherRegex = /.{1,255}/g
2024-10-20 19:02:55 -04:00
b.chatqueue = []
2024-10-20 19:02:13 -04:00
b.chat = function chat (msg) {
if (msg.length === 0) return
msg.match(b.matcherRegex).forEach(element => {
b.chatqueue.push(element)
})
}
}