bobcat/ts/bobcat.classes.bobcatmanager.ts
2022-02-25 21:45:11 +00:00

28 lines
912 B
TypeScript

import * as plugins from './bobcat.plugins';
import { Bobcat } from './bobcat.classes.bobcat';
/**
*
*/
export class BobcatManager {
public bobcats: Bobcat[] = [];
public async addBobcat(networkAddressArg: string) {
const newBobcat = await Bobcat.createFromNetworkAddress(networkAddressArg);
this.bobcats.push(newBobcat);
console.log(`added ${newBobcat.latestMinerDetails.animal} at ${newBobcat.networkAddress}`);
}
/**
* runs the maintenance on all managed bobcats
*/
public async runMaintenance() {
console.log(`now running maintenance on ${this.bobcats.length} bobcats!`);
console.log(`cooling down for 10 seconds`);
await plugins.smartdelay.delayFor(10000);
for (const bobcat of this.bobcats) {
console.log(`now running maintenance on ${bobcat.latestMinerDetails.animal} at ${bobcat.networkAddress}`);
await bobcat.runMaintenance();
}
};
}