aboutsummaryrefslogtreecommitdiff
path: root/src/listeners/commands
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-30 19:42:10 +0000
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-30 19:42:10 +0000
commitbada2976eed34a2530bc09683d2de17c71c744a8 (patch)
treefe459cebb005dd90d1ae7ed3269a77248f780499 /src/listeners/commands
parentaaef32128f8c8c30254836932805d0745647c646 (diff)
downloadtanzanite-bada2976eed34a2530bc09683d2de17c71c744a8.tar.gz
tanzanite-bada2976eed34a2530bc09683d2de17c71c744a8.tar.bz2
tanzanite-bada2976eed34a2530bc09683d2de17c71c744a8.zip
some fixes + some more error stuff
Diffstat (limited to 'src/listeners/commands')
-rw-r--r--src/listeners/commands/commandError.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index 1cf7c08..d24c0f0 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -1,6 +1,7 @@
-import { BushCommandHandlerEvents, BushListener } from '@lib';
import { AkairoMessage, Command, GuildTextBasedChannels } from 'discord-akairo';
-import { DMChannel, Message, MessageEmbed } from 'discord.js';
+import { DMChannel, Formatters, Message, MessageEmbed } from 'discord.js';
+import { BushCommandHandlerEvents } from '../../lib/extensions/discord-akairo/BushCommandHandler';
+import { BushListener } from '../../lib/extensions/discord-akairo/BushListener';
export default class CommandErrorListener extends BushListener {
public constructor() {
@@ -70,7 +71,7 @@ export default class CommandErrorListener extends BushListener {
command?: Command;
channel?: string;
}
- | { error: Error | any; type: 'uncaughtException' | 'unhandledRejection' }
+ | { error: Error | any; type: 'uncaughtException' | 'unhandledRejection'; context?: string }
): Promise<MessageEmbed> {
const embed = new MessageEmbed().setColor(util.colors.error).setTimestamp();
if (options.type === 'command-user') {
@@ -128,8 +129,12 @@ export default class CommandErrorListener extends BushListener {
if (options.type === 'command-dev' || options.type === 'command-log')
embed.setTitle(`${options.isSlash ? 'Slash ' : ''}CommandError #\`${options.errorNum}\``);
- else if (options.type === 'uncaughtException') embed.setTitle('Uncaught Exception');
- else if (options.type === 'unhandledRejection') embed.setTitle('Unhandled Promise Rejection');
+ else if (options.type === 'uncaughtException')
+ embed.setTitle(`${options.context ? `[${Formatters.bold(options.context)}] An Error Occurred` : 'Uncaught Exception'}`);
+ else if (options.type === 'unhandledRejection')
+ embed.setTitle(
+ `${options.context ? `[${Formatters.bold(options.context)}] An Error Occurred` : 'Unhandled Promise Rejection'}`
+ );
return embed;
}
}