diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClient.ts | 11 | ||||
-rw-r--r-- | src/lib/models/shared/Stat.ts | 18 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 5ccc283..4df751d 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -125,7 +125,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re /** * Stats for the client. */ - public stats: BushStats = { cpu: undefined, commandsUsed: 0n }; + public stats: BushStats = { cpu: undefined, commandsUsed: 0n, slashCommandsUsed: 0n }; /** * The configuration for the client. @@ -482,7 +482,9 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re await this.highlightManager.syncCache(); await UpdateCacheTask.init(this); void this.console.success('startup', `Successfully created <<cache>>.`, false); - this.stats.commandsUsed = await UpdateStatsTask.init(); + const stats = await UpdateStatsTask.init(); + this.stats.commandsUsed = stats.commandsUsed; + this.stats.slashCommandsUsed = stats.slashCommandsUsed; await this.login(this.token!); } catch (e) { await this.console.error('start', util.inspect(e, { colors: true, depth: 1 }), false); @@ -539,6 +541,11 @@ export interface BushStats { * The total number of times any command has been used. */ commandsUsed: bigint; + + /** + * The total number of times any slash command has been used. + */ + slashCommandsUsed: bigint; } export interface Emitters { diff --git a/src/lib/models/shared/Stat.ts b/src/lib/models/shared/Stat.ts index d138620..8e2e0b3 100644 --- a/src/lib/models/shared/Stat.ts +++ b/src/lib/models/shared/Stat.ts @@ -7,11 +7,13 @@ type Environment = 'production' | 'development' | 'beta'; export interface StatModel { environment: Environment; commandsUsed: bigint; + slashCommandsUsed: bigint; } export interface StatModelCreationAttributes { environment: Environment; commandsUsed?: bigint; + slashCommandsUsed?: bigint; } /** @@ -29,6 +31,11 @@ export class Stat extends BaseModel<StatModel, StatModelCreationAttributes> impl public declare commandsUsed: bigint; /** + * The number of slash commands used + */ + public declare slashCommandsUsed: bigint; + + /** * Initializes the model. * @param sequelize The sequelize instance. */ @@ -46,6 +53,17 @@ export class Stat extends BaseModel<StatModel, StatModelCreationAttributes> impl }, allowNull: false, defaultValue: `${0n}` + }, + slashCommandsUsed: { + type: DataTypes.TEXT, + get: function (): bigint { + return BigInt(this.getDataValue('slashCommandsUsed')); + }, + set: function (val: bigint) { + return this.setDataValue('slashCommandsUsed', <any>`${val}`); + }, + allowNull: false, + defaultValue: `${0n}` } }, { sequelize } |