@@ -47,7 +47,7 @@ public final class HelpThreadOverviewUpdater extends MessageReceiverAdapter impl
47
47
* @param helper the helper to use
48
48
*/
49
49
public HelpThreadOverviewUpdater (@ NotNull Config config , @ NotNull HelpSystemHelper helper ) {
50
- super (Pattern .compile (config .getHelpSystem ().getStagingChannelPattern ()));
50
+ super (Pattern .compile (config .getHelpSystem ().getOverviewChannelPattern ()));
51
51
52
52
allCategories = config .getHelpSystem ().getCategories ();
53
53
this .helper = helper ;
@@ -82,28 +82,18 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
82
82
}
83
83
84
84
private void updateOverviewForGuild (@ NotNull Guild guild ) {
85
- Optional <TextChannel > maybeStagingChannel =
86
- handleRequireChannel (ChannelType .STAGING , guild );
87
- Optional <TextChannel > maybeOverviewChannel =
88
- handleRequireChannel (ChannelType .OVERVIEW , guild );
85
+ Optional <TextChannel > maybeOverviewChannel = handleRequireOverviewChannel (guild );
89
86
90
- if (maybeStagingChannel . isEmpty () || maybeOverviewChannel .isEmpty ()) {
87
+ if (maybeOverviewChannel .isEmpty ()) {
91
88
return ;
92
89
}
93
90
94
- updateOverview (maybeStagingChannel . orElseThrow (), maybeOverviewChannel .orElseThrow ());
91
+ updateOverview (maybeOverviewChannel .orElseThrow ());
95
92
}
96
93
97
- private @ NotNull Optional <TextChannel > handleRequireChannel (@ NotNull ChannelType channelType ,
98
- @ NotNull Guild guild ) {
99
- Predicate <String > isChannelName = switch (channelType ) {
100
- case OVERVIEW -> helper ::isOverviewChannelName ;
101
- case STAGING -> helper ::isStagingChannelName ;
102
- };
103
- String channelPattern = switch (channelType ) {
104
- case OVERVIEW -> helper .getOverviewChannelPattern ();
105
- case STAGING -> helper .getStagingChannelPattern ();
106
- };
94
+ private @ NotNull Optional <TextChannel > handleRequireOverviewChannel (@ NotNull Guild guild ) {
95
+ Predicate <String > isChannelName = helper ::isOverviewChannelName ;
96
+ String channelPattern = helper .getOverviewChannelPattern ();
107
97
108
98
Optional <TextChannel > maybeChannel = guild .getTextChannelCache ()
109
99
.stream ()
@@ -113,18 +103,17 @@ private void updateOverviewForGuild(@NotNull Guild guild) {
113
103
if (maybeChannel .isEmpty ()) {
114
104
logger .warn (
115
105
"Unable to update help thread overview, did not find a {} channel matching the configured pattern '{}' for guild '{}'" ,
116
- channelType , channelPattern , guild .getName ());
106
+ ChannelType . OVERVIEW , channelPattern , guild .getName ());
117
107
return Optional .empty ();
118
108
}
119
109
120
110
return maybeChannel ;
121
111
}
122
112
123
- private void updateOverview (@ NotNull IThreadContainer stagingChannel ,
124
- @ NotNull MessageChannel overviewChannel ) {
113
+ private void updateOverview (@ NotNull TextChannel overviewChannel ) {
125
114
logger .debug ("Updating overview of active questions" );
126
115
127
- List <ThreadChannel > activeThreads = stagingChannel .getThreadChannels ()
116
+ List <ThreadChannel > activeThreads = overviewChannel .getThreadChannels ()
128
117
.stream ()
129
118
.filter (Predicate .not (ThreadChannel ::isArchived ))
130
119
.toList ();
0 commit comments