File tree Expand file tree Collapse file tree 1 file changed +24
-17
lines changed
src/main/java/net/javadiscord/javabot/systems/help Expand file tree Collapse file tree 1 file changed +24
-17
lines changed Original file line number Diff line number Diff line change @@ -155,29 +155,36 @@ private void replyCloseSuggestionIfPatternMatches(Message msg) {
155155 return ;
156156 }
157157 if (msg .getChannel ().asThreadChannel ().getOwnerIdLong () == msg .getAuthor ().getIdLong ()) {
158- for (String [] detector : closeSuggestionDetectors ) {
159- if (doesMatchDetector (content , detector )) {
160- msg .reply ("""
158+ if (matchesAnyDetector (content )) {
159+ msg .reply ("""
161160 If you are finished with your post, please close it.
162161 If you are not, please ignore this message.
163162 Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
164163 """ )
165- .addActionRow (
166- createCloseSuggestionButton (msg .getChannel ()
167- .asThreadChannel ()),
168- Button .secondary (
169- InteractionUtils .DELETE_ORIGINAL_TEMPLATE ,
170- "\uD83D \uDDD1 ️"
171- )
172- )
173- .queue ();
174- recentlyCloseSuggestedPosts .put (
175- postId ,
176- System .currentTimeMillis () + SUGGEST_CLOSE_TIMEOUT
177- );
178- }
164+ .addActionRow (
165+ createCloseSuggestionButton (msg .getChannel ()
166+ .asThreadChannel ()),
167+ Button .secondary (
168+ InteractionUtils .DELETE_ORIGINAL_TEMPLATE ,
169+ "\uD83D \uDDD1 ️"
170+ )
171+ )
172+ .queue ();
173+ recentlyCloseSuggestedPosts .put (
174+ postId ,
175+ System .currentTimeMillis () + SUGGEST_CLOSE_TIMEOUT
176+ );
177+ }
178+ }
179+ }
180+
181+ private boolean matchesAnyDetector (String content ) {
182+ for (String [] detector : closeSuggestionDetectors ) {
183+ if (doesMatchDetector (content , detector )) {
184+ return true ;
179185 }
180186 }
187+ return false ;
181188 }
182189
183190 private boolean doesMatchDetector (String content , String [] detector ) {
You can’t perform that action at this time.
0 commit comments