aboutsummaryrefslogtreecommitdiff
path: root/src/listeners/commands
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-04 16:26:56 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-04 16:26:56 -0400
commit153a40fbcd314459f94d9a2b44d3466c930c4e35 (patch)
tree5c853355da693e68c393b38c0c66a1f84ef0ac89 /src/listeners/commands
parentcf564dbb6435886f97e2e9870363144386af368d (diff)
downloadtanzanite-153a40fbcd314459f94d9a2b44d3466c930c4e35.tar.gz
tanzanite-153a40fbcd314459f94d9a2b44d3466c930c4e35.tar.bz2
tanzanite-153a40fbcd314459f94d9a2b44d3466c930c4e35.zip
cleaned up
Diffstat (limited to 'src/listeners/commands')
-rw-r--r--src/listeners/commands/commandError.ts19
-rw-r--r--src/listeners/commands/slashCommandError.ts19
2 files changed, 10 insertions, 28 deletions
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index 20132dd..d80a2bc 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -22,7 +22,7 @@ export default class CommandErrorListener extends BushListener {
**Channel:** ${message.channel} (${message.channel?.id})
**Message:** [link](${message.url})`
)
- .addField('Error', await this.client.util.codeblock(`${typeof error === 'object' ? error?.stack : error}`, 1024, 'js'))
+ .addField('Error', await this.client.util.codeblock(`${error?.stack || error}`, 1024, 'js'))
.setColor(this.client.util.colors.error)
.setTimestamp();
@@ -41,23 +41,17 @@ export default class CommandErrorListener extends BushListener {
);
await message.util.send({ embeds: [errorUserEmbed] }).catch((e) => {
const channel = message.channel.type === 'dm' ? message.channel.recipient.tag : message.channel.name;
- this.client.console.warn(
- 'CommandError',
- `Failed to send user error embed in <<${channel}>>:\n` + typeof e === 'object' ? e?.stack : e
- );
+ this.client.console.warn('CommandError', `Failed to send user error embed in <<${channel}>>:\n` + e?.stack || e);
});
} else {
const errorDevEmbed = new MessageEmbed()
.setTitle('A Command Error Occurred')
.setColor(this.client.util.colors.error)
.setTimestamp()
- .setDescription(await this.client.util.codeblock(`${error?.stack}`, 2048, 'js'));
+ .setDescription(await this.client.util.codeblock(`${error?.stack || error}`, 2048, 'js'));
await message.util.send({ embeds: [errorDevEmbed] }).catch((e) => {
const channel = message.channel.type === 'dm' ? message.channel.recipient.tag : message.channel.name;
- this.client.console.warn(
- 'CommandError',
- `Failed to send owner error stack in <<${channel}>>.` + typeof e === 'object' ? e?.stack : e
- );
+ this.client.console.warn('CommandError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e);
});
}
}
@@ -65,10 +59,7 @@ export default class CommandErrorListener extends BushListener {
this.client.console.error(
'CommandError',
`an error occurred with the <<${command}>> command in <<${channel}>> triggered by <<${message?.author?.tag}>>:\n` +
- typeof error ===
- 'object'
- ? error?.stack
- : error,
+ error?.stack || error,
false
);
}
diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts
index b172670..6bbb462 100644
--- a/src/listeners/commands/slashCommandError.ts
+++ b/src/listeners/commands/slashCommandError.ts
@@ -21,7 +21,7 @@ export default class SlashCommandErrorListener extends BushListener {
**Channel:** ${message.channel || message.interaction.user?.tag} ${message.channel ? `(${message.channel?.id})` : ''}
**Message:** [link](https://discord.com/${message.guild?.id}/${message.channel?.id}/${message.id})`
)
- .addField('Error', await this.client.util.codeblock(`${typeof error === 'object' ? error?.stack : error}`, 1024, 'js'))
+ .addField('Error', await this.client.util.codeblock(`${error?.stack || error}`, 1024, 'js'))
.setColor(this.client.util.colors.error)
.setTimestamp();
@@ -40,22 +40,16 @@ export default class SlashCommandErrorListener extends BushListener {
`Oh no! While running the command \`${command.id}\`, an error occurred. Please give the developers code \`${errorNo}\`.`
);
await message.util.send({ embeds: [errorUserEmbed] }).catch((e) => {
- this.client.console.warn(
- 'SlashError',
- `Failed to send user error embed in <<${channel}>>:\n` + typeof e === 'object' ? e?.stack : e
- );
+ this.client.console.warn('SlashError', `Failed to send user error embed in <<${channel}>>:\n` + e?.stack || e);
});
} else {
const errorDevEmbed = new MessageEmbed()
.setTitle('A Slash Command Error Occurred')
.setColor(this.client.util.colors.error)
.setTimestamp()
- .setDescription(await this.client.util.codeblock(`${error?.stack}`, 2048, 'js'));
+ .setDescription(await this.client.util.codeblock(`${error?.stack || error}`, 2048, 'js'));
await message.util.send({ embeds: [errorDevEmbed] }).catch((e) => {
- this.client.console.warn(
- 'SlashError',
- `Failed to send owner error stack in <<${channel}>>.` + typeof e === 'object' ? e?.stack : e
- );
+ this.client.console.warn('SlashError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e);
});
}
}
@@ -63,10 +57,7 @@ export default class SlashCommandErrorListener extends BushListener {
this.client.console.error(
'SlashError',
`an error occurred with the <<${command}>> command in <<${channel}>> triggered by <<${message?.author?.tag}>>:\n` +
- typeof error ===
- 'object'
- ? error?.stack
- : error,
+ error?.stack || error,
false
);
}