FridayNightFunkinBoyfriendBot/src/modules/command_loop.js

19 lines
471 B
JavaScript
Raw Normal View History

2024-07-07 15:44:16 -04:00
function command_loop (bot, options, config) {
bot.cloop = {
list: [],
add (command, interval) {
this.list.push({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
},
remove (index) {
clearInterval(this.list[index].timer)
2024-07-20 20:27:17 -04:00
bot.cloop.list.splice(index, 1)
2024-07-07 15:44:16 -04:00
},
clear () {
for (const cloop of this.list) clearInterval(cloop.timer)
this.list = []
}
}
}
module.exports = command_loop;