diff --git a/application/src/main/java/org/togetherjava/tjbot/features/basic/ApplicationCreateCommand.java b/application/src/main/java/org/togetherjava/tjbot/features/basic/ApplicationCreateCommand.java index 16ae33384a..62594f65d6 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/basic/ApplicationCreateCommand.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/basic/ApplicationCreateCommand.java @@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory; import org.togetherjava.tjbot.config.ApplicationFormConfig; -import org.togetherjava.tjbot.config.ApplyRoleConfig; import org.togetherjava.tjbot.config.Config; import org.togetherjava.tjbot.features.CommandVisibility; import org.togetherjava.tjbot.features.SlashCommandAdapter; @@ -69,7 +68,6 @@ public class ApplicationCreateCommand extends SlashCommandAdapter { private final Cache applicationSubmitCooldown; private final Predicate applicationChannelPattern; - private final ApplicationFormConfig config; /** * Constructs a new {@link ApplicationCreateCommand} with the specified configuration. @@ -82,9 +80,9 @@ public ApplicationCreateCommand(Config config) { super("application-form", "Generates an application form for members to apply for roles.", CommandVisibility.GUILD); - this.config = config.getApplicationFormConfig(); + final ApplicationFormConfig formConfig = config.getApplicationFormConfig(); this.applicationChannelPattern = - Pattern.compile(this.config.applicationChannelPattern()).asMatchPredicate(); + Pattern.compile(formConfig.applicationChannelPattern()).asMatchPredicate(); this.applicationSubmitCooldown = Caffeine.newBuilder() .expireAfterWrite(APPLICATION_SUBMIT_COOLDOWN, TimeUnit.MINUTES) @@ -132,23 +130,6 @@ public void onSlashCommand(SlashCommandInteractionEvent event) { sendMenu(event); } - /** - * Maps a user and an {@link ApplyRoleConfig} option to a SelectOption object. - *

- * This method is used to create a {@link SelectOption} object that represents a role - * configuration option for a user, including a unique component ID generated based on the - * user's ID and the option's name, a description, and an emoji. - * - * @param user the user for whom the role configuration option is being mapped - * @param option the {@link ApplyRoleConfig} option to be mapped to a {@link SelectOption} - * @return a {@link SelectOption} object with the specified details - */ - private SelectOption mapToSelectOption(User user, ApplyRoleConfig option) { - return SelectOption.of(option.name(), generateComponentId(user.getId(), option.name())) - .withDescription(option.description()) - .withEmoji(Emoji.fromFormatted(option.emoji())); - } - @Override public void onStringSelectSelection(StringSelectInteractionEvent event, List args) { SelectOption selectOption = event.getSelectedOptions().getFirst(); @@ -242,10 +223,9 @@ private void addRolesToMenu(StringSelectMenu.Builder menuBuilder, } }); - roles.values().forEach(role -> { - menuBuilder.addOption(role.getLabel(), role.getValue(), role.getDescription(), - role.getEmoji()); - }); + roles.values() + .forEach(role -> menuBuilder.addOption(role.getLabel(), role.getValue(), + role.getDescription(), role.getEmoji())); } @Override