Refactor attachment upload

This commit is contained in:
AsamK 2024-09-29 09:43:26 +02:00
parent 7f1fc932ad
commit 91eacc18c2

View file

@ -764,11 +764,12 @@ public class ManagerImpl implements Manager {
messageBuilder.withBody(message.messageText()); messageBuilder.withBody(message.messageText());
} }
if (!message.attachments().isEmpty()) { if (!message.attachments().isEmpty()) {
final var uploadedAttachments = context.getAttachmentHelper().uploadAttachments(message.attachments());
if (!additionalAttachments.isEmpty()) { if (!additionalAttachments.isEmpty()) {
additionalAttachments.addAll(context.getAttachmentHelper().uploadAttachments(message.attachments())); additionalAttachments.addAll(uploadedAttachments);
messageBuilder.withAttachments(additionalAttachments); messageBuilder.withAttachments(additionalAttachments);
} else { } else {
messageBuilder.withAttachments(context.getAttachmentHelper().uploadAttachments(message.attachments())); messageBuilder.withAttachments(uploadedAttachments);
} }
} }
if (!message.mentions().isEmpty()) { if (!message.mentions().isEmpty()) {