|
9 | 9 | import net.javadiscord.javabot.systems.qotw.dao.QuestionPointsRepository; |
10 | 10 | import net.javadiscord.javabot.systems.qotw.model.QOTWAccount; |
11 | 11 |
|
| 12 | +import javax.annotation.Nonnull; |
12 | 13 | import java.sql.Connection; |
13 | 14 | import java.sql.SQLException; |
14 | 15 | import java.time.Instant; |
@@ -51,30 +52,49 @@ public void sendAccountIncrementedNotification() { |
51 | 52 | this.sendDirectMessageNotification(user, this.buildAccountIncrementEmbed(account.getPoints())); |
52 | 53 | } |
53 | 54 |
|
54 | | - private MessageEmbed buildBestAnswerEmbed(long points) { |
| 55 | + public void sendSubmissionDeclinedEmbed(@Nonnull String reason) { |
| 56 | + this.sendDirectMessageNotification(user, this.buildSubmissionDeclinedEmbed(reason)); |
| 57 | + } |
| 58 | + |
| 59 | + private EmbedBuilder buildQOTWNotificationEmbed() { |
55 | 60 | return new EmbedBuilder() |
56 | 61 | .setAuthor(user.getAsTag(), null, user.getEffectiveAvatarUrl()) |
57 | 62 | .setTitle("QOTW Notification") |
| 63 | + .setTimestamp(Instant.now()); |
| 64 | + } |
| 65 | + |
| 66 | + private MessageEmbed buildBestAnswerEmbed(long points) { |
| 67 | + return this.buildQOTWNotificationEmbed() |
58 | 68 | .setColor(Bot.config.get(guild).getSlashCommand().getSuccessColor()) |
59 | 69 | .setDescription(String.format( |
60 | 70 | """ |
61 | 71 | Your submission was marked as the best answer! |
62 | 72 | You've been granted **`1 extra QOTW-Point`**! (total: %s)""", points)) |
63 | | - .setTimestamp(Instant.now()) |
64 | 73 | .build(); |
65 | 74 | } |
66 | 75 |
|
67 | 76 | private MessageEmbed buildAccountIncrementEmbed(long points) { |
68 | | - return new EmbedBuilder() |
69 | | - .setAuthor(user.getAsTag(), null, user.getEffectiveAvatarUrl()) |
70 | | - .setTitle("QOTW Notification") |
| 77 | + return this.buildQOTWNotificationEmbed() |
71 | 78 | .setColor(Bot.config.get(guild).getSlashCommand().getSuccessColor()) |
72 | 79 | .setDescription(String.format( |
73 | 80 | """ |
74 | 81 | Your submission was accepted! %s |
75 | 82 | You've been granted **`1 QOTW-Point`**! (total: %s)""", |
76 | 83 | Bot.config.get(guild).getEmote().getSuccessEmote().getAsMention(), points)) |
77 | | - .setTimestamp(Instant.now()) |
78 | 84 | .build(); |
79 | 85 | } |
| 86 | + |
| 87 | + private MessageEmbed buildSubmissionDeclinedEmbed(String reasons) { |
| 88 | + return this.buildQOTWNotificationEmbed() |
| 89 | + .setColor(Bot.config.get(guild).getSlashCommand().getErrorColor()) |
| 90 | + .setDescription(String.format(""" |
| 91 | + Hey %s, |
| 92 | + Your QOTW-Submission was **declined** for the following reasons: |
| 93 | + **`%s`** |
| 94 | +
|
| 95 | + However, you can try your luck again next week!""", |
| 96 | + user.getAsMention(), reasons)) |
| 97 | + .build(); |
| 98 | + } |
| 99 | + |
80 | 100 | } |
0 commit comments