Add command loop system
This commit is contained in:
parent
818404f3ee
commit
60dee069a8
1 changed files with 26 additions and 0 deletions
26
plugins/cloop.js
Executable file
26
plugins/cloop.js
Executable file
|
@ -0,0 +1,26 @@
|
|||
module.exports={
|
||||
load:()=>{
|
||||
|
||||
},
|
||||
loadBot:(b)=>{
|
||||
b.cloops=[];
|
||||
b.addCloop=function (command, rate){
|
||||
b.cloops.push({
|
||||
command,
|
||||
rate,
|
||||
interval: setInterval(()=>{b.ccq.push(command)},rate)
|
||||
})
|
||||
b.ccq.push(command)
|
||||
}
|
||||
b.removeCloop=function (index){
|
||||
clearInterval(b.cloops[index].interval)
|
||||
b.cloops.splice(index,1)
|
||||
}
|
||||
b.clearCloops=function (){
|
||||
for(const i in b.cloops){
|
||||
clearInterval(b.cloops[i].interval)
|
||||
}
|
||||
b.cloops=[];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue