This commit is contained in:
2024-10-11 09:46:18 -04:00
parent 84c45695b7
commit ddc6f2d167
15 changed files with 1504 additions and 559 deletions

41
nodejs/controller/tp.js Normal file
View File

@ -0,0 +1,41 @@
'use strict';
const conf = require('../conf');
const {sleep} = require('../utils');
class Tp{
constructor(args){
this.bot = args.bot;
}
async init(){
for(let pluginName in this.bot.plunginsLoaded){
if(this.bot.plunginsLoaded[pluginName].isDangerous){
this.bot.pluginUnload(pluginName);
this.pluginToContinue = pluginName;
}
}
await this.bot.goTo({
where: this.bot.findBlockBySign('bot TP spot'),
range: 0,
});
this.cleatTimeout = setTimeout(()=>{
this.bot.pluginUnload(this.constructor.name)
}, 60000);
}
unload(){
if(this.cleatTimeout){
clearTimeout(this.cleatTimeout);
this.cleatTimeout = undefined;
}
if(this.pluginToContinue) this.bot.pluginLoad(this.pluginToContinue);
return true;
}
}
module.exports = Tp;