aboutsummaryrefslogtreecommitdiff
path: root/src/tasks/cpuUsage.ts
blob: 882d66037b28bb9f201e8292a92609c8f1cd80a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { BushTask } from '#lib';
import osu from 'node-os-utils';

export default class CpuUsageTask extends BushTask {
	public constructor() {
		super('cpuUsage', {
			delay: 60_000, // 1 minute
			runOnStart: true
		});
	}
	
	public override async exec() {
		const cpu = await osu.cpu.usage(client.stats.cpu === undefined ? 100 : 60_000);
		client.stats.cpu = cpu;
	}
}