diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-25 17:05:24 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-25 17:05:24 -0400 |
commit | 59ea06a2f010ad7503e4f7b7a1894485d37a416e (patch) | |
tree | 78a20be7fb7aad6e77b906a641e7755ec4baee55 /src/listeners/commands | |
parent | 994de0471e7032e8c1fc7d7621ecae880746a3f1 (diff) | |
download | tanzanite-59ea06a2f010ad7503e4f7b7a1894485d37a416e.tar.gz tanzanite-59ea06a2f010ad7503e4f7b7a1894485d37a416e.tar.bz2 tanzanite-59ea06a2f010ad7503e4f7b7a1894485d37a416e.zip |
feat: add slash command usage
Diffstat (limited to 'src/listeners/commands')
-rw-r--r-- | src/listeners/commands/slashStarted.ts | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/listeners/commands/slashStarted.ts b/src/listeners/commands/slashStarted.ts index 0084dc6..3e945a9 100644 --- a/src/listeners/commands/slashStarted.ts +++ b/src/listeners/commands/slashStarted.ts @@ -1,4 +1,5 @@ import { BushListener, type BushCommandHandlerEvents } from '#lib'; +import { Severity } from '@sentry/types'; import { ChannelType } from 'discord.js'; export default class SlashStartedListener extends BushListener { @@ -11,7 +12,25 @@ export default class SlashStartedListener extends BushListener { } public override async exec(...[message, command]: BushCommandHandlerEvents['slashStarted']) { - return void client.logger.info( + client.sentry.addBreadcrumb({ + message: `[slashStarted] The ${command.id} was started by ${message.author.tag}.`, + level: Severity.Info, + timestamp: Date.now(), + data: { + 'command.name': command?.id, + 'message.id': message.id, + 'message.type': message.util.isSlash ? 'slash' : 'normal', + 'message.parsed.content': message.util.parsed?.content, + 'channel.id': (message.channel?.isDMBased() ? message.channel.recipient?.id : message.channel?.id) ?? '¯\\_(ツ)_/¯', + 'channel.name': + (message.channel?.isDMBased() ? message.channel.recipient?.tag : (<any>message.channel)?.name) ?? '¯\\_(ツ)_/¯', + 'guild.id': message.guild?.id ?? '¯\\_(ツ)_/¯', + 'guild.name': message.guild?.name ?? '¯\\_(ツ)_/¯', + 'environment': client.config.environment + } + }); + + void client.logger.info( 'slashStarted', `The <<${command.id}>> command was used by <<${message.author.tag}>> in ${ message.channel @@ -22,5 +41,7 @@ export default class SlashStartedListener extends BushListener { }.`, true ); + + client.stats.commandsUsed = client.stats.commandsUsed + 1n; } } |