diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-06 21:07:39 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-06 21:07:39 -0400 |
commit | 0aaa6166af6ff17f9b643997fccb44de1b57b1e5 (patch) | |
tree | 5635294e59183d93359393c94d826f99cc9b1063 /src/tasks/stats/guildCount.ts | |
parent | c3e19b629b1d49b904782b3c21decb804ae7f1d1 (diff) | |
download | tanzanite-0aaa6166af6ff17f9b643997fccb44de1b57b1e5.tar.gz tanzanite-0aaa6166af6ff17f9b643997fccb44de1b57b1e5.tar.bz2 tanzanite-0aaa6166af6ff17f9b643997fccb44de1b57b1e5.zip |
track the number of guilds the bot is in so I can make a graph
Diffstat (limited to 'src/tasks/stats/guildCount.ts')
-rw-r--r-- | src/tasks/stats/guildCount.ts | 24 |
1 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); + } + } +} |