Add startFailed to SCTask

This commit is contained in:
7cc5c4f330d47060 2024-07-17 19:02:06 -04:00
parent 6b0c043397
commit 7877b7c4d8
2 changed files with 5 additions and 5 deletions

View file

@ -1,11 +1,11 @@
class SCTask{
constructor (failTask,chatCommand){
constructor (failTask,chatCommand,startFailed=false){
/*
* failed: Whether to run this task
* failTask: Command to run when failed is true
* chatCommand: Whether to run failTask in chat rather than in command block
*/
this.failed=false;
this.failed=startFailed;
this.failTask=failTask;
this.chatCommand=chatCommand;
}
@ -27,8 +27,8 @@ module.exports={
}
}
},1000)
b.add_sc_task=(name,failTask,chatCommand)=>{
b.sc_tasks[name] = new SCTask(failTask,chatCommand);
b.add_sc_task=(name,failTask,chatCommand,startFailed)=>{
b.sc_tasks[name] = new SCTask(failTask,chatCommand,startFailed);
}
}
}

View file

@ -4,7 +4,7 @@ module.exports={
},
loadBot:(b)=>{
b.add_sc_task("cspy","/cspy on", true)
b.add_sc_task("cspy","/cspy on", true, true)
b.on('plainchat', (msg) => {
if (msg == "Successfully disabled CommandSpy") {
b.sc_tasks["cspy"].failed = 1