29
29
import org .slf4j .LoggerFactory ;
30
30
31
31
import org .togetherjava .tjbot .config .ApplicationFormConfig ;
32
- import org .togetherjava .tjbot .config .ApplyRoleConfig ;
33
32
import org .togetherjava .tjbot .config .Config ;
34
33
import org .togetherjava .tjbot .features .CommandVisibility ;
35
34
import org .togetherjava .tjbot .features .SlashCommandAdapter ;
@@ -69,7 +68,6 @@ public class ApplicationCreateCommand extends SlashCommandAdapter {
69
68
70
69
private final Cache <Member , OffsetDateTime > applicationSubmitCooldown ;
71
70
private final Predicate <String > applicationChannelPattern ;
72
- private final ApplicationFormConfig config ;
73
71
74
72
/**
75
73
* Constructs a new {@link ApplicationCreateCommand} with the specified configuration.
@@ -82,9 +80,9 @@ public ApplicationCreateCommand(Config config) {
82
80
super ("application-form" , "Generates an application form for members to apply for roles." ,
83
81
CommandVisibility .GUILD );
84
82
85
- this . config = config .getApplicationFormConfig ();
83
+ final ApplicationFormConfig formConfig = config .getApplicationFormConfig ();
86
84
this .applicationChannelPattern =
87
- Pattern .compile (this . config .applicationChannelPattern ()).asMatchPredicate ();
85
+ Pattern .compile (formConfig .applicationChannelPattern ()).asMatchPredicate ();
88
86
89
87
this .applicationSubmitCooldown = Caffeine .newBuilder ()
90
88
.expireAfterWrite (APPLICATION_SUBMIT_COOLDOWN , TimeUnit .MINUTES )
@@ -132,23 +130,6 @@ public void onSlashCommand(SlashCommandInteractionEvent event) {
132
130
sendMenu (event );
133
131
}
134
132
135
- /**
136
- * Maps a user and an {@link ApplyRoleConfig} option to a SelectOption object.
137
- * <p>
138
- * This method is used to create a {@link SelectOption} object that represents a role
139
- * configuration option for a user, including a unique component ID generated based on the
140
- * user's ID and the option's name, a description, and an emoji.
141
- *
142
- * @param user the user for whom the role configuration option is being mapped
143
- * @param option the {@link ApplyRoleConfig} option to be mapped to a {@link SelectOption}
144
- * @return a {@link SelectOption} object with the specified details
145
- */
146
- private SelectOption mapToSelectOption (User user , ApplyRoleConfig option ) {
147
- return SelectOption .of (option .name (), generateComponentId (user .getId (), option .name ()))
148
- .withDescription (option .description ())
149
- .withEmoji (Emoji .fromFormatted (option .emoji ()));
150
- }
151
-
152
133
@ Override
153
134
public void onStringSelectSelection (StringSelectInteractionEvent event , List <String > args ) {
154
135
SelectOption selectOption = event .getSelectedOptions ().getFirst ();
@@ -242,10 +223,9 @@ private void addRolesToMenu(StringSelectMenu.Builder menuBuilder,
242
223
}
243
224
});
244
225
245
- roles .values ().forEach (role -> {
246
- menuBuilder .addOption (role .getLabel (), role .getValue (), role .getDescription (),
247
- role .getEmoji ());
248
- });
226
+ roles .values ()
227
+ .forEach (role -> menuBuilder .addOption (role .getLabel (), role .getValue (),
228
+ role .getDescription (), role .getEmoji ()));
249
229
}
250
230
251
231
@ Override
0 commit comments