File tree Expand file tree Collapse file tree 6 files changed +22
-9
lines changed
src/main/java/net/javadiscord/javabot/systems Expand file tree Collapse file tree 6 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 1414
1515import javax .annotation .Nonnull ;
1616import java .time .Instant ;
17- import java .util .concurrent .ExecutorService ;
1817
1918/**
2019 * An extension of {@link QOTWGuildNotificationService} which also handles user qotw
Original file line number Diff line number Diff line change 2323import org .jetbrains .annotations .NotNull ;
2424import org .springframework .scheduling .annotation .Scheduled ;
2525import org .springframework .stereotype .Service ;
26- import org .springframework .util .StringUtils ;
2726
28- import javax .swing .text .html .Option ;
2927import java .sql .SQLException ;
30- import java .time .OffsetDateTime ;
3128import java .util .Collections ;
3229import java .util .List ;
3330import java .util .Optional ;
Original file line number Diff line number Diff line change 77import net .javadiscord .javabot .systems .notification .NotificationService ;
88import net .javadiscord .javabot .systems .qotw .dao .QuestionQueueRepository ;
99import net .javadiscord .javabot .systems .qotw .model .QOTWQuestion ;
10- import net .javadiscord .javabot .util .ExceptionLogger ;
1110import org .springframework .scheduling .annotation .Scheduled ;
1211import org .springframework .stereotype .Service ;
1312
1413import lombok .RequiredArgsConstructor ;
1514
16- import java .sql .Connection ;
1715import java .sql .SQLException ;
1816import java .util .Optional ;
1917
Original file line number Diff line number Diff line change 66
77import java .util .function .Consumer ;
88
9+ /**
10+ * Simple data class that represents a single {@link ThreadChannel submission} and the corresponding
11+ * {@link User author}.
12+ */
913@ Data
1014public class QOTWSubmission {
1115 private final ThreadChannel thread ;
@@ -15,6 +19,12 @@ public boolean hasAuthor() {
1519 return author != null ;
1620 }
1721
22+ /**
23+ * Attempts to retrieve the thread's actual author. Since the bot is creating submission threads, we can't use
24+ * {@link ThreadChannel#getOwnerThreadMember()}, so we just filter all bot-users instead.
25+ *
26+ * @param onSuccess The success-{@link Consumer} for this operation.
27+ */
1828 public void retrieveAuthor (Consumer <User > onSuccess ) {
1929 thread .retrieveThreadMembers ().queue (s -> s .forEach (m -> {
2030 if (author == null && !m .getUser ().isBot ()) {
Original file line number Diff line number Diff line change 11package net .javadiscord .javabot .systems .qotw .submissions ;
22
3+ /**
4+ * Represents a submissions' status.
5+ */
36public enum SubmissionStatus {
7+ /**
8+ * The submission got accepted and was among the best answers for the current week.
9+ */
410 ACCEPT_BEST ,
11+ /**
12+ * The submission simply got accepted.
13+ */
514 ACCEPT ,
15+ /**
16+ * The submission got declined.
17+ */
618 DECLINE
719}
Original file line number Diff line number Diff line change 11package net .javadiscord .javabot .systems .qotw .submissions .subcommands ;
22
3- import net .dv8tion .jda .api .entities .ThreadMember ;
4- import net .dv8tion .jda .api .entities .User ;
53import net .dv8tion .jda .api .entities .channel .ChannelType ;
64import net .dv8tion .jda .api .entities .channel .concrete .ThreadChannel ;
75import net .dv8tion .jda .api .events .interaction .command .SlashCommandInteractionEvent ;
2018import org .jetbrains .annotations .NotNull ;
2119import xyz .dynxsty .dih4jda .interactions .commands .application .SlashCommand ;
2220
23- import java .util .Optional ;
2421import java .util .concurrent .ExecutorService ;
2522
2623/**
You can’t perform that action at this time.
0 commit comments