forked from afspiegeling/NitoriBot
v6.0.0 build: 950
This commit is contained in:
@@ -2,27 +2,29 @@ function command_loop (bot, options, config) {
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
add (command, interval) {
|
||||
setTimeout(() => {
|
||||
this.list.push({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
}, 10)
|
||||
let timer;
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer)
|
||||
|
||||
bot.on('end', () => {
|
||||
this.clear()
|
||||
})
|
||||
|
||||
bot.on('packet.login', () => {
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer);
|
||||
})
|
||||
},
|
||||
|
||||
remove (index) {
|
||||
clearInterval(this.list[index].timer)
|
||||
bot.cloop.list.splice(index, 1)
|
||||
},
|
||||
|
||||
clear () {
|
||||
for (const cloop of this.list) clearInterval(cloop.timer)
|
||||
this.list = []
|
||||
}
|
||||
}
|
||||
/* bot.on('end', () => {
|
||||
// clearInterval(this.list);
|
||||
for (const cloop of this.list) console.log(cloop)
|
||||
console.log('e')
|
||||
})*/
|
||||
}
|
||||
module.exports = command_loop;
|
||||
|
||||
Reference in New Issue
Block a user