From 14df0637ae4e494e9907e5aa08ea3b4a11884926 Mon Sep 17 00:00:00 2001 From: Isaac Date: Mon, 31 Oct 2022 21:19:29 +0000 Subject: [PATCH] Improve errors --- src/listeners/buttons/error.js | 21 +++++++-------------- src/listeners/commands/error.js | 21 +++++++-------------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/listeners/buttons/error.js b/src/listeners/buttons/error.js index e3abb4c..d1f86d3 100644 --- a/src/listeners/buttons/error.js +++ b/src/listeners/buttons/error.js @@ -1,7 +1,7 @@ const { Listener } = require('@eartharoid/dbf'); const { EmbedBuilder, - inlineCode, + codeBlock, } = require('discord.js'); module.exports = class extends Listener { @@ -29,18 +29,6 @@ module.exports = class extends Listener { })).locale; } const getMessage = this.client.i18n.getLocale(locale); - const fields = [ - { - name: getMessage('misc.error.fields.identifier'), - value: inlineCode(ref), - }, - ]; - if (error.name) { - fields.unshift({ - name: getMessage('misc.error.fields.code'), - value: inlineCode(error.name), - }); - } const data = { components: [], embeds: [ @@ -48,7 +36,12 @@ module.exports = class extends Listener { .setColor('Orange') .setTitle(getMessage('misc.error.title')) .setDescription(getMessage('misc.error.description')) - .addFields(fields), + .addFields([ + { + name: getMessage('misc.error.fields.identifier'), + value: codeBlock(ref), + }, + ]), ], }; diff --git a/src/listeners/commands/error.js b/src/listeners/commands/error.js index 8e4edbc..3baccd9 100644 --- a/src/listeners/commands/error.js +++ b/src/listeners/commands/error.js @@ -1,7 +1,7 @@ const { Listener } = require('@eartharoid/dbf'); const { EmbedBuilder, - inlineCode, + codeBlock, } = require('discord.js'); module.exports = class extends Listener { @@ -29,18 +29,6 @@ module.exports = class extends Listener { })).locale; } const getMessage = this.client.i18n.getLocale(locale); - const fields = [ - { - name: getMessage('misc.error.fields.identifier'), - value: inlineCode(ref), - }, - ]; - if (error.name) { - fields.unshift({ - name: getMessage('misc.error.fields.code'), - value: inlineCode(error.name), - }); - } const data = { components: [], embeds: [ @@ -48,7 +36,12 @@ module.exports = class extends Listener { .setColor('Orange') .setTitle(getMessage('misc.error.title')) .setDescription(getMessage('misc.error.description')) - .addFields(fields), + .addFields([ + { + name: getMessage('misc.error.fields.identifier'), + value: codeBlock(ref), + }, + ]), ], };