Skip to content

Commit 6d8ceee

Browse files
committed
feat: add role application system config
1 parent 8b2d3c5 commit 6d8ceee

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
@@ -175,5 +175,12 @@
175175
"fallbackChannelPattern": "java-news-and-changes",
176176
"pollIntervalInMinutes": 10
177177
},
178+
"roleApplicationSystem": {
179+
"submissionsChannelPattern": "staff-applications",
180+
"defaultQuestion": "What makes you a valuable addition to the team? 😎",
181+
"minimumAnswerLength": 50,
182+
"maximumAnswerLength": 500,
183+
"applicationSubmitCooldownMinutes": 5
184+
},
178185
"memberCountCategoryPattern": "Info"
179186
}

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public final class Config {
4848
private final RSSFeedsConfig rssFeedsConfig;
4949
private final String selectRolesChannelPattern;
5050
private final String memberCountCategoryPattern;
51+
private final RoleApplicationSystemConfig roleApplicationSystemConfig;
5152

5253
@SuppressWarnings("ConstructorWithTooManyParameters")
5354
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
@@ -100,7 +101,9 @@ private Config(@JsonProperty(value = "token", required = true) String token,
100101
required = true) FeatureBlacklistConfig featureBlacklistConfig,
101102
@JsonProperty(value = "rssConfig", required = true) RSSFeedsConfig rssFeedsConfig,
102103
@JsonProperty(value = "selectRolesChannelPattern",
103-
required = true) String selectRolesChannelPattern) {
104+
required = true) String selectRolesChannelPattern,
105+
@JsonProperty(value = "roleApplicationSystem",
106+
required = true) RoleApplicationSystemConfig roleApplicationSystemConfig) {
104107
this.token = Objects.requireNonNull(token);
105108
this.githubApiKey = Objects.requireNonNull(githubApiKey);
106109
this.databasePath = Objects.requireNonNull(databasePath);
@@ -135,6 +138,7 @@ private Config(@JsonProperty(value = "token", required = true) String token,
135138
this.featureBlacklistConfig = Objects.requireNonNull(featureBlacklistConfig);
136139
this.rssFeedsConfig = Objects.requireNonNull(rssFeedsConfig);
137140
this.selectRolesChannelPattern = Objects.requireNonNull(selectRolesChannelPattern);
141+
this.roleApplicationSystemConfig = roleApplicationSystemConfig;
138142
}
139143

140144
/**
@@ -437,6 +441,15 @@ public String getMemberCountCategoryPattern() {
437441
return memberCountCategoryPattern;
438442
}
439443

444+
/**
445+
* The configuration related to the application form.
446+
*
447+
* @return the application form config
448+
*/
449+
public RoleApplicationSystemConfig getRoleApplicationSystemConfig() {
450+
return roleApplicationSystemConfig;
451+
}
452+
440453
/**
441454
* Gets the RSS feeds configuration.
442455
*
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)