Optimize message retrieval in CommandDataSuggestions
The logic in CommandDataSuggestions has been simplified to improve fetching of parent messages in thread channels. This change replaces the previous method that got the entire history and checked conditionally for size. Now, instead, the parent message is directly retrieved, leading to cleaner and more efficient code.
This commit is contained in:
@@ -48,12 +48,7 @@ public class CommandDataSuggestions extends DiscordCommand {
|
||||
ExcelWriter excelWriter = new ExcelWriter();
|
||||
long waitSeconds = 0;
|
||||
for (ThreadChannel activeSuggestion : activeSuggestions) {
|
||||
activeSuggestion.getHistoryFromBeginning(1).queueAfter(waitSeconds, TimeUnit.SECONDS, hist -> {
|
||||
List<Message> retrievedHistory = hist.getRetrievedHistory();
|
||||
if (retrievedHistory.size() != 1) {
|
||||
return;
|
||||
}
|
||||
Message message = retrievedHistory.get(0);
|
||||
activeSuggestion.retrieveParentMessage().queueAfter(waitSeconds, TimeUnit.SECONDS, message -> {
|
||||
MessageReaction thumbsUp = message.getReaction(Emoji.fromUnicode("\uD83D\uDC4D"));
|
||||
MessageReaction thumbsDown = message.getReaction(Emoji.fromUnicode("\uD83D\uDC4E"));
|
||||
excelWriter.addRow(
|
||||
|
||||
Reference in New Issue
Block a user