diff options
Diffstat (limited to 'src/tasks/feature/updateStats.js')
-rw-r--r-- | src/tasks/feature/updateStats.js | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/tasks/feature/updateStats.js b/src/tasks/feature/updateStats.js index 18a9a7c..48d431a 100644 --- a/src/tasks/feature/updateStats.js +++ b/src/tasks/feature/updateStats.js @@ -1,22 +1,24 @@ import { BushTask, Stat, Time } from '#lib'; import { Client } from 'discord.js'; export default class UpdateStatsTask extends BushTask { - constructor() { - super('updateStats', { - delay: 10 * 60000, - runOnStart: true - }); - } - async exec() { - const row = (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(); - } - static async init(client) { - const temp = (await Stat.findByPk(client.config.environment)) ?? (await Stat.create({ environment: client.config.environment })); - return { commandsUsed: temp.commandsUsed, slashCommandsUsed: temp.slashCommandsUsed }; - } + constructor() { + super('updateStats', { + delay: 10 * 60000, + runOnStart: true + }); + } + async exec() { + const row = + (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(); + } + static async init(client) { + const temp = + (await Stat.findByPk(client.config.environment)) ?? (await Stat.create({ environment: client.config.environment })); + return { commandsUsed: temp.commandsUsed, slashCommandsUsed: temp.slashCommandsUsed }; + } } -//# sourceMappingURL=updateStats.js.map
\ No newline at end of file +//# sourceMappingURL=updateStats.js.map |