Skip to content

Commit 5f4ec88

Browse files
committed
Bugfix where top-helper uses wrong channel
* now just using both channels to be extra safe in case we swap back and forth again
1 parent d969411 commit 5f4ec88

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

application/src/main/java/org/togetherjava/tjbot/commands/tophelper/TopHelpersMessageListener.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public final class TopHelpersMessageListener extends MessageReceiverAdapter {
2121
private final Database database;
2222

2323
private final Predicate<String> isStagingChannelName;
24+
private final Predicate<String> isOverviewChannelName;
2425

2526
/**
2627
* Creates a new listener to receive all message sent in help channels.
@@ -35,6 +36,8 @@ public TopHelpersMessageListener(@NotNull Database database, @NotNull Config con
3536

3637
isStagingChannelName = Pattern.compile(config.getHelpSystem().getStagingChannelPattern())
3738
.asMatchPredicate();
39+
isOverviewChannelName = Pattern.compile(config.getHelpSystem().getOverviewChannelPattern())
40+
.asMatchPredicate();
3841
}
3942

4043
@Override
@@ -56,7 +59,9 @@ private boolean isHelpThread(@NotNull MessageReceivedEvent event) {
5659
}
5760

5861
ThreadChannel thread = event.getThreadChannel();
59-
return isStagingChannelName.test(thread.getParentChannel().getName());
62+
String rootChannelName = thread.getParentChannel().getName();
63+
return isStagingChannelName.test(rootChannelName)
64+
|| isOverviewChannelName.test(rootChannelName);
6065
}
6166

6267
private void addMessageRecord(@NotNull MessageReceivedEvent event) {

0 commit comments

Comments
 (0)