From b5ada8dca12013bfc730a50f4e8808d61bce23ba Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sun, 27 Feb 2022 21:42:06 -0500 Subject: fix(FeaturesCommand): properly hide disabled features --- src/commands/config/config.ts | 2 +- src/commands/config/features.ts | 29 +++++++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) (limited to 'src/commands/config') diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index f860b30..6cb493d 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -358,7 +358,7 @@ export default class ConfigCommand extends BushCommand { }; const components = new ActionRow().addComponents( - new ButtonComponent().setStyle(ButtonStyle.Primary).setCustomId('command_settingsBack').setLabel('Back') + new ButtonComponent({ style: ButtonStyle.Primary, customId: 'command_settingsBack', label: 'Back' }) ); settingsEmbed.setDescription( `${Formatters.italic(guildSettingsObj[setting].description)}\n\n**Type:** ${guildSettingsObj[setting].type}` diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index c9aebd3..c022a3a 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -13,7 +13,6 @@ import { Embed, PermissionFlagsBits, SelectMenuComponent, - SelectMenuOption, type Message, type SelectMenuInteraction } from 'discord.js'; @@ -85,21 +84,19 @@ export default class FeaturesCommand extends BushCommand { public generateComponents(guildFeatures: GuildFeatures[], disable: boolean) { return new ActionRow().addComponents( - new SelectMenuComponent() - .setCustomId('command_selectFeature') - .setDisabled(disable) - .setMaxValues(1) - .setMinValues(1) - .setOptions( - ...guildFeatures - .filter((f) => guildFeaturesObj[f].notConfigurable !== false) - .map((f) => - new SelectMenuOption() - .setLabel(guildFeaturesObj[f].name) - .setValue(f) - .setDescription(guildFeaturesObj[f].description) - ) - ) + new SelectMenuComponent({ + customId: 'command_selectFeature', + disabled: disable, + maxValues: 1, + minValues: 1, + options: guildFeatures + .filter((f) => !guildFeaturesObj[f].hidden) + .map((f) => ({ + label: guildFeaturesObj[f].name, + value: f, + description: guildFeaturesObj[f].description + })) + }) ); } } -- cgit