diff --git a/src/commands/tag.js b/src/commands/tag.js index eb93f80..7bbf00b 100644 --- a/src/commands/tag.js +++ b/src/commands/tag.js @@ -23,7 +23,6 @@ module.exports = class TagCommand extends Command { required: true, type: Command.option_types.STRING })), - required: true, type: Command.option_types.SUB_COMMAND })); }, @@ -39,11 +38,10 @@ module.exports = class TagCommand extends Command { const settings = await this.client.utils.getSettings(interaction.guild.id); const i18n = this.client.i18n.getLocale(settings.locale); - const tag_name = interaction.options.getSubcommand(); - const tag = settings.tags[tag_name]; - const args = interaction.options.data[0]?.options; - - if (tag) { + try { + const tag_name = interaction.options.getSubcommand(); + const tag = settings.tags[tag_name]; + const args = interaction.options.data[0]?.options; const text = tag.replace(/(? { const arg = args.find(arg => arg.name === $1); return arg ? arg.value : $; @@ -56,7 +54,7 @@ module.exports = class TagCommand extends Command { ], ephemeral: false }); - } else { + } catch { const list = Object.keys(settings.tags).map(t => `❯ **\`${t}\`**`); return await interaction.reply({ embeds: [ @@ -69,6 +67,5 @@ module.exports = class TagCommand extends Command { ephemeral: true }); } - } };