Run clearInterval when reconnecting
This commit is contained in:
parent
b25aad71a1
commit
e48ce14155
2 changed files with 5 additions and 2 deletions
5
index.js
5
index.js
|
@ -48,7 +48,10 @@ const createBot = function createBot(host,oldId){
|
|||
//console.log(bot);
|
||||
})
|
||||
if(typeof oldId !== "undefined"){
|
||||
delete bot[oldId];
|
||||
for(const i in module.exports.bot[oldId].interval){
|
||||
clearInterval(module.exports.bot[oldId].interval[i]);
|
||||
}
|
||||
delete module.exports.bot[oldId];
|
||||
bot.id=oldId;
|
||||
module.exports.bot[oldId]=bot;
|
||||
console.log("Re-creating bot "+bot.id)
|
||||
|
|
|
@ -57,7 +57,7 @@ module.exports = {
|
|||
b.chat(`/fill ~ 10 ~ ~ 15 ~ command_block`)
|
||||
})
|
||||
b.on('ccstart', () => {
|
||||
setTimeout(() => { b.ccqi = setInterval(b.advanceccq, 12) }, 1000) // 1 Second and 12 Milliseconds
|
||||
setTimeout(() => { b.interval.ccqi = setInterval(b.advanceccq, 12) }, 1000) // 1 Second and 12 Milliseconds
|
||||
b.ccStarted = true;
|
||||
b.info("Command block!");
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue