Skip to content

Commit b6db802

Browse files
committed
refactor: simplify variable naming
Rename the variable name of the class-wide `RoleApplicationSystemConfig` to `config` and the variable name of `RoleApplicationHandler` to `handler`, more simple and recognizable names. The original ones are too verbose and unnecessarily yield long horizontal lines of code where unnecessary. These verbose names do work but only in the situation where there are multiple configurations or handlers used in the same class. Suggested-by: Zabuzard <zabuza.dev@gmail.com> Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com>
1 parent ee96742 commit b6db802

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

application/src/main/java/org/togetherjava/tjbot/features/roleapplication/CreateRoleApplicationCommand.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public class CreateRoleApplicationCommand extends SlashCommandAdapter {
5050
private static final int MINIMUM_ANSWER_LENGTH = 50;
5151
private static final int MAXIMUM_ANSWER_LENGTH = 500;
5252

53-
private final RoleApplicationHandler roleApplicationHandler;
54-
private final RoleApplicationSystemConfig roleApplicationSystemConfig;
53+
private final RoleApplicationHandler handler;
54+
private final RoleApplicationSystemConfig config;
5555

5656
/**
5757
* Constructs a new {@link CreateRoleApplicationCommand} with the specified configuration.
@@ -64,10 +64,10 @@ public CreateRoleApplicationCommand(Config config) {
6464
super("application-form", "Generates an application form for members to apply for roles.",
6565
CommandVisibility.GUILD);
6666

67-
this.roleApplicationSystemConfig = config.getRoleApplicationSystemConfig();
67+
this.config = config.getRoleApplicationSystemConfig();
6868

6969
generateRoleOptions(getData());
70-
roleApplicationHandler = new RoleApplicationHandler(roleApplicationSystemConfig);
70+
handler = new RoleApplicationHandler(this.config);
7171
}
7272

7373
/**
@@ -122,7 +122,7 @@ public void onStringSelectSelection(StringSelectInteractionEvent event, List<Str
122122
return;
123123
}
124124

125-
long remainingMinutes = roleApplicationHandler.getMemberCooldownMinutes(member);
125+
long remainingMinutes = handler.getMemberCooldownMinutes(member);
126126
String correctMinutesWord = selectWordFromCount(remainingMinutes, "minute", "minutes");
127127

128128
if (remainingMinutes > 0) {
@@ -135,8 +135,8 @@ public void onStringSelectSelection(StringSelectInteractionEvent event, List<Str
135135
}
136136

137137
TextInput body = TextInput
138-
.create(generateComponentId(event.getUser().getId()),
139-
roleApplicationSystemConfig.defaultQuestion(), TextInputStyle.PARAGRAPH)
138+
.create(generateComponentId(event.getUser().getId()), config.defaultQuestion(),
139+
TextInputStyle.PARAGRAPH)
140140
.setRequired(true)
141141
.setRequiredRange(MINIMUM_ANSWER_LENGTH, MAXIMUM_ANSWER_LENGTH)
142142
.setPlaceholder("Enter your answer here")
@@ -270,7 +270,7 @@ private static MessageEmbed createApplicationEmbed() {
270270
}
271271

272272
public RoleApplicationHandler getApplicationApplyHandler() {
273-
return roleApplicationHandler;
273+
return handler;
274274
}
275275

276276
@Override

0 commit comments

Comments
 (0)