aboutsummaryrefslogtreecommitdiff
path: root/src/tasks/stats/guildCount.ts
blob: 177c959d92de7bdffc7c66bf8a5a87d71c5e9bed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { BotTask, GuildCount, Time } from '#lib';

export default class GuildCountTask extends BotTask {
	public constructor() {
		super('guildCount', {
			delay: 15 * Time.Minute,
			runOnStart: true
		});
	}

	public override async exec() {
		if (!this.client.config.isProduction) return;

		try {
			await GuildCount.create({
				environment: this.client.config.environment,
				guildCount: this.client.guilds.cache.size
			});
		} catch (err) {
			void this.client.console.error('guildCount', err);
		}
	}
}