[AB-xxx] adding ability to add additional channels to a post target

adding auto complete to post target command
This commit is contained in:
Sheldan
2025-12-17 23:54:54 +01:00
parent 0f6adacd90
commit 274dd77eeb
31 changed files with 287 additions and 83 deletions

View File

@@ -212,7 +212,7 @@ public class PollServiceBean implements PollService {
.build();
componentPayloadManagementService.createButtonPayload(buttonConfigModel, serverId);
MessageToSend messageToSend = templateService.renderEmbedTemplate(SERVER_POLL_TEMPLATE_KEY, model, serverId);
List<CompletableFuture<Message>> messageFutures = postTargetService.sendEmbedInPostTarget(messageToSend, PollPostTarget.POLLS, serverId);
List<CompletableFuture<Message>> messageFutures = postTargetService.sendEmbedInPostTarget(messageToSend, PollPostTarget.POLLS, serverId).get(0);
return FutureUtils.toSingleFutureGeneric(messageFutures)
.thenAccept(unused -> self.persistPoll(messageFutures.get(0).join(), pollCreationRequest));
}
@@ -373,7 +373,7 @@ public class PollServiceBean implements PollService {
.build();
MessageToSend messageToSend = templateService.renderEmbedTemplate(SERVER_POLL_EVALUATION_UPDATE_TEMPLATE_KEY, model, serverId);
log.info("Sending update message for poll evaluation of server poll {} in server {}.", pollId, serverId);
List<CompletableFuture<Message>> messageFutures = postTargetService.sendEmbedInPostTarget(messageToSend, PollPostTarget.POLLS, serverId);
List<CompletableFuture<Message>> messageFutures = postTargetService.sendEmbedInPostTarget(messageToSend, PollPostTarget.POLLS, serverId).get(0);
GuildMessageChannel channel = channelService.getMessageChannelFromServer(serverId, poll.getChannel().getId());
log.info("Cleaning existing components in message {} for server poll {} in server {}.", poll.getMessageId(), pollId, serverId);
CompletableFuture<Message> cleanMessageFuture = channelService.removeComponents(channel, poll.getMessageId());
@@ -408,7 +408,7 @@ public class PollServiceBean implements PollService {
.build();
MessageToSend messageToSend = templateService.renderEmbedTemplate(SERVER_POLL_REMINDER_TEMPLATE_KEY, model, serverId);
log.info("Sending poll reminder about server poll {} in server {}.", pollId, serverId);
return FutureUtils.toSingleFutureGeneric(postTargetService.sendEmbedInPostTarget(messageToSend, PollPostTarget.POLL_REMINDER, serverId));
return FutureUtils.toSingleFutureGenericList(postTargetService.sendEmbedInPostTarget(messageToSend, PollPostTarget.POLL_REMINDER, serverId));
}
@Override
@@ -464,10 +464,10 @@ public class PollServiceBean implements PollService {
schedulerService.stopTrigger(poll.getEvaluationJobTriggerKey());
}
MessageToSend messageToSend = templateService.renderEmbedTemplate(SERVER_POLL_CLOSE_MESSAGE, model, serverId);
List<CompletableFuture<Message>> messageFutures = postTargetService.sendEmbedInPostTarget(messageToSend, PollPostTarget.POLLS, serverId);
List<List<CompletableFuture<Message>>> messageFutures = postTargetService.sendEmbedInPostTarget(messageToSend, PollPostTarget.POLLS, serverId);
MessageChannel channel = channelService.getMessageChannelFromServer(serverId, poll.getChannel().getId());
CompletableFuture<Message> removeComponentsFuture = channelService.removeComponents(channel, poll.getMessageId());
return CompletableFuture.allOf(FutureUtils.toSingleFutureGeneric(messageFutures), removeComponentsFuture);
return CompletableFuture.allOf(FutureUtils.toSingleFutureGenericList(messageFutures), removeComponentsFuture);
}
@Override

View File

@@ -154,7 +154,7 @@ public class SuggestionServiceBean implements SuggestionService {
}
MessageToSend messageToSend = templateService.renderEmbedTemplate(SUGGESTION_CREATION_TEMPLATE, model, serverId);
log.info("Creating suggestion with id {} in server {} from member {}.", newSuggestionId, serverId, suggester.getIdLong());
List<CompletableFuture<Message>> completableFutures = postTargetService.sendEmbedInPostTarget(messageToSend, SuggestionPostTarget.SUGGESTION, serverId);
List<CompletableFuture<Message>> completableFutures = postTargetService.sendEmbedInPostTarget(messageToSend, SuggestionPostTarget.SUGGESTION, serverId).get(0);
List<ButtonConfigModel> buttonConfigModels = Arrays.asList(model.getAgreeButtonModel(), model.getDisAgreeButtonModel(), model.getRemoveVoteButtonModel());
return FutureUtils.toSingleFutureGeneric(completableFutures)
.thenCompose(aVoid -> self.addVotingPossibility(suggestionChannelId, suggestionMessageId, text, suggester, serverId, newSuggestionId, completableFutures, buttonConfigModels, useButtons))
@@ -393,7 +393,7 @@ public class SuggestionServiceBean implements SuggestionService {
suggestionLog.setReason(text);
Long serverId = suggestionLog.getServerId();
MessageToSend messageToSend = templateService.renderEmbedTemplate(SUGGESTION_UPDATE_TEMPLATE, suggestionLog, serverId);
List<CompletableFuture<Message>> completableFutures = postTargetService.sendEmbedInPostTarget(messageToSend, SuggestionPostTarget.SUGGESTION, serverId);
List<CompletableFuture<Message>> completableFutures = postTargetService.sendEmbedInPostTarget(messageToSend, SuggestionPostTarget.SUGGESTION, serverId).get(0);
return CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0]));
}
@@ -463,8 +463,8 @@ public class SuggestionServiceBean implements SuggestionService {
.build();
MessageToSend messageToSend = templateService.renderEmbedTemplate(SUGGESTION_REMINDER_TEMPLATE_KEY, model, serverId);
log.info("Reminding about suggestion {} in server {}.", suggestionId.getId(), serverId);
List<CompletableFuture<Message>> completableFutures = postTargetService.sendEmbedInPostTarget(messageToSend, SuggestionPostTarget.SUGGESTION_REMINDER, serverId);
return FutureUtils.toSingleFutureGeneric(completableFutures);
List<List<CompletableFuture<Message>>> completableFutures = postTargetService.sendEmbedInPostTarget(messageToSend, SuggestionPostTarget.SUGGESTION_REMINDER, serverId);
return FutureUtils.toSingleFutureGenericList(completableFutures);
}
@Override