17 lines
377 B
JavaScript
17 lines
377 B
JavaScript
function inject (bot) {
|
|
bot.cloops ??= []
|
|
setInterval(() => {
|
|
bot.cloops.forEach((cloop, i) => {
|
|
if (!cloop.timeout) loop(i)
|
|
})
|
|
}, 1)
|
|
function loop (i) {
|
|
if (bot.cloops[i] == null) { return }
|
|
|
|
bot.cloops[i].timeout = true
|
|
bot.core.run(bot.cloops[i].command)
|
|
setTimeout(() => loop(i), bot.cloops[i].interval)
|
|
}
|
|
}
|
|
|
|
module.exports = inject
|