diff options
Diffstat (limited to 'src/tasks')
-rw-r--r-- | src/tasks/stats/guildCount.ts | 24 | ||||
-rw-r--r-- | src/tasks/stats/memberCount.ts (renamed from src/tasks/feature/memberCount.ts) | 0 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/tasks/stats/guildCount.ts b/src/tasks/stats/guildCount.ts new file mode 100644 index 0000000..262f00c --- /dev/null +++ b/src/tasks/stats/guildCount.ts @@ -0,0 +1,24 @@ +import { BushTask, Time } from '#lib'; +import { GuildCount } from '../../lib/models/shared/GuildCount.js'; + +export default class GuildCountTask extends BushTask { + 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); + } + } +} diff --git a/src/tasks/feature/memberCount.ts b/src/tasks/stats/memberCount.ts index 9c31c5b..9c31c5b 100644 --- a/src/tasks/feature/memberCount.ts +++ b/src/tasks/stats/memberCount.ts |