|
3 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; |
4 | 4 | import com.fasterxml.jackson.annotation.JsonRootName; |
5 | 5 |
|
| 6 | +import java.util.Objects; |
| 7 | + |
6 | 8 | /** |
7 | 9 | * Configuration for the cool messages board feature, see |
8 | 10 | * {@link org.togetherjava.tjbot.features.basic.CoolMessagesBoardManager}. |
9 | 11 | */ |
10 | 12 | @JsonRootName("coolMessagesConfig") |
11 | | -public final class CoolMessagesBoardConfig { |
12 | | - private final String boardChannelPattern; |
13 | | - private final int minimumReactions; |
14 | | - |
15 | | - private CoolMessagesBoardConfig( |
16 | | - @JsonProperty(value = "minimumReactions", required = true) int minimumReactions, |
17 | | - @JsonProperty(value = "boardChannelPattern", |
18 | | - required = true) String boardChannelPattern) { |
19 | | - this.minimumReactions = minimumReactions; |
20 | | - this.boardChannelPattern = boardChannelPattern; |
21 | | - } |
22 | | - |
23 | | - /** |
24 | | - * Gets the minimum amount of reactions needed for a message to be considered as a quote. |
25 | | - * |
26 | | - * @return the minimum amount of reactions |
27 | | - */ |
28 | | - public int getMinimumReactions() { |
29 | | - return minimumReactions; |
30 | | - } |
| 13 | +public record CoolMessagesBoardConfig( |
| 14 | + @JsonProperty(value = "minimumReactions", required = true) int minimumReactions, |
| 15 | + @JsonProperty(value = "boardChannelPattern", required = true) String boardChannelPattern) { |
31 | 16 |
|
32 | 17 | /** |
33 | | - * Gets the REGEX pattern used to identify the quotes text channel |
| 18 | + * Creates a CoolMessagesBoardConfig. |
34 | 19 | * |
35 | | - * @return the channel name pattern |
| 20 | + * @param minimumReactions the minimum amount of reactions |
| 21 | + * @param boardChannelPattern the pattern for the board channel |
36 | 22 | */ |
37 | | - public String getBoardChannelPattern() { |
38 | | - return boardChannelPattern; |
| 23 | + public CoolMessagesBoardConfig { |
| 24 | + Objects.requireNonNull(boardChannelPattern); |
39 | 25 | } |
40 | 26 | } |
0 commit comments