|
1 | 1 | package net.javadiscord.javabot.systems.qotw.commands.view; |
2 | 2 |
|
| 3 | +import java.util.Comparator; |
| 4 | + |
| 5 | +import org.jetbrains.annotations.NotNull; |
| 6 | + |
3 | 7 | import com.dynxsty.dih4jda.interactions.commands.SlashCommand; |
| 8 | + |
4 | 9 | import net.dv8tion.jda.api.EmbedBuilder; |
| 10 | +import net.dv8tion.jda.api.entities.Message; |
5 | 11 | import net.dv8tion.jda.api.entities.MessageEmbed; |
6 | 12 | import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; |
7 | 13 | import net.dv8tion.jda.api.interactions.commands.OptionMapping; |
|
13 | 19 | import net.javadiscord.javabot.systems.qotw.submissions.model.QOTWSubmission; |
14 | 20 | import net.javadiscord.javabot.util.MessageActionUtils; |
15 | 21 | import net.javadiscord.javabot.util.Responses; |
16 | | -import org.jetbrains.annotations.NotNull; |
17 | 22 |
|
18 | 23 | /** |
19 | 24 | * Represents the `/qotw-view answer` subcommand. It allows for viewing an answer to a QOTW. |
@@ -63,7 +68,12 @@ public void execute(@NotNull SlashCommandInteractionEvent event) { |
63 | 68 | MessageActionUtils.copyMessagesToNewThread(event.getGuildChannel().asStandardGuildMessageChannel(), |
64 | 69 | buildQOTWInfoEmbed(submission, event.getMember() == null ? event.getUser().getName() : event.getMember().getEffectiveName()), |
65 | 70 | "QOTW #" + submission.getQuestionNumber(), |
66 | | - history.getRetrievedHistory(), |
| 71 | + history |
| 72 | + .getRetrievedHistory() |
| 73 | + .stream() |
| 74 | + .filter(msg -> !msg.getAuthor().isSystem() && !msg.getAuthor().isBot()) |
| 75 | + .sorted(Comparator.comparingLong(Message::getIdLong)) |
| 76 | + .toList(), |
67 | 77 | thread -> { |
68 | 78 | Responses.success(event.getHook(), "View Answer", "Answer copied successfully").queue(); |
69 | 79 | thread.getManager().setLocked(true).queue(); |
|
0 commit comments