22
33import club .minnced .discord .webhook .WebhookClientBuilder ;
44import club .minnced .discord .webhook .external .JDAWebhookClient ;
5+ import club .minnced .discord .webhook .receive .ReadonlyMessage ;
56import club .minnced .discord .webhook .send .AllowedMentions ;
67import club .minnced .discord .webhook .send .WebhookMessageBuilder ;
78import club .minnced .discord .webhook .send .component .LayoutComponent ;
@@ -72,7 +73,7 @@ public static void ensureWebhookExists(@NotNull StandardGuildMessageChannel chan
7273 * @return a {@link CompletableFuture} representing the action of sending
7374 * the message
7475 */
75- public static CompletableFuture <Void > mirrorMessageToWebhook (@ NotNull Webhook webhook , @ NotNull Message originalMessage , String newMessageContent , long threadId , LayoutComponent @ NotNull ... components ) {
76+ public static CompletableFuture <ReadonlyMessage > mirrorMessageToWebhook (@ NotNull Webhook webhook , @ NotNull Message originalMessage , String newMessageContent , long threadId , LayoutComponent @ NotNull ... components ) {
7677 JDAWebhookClient client = new WebhookClientBuilder (webhook .getIdLong (), webhook .getToken ())
7778 .setThreadId (threadId ).buildJDA ();
7879 WebhookMessageBuilder message = new WebhookMessageBuilder ().setContent (newMessageContent )
@@ -90,7 +91,7 @@ public static CompletableFuture<Void> mirrorMessageToWebhook(@NotNull Webhook we
9091 futures [i ] = attachment .getProxy ().download ().thenAccept (
9192 is -> message .addFile ((attachment .isSpoiler () ? "SPOILER_" : "" ) + attachment .getFileName (), is ));
9293 }
93- return CompletableFuture .allOf (futures ).thenAccept (unused -> client .send (message .build ()))
94+ return CompletableFuture .allOf (futures ).thenCompose (unused -> client .send (message .build ()))
9495 .whenComplete ((result , err ) -> client .close ());
9596 }
9697}
0 commit comments