1111import net .dv8tion .jda .api .entities .Guild ;
1212import net .dv8tion .jda .api .entities .MessageEmbed ;
1313import net .dv8tion .jda .api .entities .User ;
14-
14+ import net . dv8tion . jda . api . entities . channel . concrete . ForumChannel ;
1515import org .jetbrains .annotations .NotNull ;
1616import org .springframework .dao .DataAccessException ;
1717
@@ -47,8 +47,8 @@ public void sendBestAnswerNotification() {
4747 notificationService .withUser (user ).sendDirectMessage (c -> c .sendMessageEmbeds (buildBestAnswerEmbed (account .getPoints ())));
4848 }
4949
50- public void sendAccountIncrementedNotification () {
51- notificationService .withUser (user ).sendDirectMessage (c -> c .sendMessageEmbeds (buildAccountIncrementEmbed (account .getPoints ())));
50+ public void sendAccountIncrementedNotification (ForumChannel acceptedAnswerForumChannel ) {
51+ notificationService .withUser (user ).sendDirectMessage (c -> c .sendMessageEmbeds (buildAccountIncrementEmbed (account .getPoints (), acceptedAnswerForumChannel )));
5252 }
5353
5454 public void sendAccountDecrementedNotification () {
@@ -59,15 +59,17 @@ public void sendAccountDecrementedNotification() {
5959 * Sends a "your submission was declined"-notification to the {@link QOTWNotificationService#user}.
6060 *
6161 * @param status The {@link SubmissionStatus}. Must NOT be {@link SubmissionStatus#ACCEPT} or {@link SubmissionStatus#ACCEPT_BEST}
62+ * @param acceptedAnswerForumChannel The forum channel containing accepted answers to the QOTW
6263 */
63- public void sendSubmissionDeclinedEmbed (SubmissionStatus status ) {
64+ public void sendSubmissionDeclinedEmbed (SubmissionStatus status , ForumChannel acceptedAnswerForumChannel ) {
6465 String reason = switch (status ) {
6566 case DECLINE_WRONG_ANSWER -> "Wrong answer" ;
6667 case DECLINE_TOO_SHORT -> "Too short" ;
6768 case DECLINE_EMPTY -> "Empty submission" ;
68- default -> throw new IllegalArgumentException ("Invalid decline status: " + status );
69+ case DECLINE_PLAGIARISM -> "Plagiarism / AI usage" ;
70+ case ACCEPT , ACCEPT_BEST -> throw new IllegalArgumentException ("Invalid decline status: " + status );
6971 };
70- notificationService .withUser (user ).sendDirectMessage (c -> c .sendMessageEmbeds (buildSubmissionDeclinedEmbed (reason )));
72+ notificationService .withUser (user ).sendDirectMessage (c -> c .sendMessageEmbeds (buildSubmissionDeclinedEmbed (reason , acceptedAnswerForumChannel )));
7173 }
7274
7375 private @ NotNull EmbedBuilder buildQOTWNotificationEmbed () {
@@ -87,14 +89,15 @@ public void sendSubmissionDeclinedEmbed(SubmissionStatus status) {
8789 .build ();
8890 }
8991
90- private @ NotNull MessageEmbed buildAccountIncrementEmbed (long points ) {
92+ private @ NotNull MessageEmbed buildAccountIncrementEmbed (long points , ForumChannel acceptedAnswerForumChannel ) {
9193 return buildQOTWNotificationEmbed ()
9294 .setColor (Responses .Type .SUCCESS .getColor ())
9395 .setDescription (String .format (
9496 """
9597 Your submission was accepted! %s
98+ You can view accepted answers in %s.
9699 You've been granted **`1 QOTW-Point`**! (monthly total: %s)""" ,
97- systemsConfig .getEmojiConfig ().getSuccessEmote (guild .getJDA ()), points ))
100+ systemsConfig .getEmojiConfig ().getSuccessEmote (guild .getJDA ()), acceptedAnswerForumChannel . getJumpUrl (), points ))
98101 .build ();
99102 }
100103
@@ -109,14 +112,15 @@ public void sendSubmissionDeclinedEmbed(SubmissionStatus status) {
109112 .build ();
110113 }
111114
112- private @ NotNull MessageEmbed buildSubmissionDeclinedEmbed (String reason ) {
115+ private @ NotNull MessageEmbed buildSubmissionDeclinedEmbed (String reason , ForumChannel acceptedAnswerForumChannel ) {
113116 return this .buildQOTWNotificationEmbed ()
114117 .setColor (Responses .Type .ERROR .getColor ())
115118 .setDescription (String .format ("""
116119 Hey %s,
117120 Your QOTW-Submission was **declined** for the following reason: `%s`.
121+ You can view accepted answers in %s.
118122 However, you can try your luck again next week!""" ,
119- user .getAsMention (), reason ))
123+ user .getAsMention (), reason , acceptedAnswerForumChannel . getJumpUrl () ))
120124 .build ();
121125 }
122126
0 commit comments