diff options
Diffstat (limited to 'src/tasks/updateStats.ts')
-rw-r--r-- | src/tasks/updateStats.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tasks/updateStats.ts b/src/tasks/updateStats.ts index 0e50c23..0d0e661 100644 --- a/src/tasks/updateStats.ts +++ b/src/tasks/updateStats.ts @@ -1,4 +1,5 @@ import { BushTask, Stat, Time } from '#lib'; +import { Client } from 'discord.js'; export default class UpdateStatsTask extends BushTask { public constructor() { @@ -10,13 +11,14 @@ export default class UpdateStatsTask extends BushTask { public async exec() { const row = - (await Stat.findByPk(client.config.environment)) ?? (await Stat.create({ environment: client.config.environment })); - row.commandsUsed = client.stats.commandsUsed; - row.slashCommandsUsed = client.stats.slashCommandsUsed; + (await Stat.findByPk(this.client.config.environment)) ?? + (await Stat.create({ environment: this.client.config.environment })); + row.commandsUsed = this.client.stats.commandsUsed; + row.slashCommandsUsed = this.client.stats.slashCommandsUsed; await row.save(); } - public static async init(): Promise<{ commandsUsed: bigint; slashCommandsUsed: bigint }> { + public static async init(client: Client): Promise<{ commandsUsed: bigint; slashCommandsUsed: bigint }> { const temp = (await Stat.findByPk(client.config.environment)) ?? (await Stat.create({ environment: client.config.environment })); return { commandsUsed: temp.commandsUsed, slashCommandsUsed: temp.slashCommandsUsed }; |