11package net .javadiscord .javabot .systems .help .forum ;
22
33import com .dynxsty .dih4jda .interactions .ComponentIdBuilder ;
4- import lombok .RequiredArgsConstructor ;
54import net .dv8tion .jda .api .entities .Member ;
65import net .dv8tion .jda .api .entities .Message ;
76import net .dv8tion .jda .api .entities .channel .concrete .ThreadChannel ;
1514import net .javadiscord .javabot .Bot ;
1615import net .javadiscord .javabot .data .config .guild .HelpConfig ;
1716import net .javadiscord .javabot .data .h2db .DbActions ;
18- import net .javadiscord .javabot .systems .help .HelpChannelManager ;
1917import net .javadiscord .javabot .systems .help .HelpExperienceService ;
2018import net .javadiscord .javabot .systems .help .model .HelpTransactionMessage ;
2119import net .javadiscord .javabot .util .ExceptionLogger ;
3028
3129/**
3230 * Manages all interactions regarding the help forum system.
31+ *
32+ * @param postThread The posts' {@link ThreadChannel}.
3333 */
34- @ RequiredArgsConstructor
35- public class ForumHelpManager {
34+ public record ForumHelpManager (ThreadChannel postThread ) {
35+ /**
36+ * Static String that contains the Thank Message Text.
37+ */
38+ public static final String THANK_MESSAGE_TEXT = "Before your post will be closed, would you like to express your gratitude to any of the people who helped you? When you're done, click **I'm done here. Close this post!**." ;
39+
3640 /**
3741 * The identifier used for all help thanks-related buttons.
3842 */
3943 public static final String HELP_THANKS_IDENTIFIER = "forum-help-thank" ;
40- private final ThreadChannel postThread ;
4144
4245 /**
4346 * Builds and replies {@link ActionRow}s with all members which helped the
4447 * owner of the {@link ForumHelpManager#postThread} forum post.
4548 *
4649 * @param callback The callback to reply to.
47- * @param helpers The list of helpers to thank.
50+ * @param helpers The list of helpers to thank.
4851 * @return The {@link ReplyCallbackAction}.
4952 */
5053 public ReplyCallbackAction replyHelpThanks (IReplyCallback callback , @ NotNull List <Member > helpers ) {
@@ -61,7 +64,7 @@ public ReplyCallbackAction replyHelpThanks(IReplyCallback callback, @NotNull Lis
6164 List <ActionRow > rows = new ArrayList <>();
6265 rows .add (controlsRow );
6366 rows .addAll (MessageActionUtils .toActionRows (helperThanksButtons ));
64- return callback .reply (HelpChannelManager . THANK_MESSAGE_TEXT )
67+ return callback .reply (THANK_MESSAGE_TEXT )
6568 .setComponents (rows );
6669 }
6770
@@ -86,9 +89,9 @@ public void close(IReplyCallback callback, boolean withHelpers, @Nullable String
8689 /**
8790 * Thanks a single user.
8891 *
89- * @param event The {@link ButtonInteractionEvent} that was fired.
92+ * @param event The {@link ButtonInteractionEvent} that was fired.
9093 * @param postThread The {@link ThreadChannel} post.
91- * @param helperId The helpers' discord id.
94+ * @param helperId The helpers' discord id.
9295 */
9396 public void thankHelper (@ NotNull ButtonInteractionEvent event , ThreadChannel postThread , long helperId ) {
9497 event .getJDA ().retrieveUserById (helperId ).queue (helper -> {
@@ -119,9 +122,6 @@ public void thankHelper(@NotNull ButtonInteractionEvent event, ThreadChannel pos
119122 });
120123 }
121124
122- public ThreadChannel getPostThread () {
123- return postThread ;
124- }
125125
126126 private @ NotNull List <Member > getPostHelpers () {
127127 List <Member > helpers = new ArrayList <>(20 );
0 commit comments