diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-26 22:20:52 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-26 22:20:52 -0400 |
commit | a1ab06dcfccef90192b90910aecdddbc505eca00 (patch) | |
tree | d2938e97ac06fc62fe17f5ec1fa4d927dc2922a6 /src/listeners/commands | |
parent | 3aeddeccc3765e532f6f965612873ab4a03bddd1 (diff) | |
download | tanzanite-a1ab06dcfccef90192b90910aecdddbc505eca00.tar.gz tanzanite-a1ab06dcfccef90192b90910aecdddbc505eca00.tar.bz2 tanzanite-a1ab06dcfccef90192b90910aecdddbc505eca00.zip |
sentry stuff
Diffstat (limited to 'src/listeners/commands')
-rw-r--r-- | src/listeners/commands/commandError.ts | 20 | ||||
-rw-r--r-- | src/listeners/commands/commandStarted.ts | 26 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index 0ef4ebd..61fe206 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -1,4 +1,5 @@ import { BushCommandHandlerEvents } from '@lib'; +import { Severity } from '@sentry/types'; import { AkairoMessage, Command, GuildTextBasedChannels } from 'discord-akairo'; import { DMChannel, Formatters, Message, MessageEmbed } from 'discord.js'; import { BushListener } from '../../lib/extensions/discord-akairo/BushListener'; @@ -26,6 +27,25 @@ export default class CommandErrorListener extends BushListener { : (message.channel as GuildTextBasedChannels)!.name; const command = _command ?? message.util?.parsed?.command; + client.sentry.captureException(error, { + level: Severity.Error, + user: { id: message.author.id, username: message.author.tag }, + extra: { + '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!.type === 'DM' + ? (message.channel as DMChannel)!.recipient.id + : (message.channel as GuildTextBasedChannels)!.id, + 'channel.name': channel, + 'guild.id': message.guild?.id, + 'guild.name': message.guild?.name, + 'environment': client.config.environment + } + }); + void client.console.error( `${isSlash ? 'slashC' : 'c'}ommandError`, `an error occurred with the <<${command}>> ${isSlash ? 'slash ' : ''}command in <<${channel}>> triggered by <<${ diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts index a9284ed..5d77d66 100644 --- a/src/listeners/commands/commandStarted.ts +++ b/src/listeners/commands/commandStarted.ts @@ -1,4 +1,7 @@ import { BushCommandHandlerEvents, BushListener } from '@lib'; +import { Severity } from '@sentry/types'; +import { GuildTextBasedChannels } from 'discord-akairo'; +import { DMChannel } from 'discord.js'; export default class CommandStartedListener extends BushListener { public constructor() { @@ -9,6 +12,29 @@ export default class CommandStartedListener extends BushListener { }); } public override exec(...[message, command]: BushCommandHandlerEvents['commandStarted']): void { + client.sentry.addBreadcrumb({ + message: `[commandStarted] 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!.type === 'DM' + ? (message.channel as DMChannel)!.recipient.id + : (message.channel as GuildTextBasedChannels)!.id, + 'channel.name': + message.channel!.type === 'DM' + ? (message.channel as DMChannel)!.recipient.tag + : (message.channel as GuildTextBasedChannels)!.name, + 'guild.id': message.guild?.id, + 'guild.name': message.guild?.name, + 'environment': client.config.environment + } + }); + void client.logger.info( 'commandStarted', `The <<${command.id}>> command was used by <<${message.author.tag}>> in ${ |