Skip to content

Commit ee9e0e8

Browse files
committed
feat: add role application system config
1 parent 817e044 commit ee9e0e8

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

application/config.json.template

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,12 @@
115115
"fallbackChannelPattern": "java-news-and-changes",
116116
"pollIntervalInMinutes": 10
117117
},
118+
"roleApplicationSystem": {
119+
"submissionsChannelPattern": "staff-applications",
120+
"defaultQuestion": "What makes you a valuable addition to the team? 😎",
121+
"minimumAnswerLength": 50,
122+
"maximumAnswerLength": 500,
123+
"applicationSubmitCooldownMinutes": 5
124+
},
118125
"memberCountCategoryPattern": "Info"
119126
}

application/src/main/java/org/togetherjava/tjbot/config/Config.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public final class Config {
4646
private final RSSFeedsConfig rssFeedsConfig;
4747
private final String selectRolesChannelPattern;
4848
private final String memberCountCategoryPattern;
49+
private final RoleApplicationSystemConfig roleApplicationSystemConfig;
4950

5051
@SuppressWarnings("ConstructorWithTooManyParameters")
5152
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
@@ -94,7 +95,9 @@ private Config(@JsonProperty(value = "token", required = true) String token,
9495
required = true) FeatureBlacklistConfig featureBlacklistConfig,
9596
@JsonProperty(value = "rssConfig", required = true) RSSFeedsConfig rssFeedsConfig,
9697
@JsonProperty(value = "selectRolesChannelPattern",
97-
required = true) String selectRolesChannelPattern) {
98+
required = true) String selectRolesChannelPattern,
99+
@JsonProperty(value = "roleApplicationSystem",
100+
required = true) RoleApplicationSystemConfig roleApplicationSystemConfig) {
98101
this.token = Objects.requireNonNull(token);
99102
this.githubApiKey = Objects.requireNonNull(githubApiKey);
100103
this.databasePath = Objects.requireNonNull(databasePath);
@@ -127,6 +130,7 @@ private Config(@JsonProperty(value = "token", required = true) String token,
127130
this.featureBlacklistConfig = Objects.requireNonNull(featureBlacklistConfig);
128131
this.rssFeedsConfig = Objects.requireNonNull(rssFeedsConfig);
129132
this.selectRolesChannelPattern = Objects.requireNonNull(selectRolesChannelPattern);
133+
this.roleApplicationSystemConfig = roleApplicationSystemConfig;
130134
}
131135

132136
/**
@@ -410,6 +414,15 @@ public String getMemberCountCategoryPattern() {
410414
return memberCountCategoryPattern;
411415
}
412416

417+
/**
418+
* The configuration related to the application form.
419+
*
420+
* @return the application form config
421+
*/
422+
public RoleApplicationSystemConfig getRoleApplicationSystemConfig() {
423+
return roleApplicationSystemConfig;
424+
}
425+
413426
/**
414427
* Gets the RSS feeds configuration.
415428
*
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.togetherjava.tjbot.config;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
import java.util.Objects;
6+
7+
/**
8+
* Represents the configuration for an application form, including roles and application channel
9+
* pattern.
10+
*/
11+
public record RoleApplicationSystemConfig(
12+
@JsonProperty(value = "submissionsChannelPattern",
13+
required = true) String submissionsChannelPattern,
14+
@JsonProperty(value = "defaultQuestion", required = true) String defaultQuestion,
15+
@JsonProperty(value = "minimumAnswerLength", required = true) int minimumAnswerLength,
16+
@JsonProperty(value = "maximumAnswerLength", required = true) int maximumAnswerLength,
17+
@JsonProperty(value = "applicationSubmitCooldownMinutes",
18+
required = true) int applicationSubmitCooldownMinutes) {
19+
20+
/**
21+
* Constructs an instance of {@link RoleApplicationSystemConfig} with the provided parameters.
22+
*
23+
* @param submissionsChannelPattern the pattern used to identify the application channel
24+
* @param defaultQuestion the default question for the form
25+
*/
26+
public RoleApplicationSystemConfig {
27+
Objects.requireNonNull(submissionsChannelPattern);
28+
Objects.requireNonNull(defaultQuestion);
29+
}
30+
}

0 commit comments

Comments
 (0)