-
-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathRoleApplicationSystemConfig.java
More file actions
38 lines (33 loc) · 1.54 KB
/
RoleApplicationSystemConfig.java
File metadata and controls
38 lines (33 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.togetherjava.tjbot.config;
import com.fasterxml.jackson.annotation.JsonProperty;
import net.dv8tion.jda.api.interactions.components.text.TextInput;
import java.util.Objects;
/**
* 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 defaultQuestion the default question that will be asked in the role application form
*/
public record RoleApplicationSystemConfig(
@JsonProperty(value = "submissionsChannelPattern",
required = true) String submissionsChannelPattern,
@JsonProperty(value = "defaultQuestion", required = true) String defaultQuestion) {
/**
* 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.
*/
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));
}
}
}