Skip to content

Commit

Permalink
style: run spotlessApply gradle task
Browse files Browse the repository at this point in the history
  • Loading branch information
christolis committed Oct 17, 2024
1 parent 7b42e6a commit 0291813
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
* Represents the configuration for an application form, including roles and application channel
* pattern.
*
* @param submissionsChannelPattern the pattern used to identify the submissions channel where applications are sent
* @param submissionsChannelPattern the pattern used to identify the submissions channel where
* applications are sent
* @param defaultQuestion the default question that will be asked in the role application form
* @param minimumAnswerLength the minimum number of characters required for the applicant's answer
* @param maximumAnswerLength the maximum number of characters allowed for the applicant's answer
* @param applicationSubmitCooldownMinutes the cooldown time in minutes before the user can submit another application
* @param applicationSubmitCooldownMinutes the cooldown time in minutes before the user can submit
* another application
*/
public record RoleApplicationSystemConfig(
@JsonProperty(value = "submissionsChannelPattern",
Expand All @@ -28,14 +30,17 @@ public record RoleApplicationSystemConfig(
* Constructs an instance of {@link RoleApplicationSystemConfig} with the provided parameters.
* <p>
* This constructor ensures that {@code submissionsChannelPattern} and {@code defaultQuestion}
* are not null and that the length of the {@code defaultQuestion} does not exceed the maximum allowed length.
* are not null and that the length of the {@code defaultQuestion} does not exceed the maximum
* allowed length.
*/
public RoleApplicationSystemConfig {
Objects.requireNonNull(submissionsChannelPattern);
Objects.requireNonNull(defaultQuestion);

if (defaultQuestion.length() > TextInput.MAX_LABEL_LENGTH) {
throw new IllegalArgumentException("defaultQuestion length is too long! Cannot be greater than %d".formatted(TextInput.MAX_LABEL_LENGTH));
throw new IllegalArgumentException(
"defaultQuestion length is too long! Cannot be greater than %d"
.formatted(TextInput.MAX_LABEL_LENGTH));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* users to prevent spamming.
*/
public class ApplicationApplyHandler {

private final Cache<Member, OffsetDateTime> applicationSubmitCooldown;
private final Predicate<String> applicationChannelPattern;
private final RoleApplicationSystemConfig roleApplicationSystemConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import net.dv8tion.jda.api.interactions.components.text.TextInput;
import net.dv8tion.jda.api.interactions.components.text.TextInputStyle;
import net.dv8tion.jda.api.interactions.modals.Modal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.togetherjava.tjbot.config.Config;
import org.togetherjava.tjbot.config.RoleApplicationSystemConfig;
Expand All @@ -44,8 +42,6 @@
* guild.
*/
public class ApplicationCreateCommand extends SlashCommandAdapter {
private static final Logger logger = LoggerFactory.getLogger(ApplicationCreateCommand.class);

protected static final Color AMBIENT_COLOR = new Color(24, 221, 136, 255);
private static final int OPTIONAL_ROLES_AMOUNT = 5;
private static final String ROLE_COMPONENT_ID_HEADER = "application-create";
Expand Down Expand Up @@ -135,8 +131,8 @@ public void onStringSelectSelection(StringSelectInteractionEvent event, List<Str
}

TextInput body = TextInput
.create(generateComponentId(event.getUser().getId()), roleApplicationSystemConfig.defaultQuestion(),
TextInputStyle.PARAGRAPH)
.create(generateComponentId(event.getUser().getId()),
roleApplicationSystemConfig.defaultQuestion(), TextInputStyle.PARAGRAPH)
.setRequired(true)
.setRequiredRange(roleApplicationSystemConfig.minimumAnswerLength(),
roleApplicationSystemConfig.maximumAnswerLength())
Expand Down

0 comments on commit 0291813

Please sign in to comment.