diff options
Diffstat (limited to 'src/listeners/commands')
-rw-r--r-- | src/listeners/commands/commandBlocked.ts | 10 | ||||
-rw-r--r-- | src/listeners/commands/commandError.ts | 8 | ||||
-rw-r--r-- | src/listeners/commands/slashBlocked.ts | 10 | ||||
-rw-r--r-- | src/listeners/commands/slashCommandError.ts | 8 |
4 files changed, 16 insertions, 20 deletions
diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts index 03050c2..24d46af 100644 --- a/src/listeners/commands/commandBlocked.ts +++ b/src/listeners/commands/commandBlocked.ts @@ -37,12 +37,10 @@ export default class CommandBlockedListener extends BushListener { content: `${this.client.util.emojis.error} The \`${command.aliases[0]}\` command is currently disabled in \`${message.guild.name}\`.` }); } - case reasons.CHANNEL_BLACKLIST: { - return; - } - case reasons.USER_BLACKLIST: { - return; - } + case reasons.CHANNEL_GLOBAL_BLACKLIST: + case reasons.CHANNEL_GUILD_BLACKLIST: + case reasons.USER_GLOBAL_BLACKLIST: + case reasons.USER_GUILD_BLACKLIST: case reasons.ROLE_BLACKLIST: { return; } diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index 9d51ea8..696b59b 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -38,20 +38,20 @@ export default class CommandErrorListener extends BushListener { errorUserEmbed.setDescription( `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) => { + (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` + e?.stack || e); - }); + })) ?? this.client.console.error('CommandError', `Failed to send user error embed.` + error?.stack || error, false); } 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 || error}`, 2048, 'js')); - await message.util.send({ embeds: [errorDevEmbed] }).catch((e) => { + (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}>>.` + e?.stack || e); - }); + })) ?? this.client.console.error('CommandError', `Failed to send owner error stack.` + error?.stack || error, false); } } const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name; diff --git a/src/listeners/commands/slashBlocked.ts b/src/listeners/commands/slashBlocked.ts index bf98734..2443efb 100644 --- a/src/listeners/commands/slashBlocked.ts +++ b/src/listeners/commands/slashBlocked.ts @@ -38,12 +38,10 @@ export default class SlashBlockedListener extends BushListener { content: `${this.client.util.emojis.error} The \`${command.aliases[0]}\` command is currently disabled in \`${message.guild.name}\`.` }); } - case reasons.CHANNEL_BLACKLIST: { - return; - } - case reasons.USER_BLACKLIST: { - return; - } + case reasons.CHANNEL_GLOBAL_BLACKLIST: + case reasons.CHANNEL_GUILD_BLACKLIST: + case reasons.USER_GLOBAL_BLACKLIST: + case reasons.USER_GUILD_BLACKLIST: case reasons.ROLE_BLACKLIST: { return; } diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts index 9bf5f6a..8abe788 100644 --- a/src/listeners/commands/slashCommandError.ts +++ b/src/listeners/commands/slashCommandError.ts @@ -37,18 +37,18 @@ export default class SlashCommandErrorListener extends BushListener { errorUserEmbed.setDescription( `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) => { + (await message.util?.send({ embeds: [errorUserEmbed] }).catch((e) => { this.client.console.warn('SlashError', `Failed to send user error embed in <<${channel}>>:\n` + e?.stack || e); - }); + })) ?? this.client.console.error('SlashError', `Failed to send user error embed.` + error?.stack || error, false); } 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 || error}`, 2048, 'js')); - await message.util.send({ embeds: [errorDevEmbed] }).catch((e) => { + (await message.util?.send({ embeds: [errorDevEmbed] }).catch((e) => { this.client.console.warn('SlashError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e); - }); + })) ?? this.client.console.error('SlashError', `Failed to send user error embed.` + error?.stack || error, false); } } const channel = (message.channel as GuildChannel)?.name || message.interaction.user.tag; |