plugins
This commit is contained in:
41
nodejs/controller/tp.js
Normal file
41
nodejs/controller/tp.js
Normal 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;
|
Reference in New Issue
Block a user