@@ -47,7 +47,7 @@ public final class HelpThreadOverviewUpdater extends MessageReceiverAdapter impl
4747 * @param helper the helper to use
4848 */
4949 public HelpThreadOverviewUpdater (@ NotNull Config config , @ NotNull HelpSystemHelper helper ) {
50- super (Pattern .compile (config .getHelpSystem ().getStagingChannelPattern ()));
50+ super (Pattern .compile (config .getHelpSystem ().getOverviewChannelPattern ()));
5151
5252 allCategories = config .getHelpSystem ().getCategories ();
5353 this .helper = helper ;
@@ -82,28 +82,18 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
8282 }
8383
8484 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 );
8986
90- if (maybeStagingChannel . isEmpty () || maybeOverviewChannel .isEmpty ()) {
87+ if (maybeOverviewChannel .isEmpty ()) {
9188 return ;
9289 }
9390
94- updateOverview (maybeStagingChannel . orElseThrow (), maybeOverviewChannel .orElseThrow ());
91+ updateOverview (maybeOverviewChannel .orElseThrow ());
9592 }
9693
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 ();
10797
10898 Optional <TextChannel > maybeChannel = guild .getTextChannelCache ()
10999 .stream ()
@@ -113,18 +103,17 @@ private void updateOverviewForGuild(@NotNull Guild guild) {
113103 if (maybeChannel .isEmpty ()) {
114104 logger .warn (
115105 "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 ());
117107 return Optional .empty ();
118108 }
119109
120110 return maybeChannel ;
121111 }
122112
123- private void updateOverview (@ NotNull IThreadContainer stagingChannel ,
124- @ NotNull MessageChannel overviewChannel ) {
113+ private void updateOverview (@ NotNull TextChannel overviewChannel ) {
125114 logger .debug ("Updating overview of active questions" );
126115
127- List <ThreadChannel > activeThreads = stagingChannel .getThreadChannels ()
116+ List <ThreadChannel > activeThreads = overviewChannel .getThreadChannels ()
128117 .stream ()
129118 .filter (Predicate .not (ThreadChannel ::isArchived ))
130119 .toList ();
0 commit comments