From ca48f935a831d1c8099b86b594feb47666682a9b Mon Sep 17 00:00:00 2001 From: freya02 <41875020+freya022@users.noreply.github.com> Date: Sat, 15 Mar 2025 21:23:40 +0100 Subject: [PATCH] Add note about editing previously locally-uploaded attachments As they will be deleted when editing attachments and if previous ones are not re-uploaded --- .../net/dv8tion/jda/api/EmbedBuilder.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java b/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java index 50363dcce9..a65523b9d6 100644 --- a/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java @@ -538,6 +538,11 @@ public EmbedBuilder setColor(int color) * (using {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel#sendFiles(net.dv8tion.jda.api.utils.FileUpload...) MessageChannel.sendFiles(...)}) * you can reference said image using the specified filename as URI {@code attachment://filename.ext}. * + *
Note that the uploaded attachment will not be accessible in the resulting {@linkplain net.dv8tion.jda.api.entities.Message#getAttachments() message's attachments}.
+ *
If you later edit with new attachments, Discord will consider the previous embed's attachments to be deleted.
+ * You can work around that by keeping the original message's data ({@link net.dv8tion.jda.api.utils.messages.MessageCreateData MessageCreateData} / {@link net.dv8tion.jda.api.utils.messages.MessageEditData MessageEditData}),
+ * and edit the message with this data, plus the new content.
+ *
*
Example *
* MessageChannel channel; // = reference of a MessageChannel
@@ -585,6 +590,11 @@ public EmbedBuilder setThumbnail(@Nullable String url)
* (using {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel#sendFiles(net.dv8tion.jda.api.utils.FileUpload...) MessageChannel.sendFiles(...)})
* you can reference said image using the specified filename as URI {@code attachment://filename.ext}.
*
+ * Note that the uploaded attachment will not be accessible in the resulting {@linkplain net.dv8tion.jda.api.entities.Message#getAttachments() message's attachments}.
+ *
If you later edit with new attachments, Discord will consider the previous embed's attachments to be deleted.
+ * You can work around that by keeping the original message's data ({@link net.dv8tion.jda.api.utils.messages.MessageCreateData MessageCreateData} / {@link net.dv8tion.jda.api.utils.messages.MessageEditData MessageEditData}),
+ * and edit the message with this data, plus the new content.
+ *
*
Example
*
* MessageChannel channel; // = reference of a MessageChannel
@@ -686,6 +696,11 @@ public EmbedBuilder setAuthor(@Nullable String name, @Nullable String url)
* (using {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel#sendFiles(net.dv8tion.jda.api.utils.FileUpload...) MessageChannel.sendFiles(...)})
* you can reference said image using the specified filename as URI {@code attachment://filename.ext}.
*
+ * Note that the uploaded attachment will not be accessible in the resulting {@linkplain net.dv8tion.jda.api.entities.Message#getAttachments() message's attachments}.
+ *
If you later edit with new attachments, Discord will consider the previous embed's attachments to be deleted.
+ * You can work around that by keeping the original message's data ({@link net.dv8tion.jda.api.utils.messages.MessageCreateData MessageCreateData} / {@link net.dv8tion.jda.api.utils.messages.MessageEditData MessageEditData}),
+ * and edit the message with this data, plus the new content.
+ *
*
Example
*
* MessageChannel channel; // = reference of a MessageChannel
@@ -765,6 +780,11 @@ public EmbedBuilder setFooter(@Nullable String text)
* (using {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel#sendFiles(net.dv8tion.jda.api.utils.FileUpload...) MessageChannel.sendFiles(...)})
* you can reference said image using the specified filename as URI {@code attachment://filename.ext}.
*
+ * Note that the uploaded attachment will not be accessible in the resulting {@linkplain net.dv8tion.jda.api.entities.Message#getAttachments() message's attachments}.
+ *
If you later edit with new attachments, Discord will consider the previous embed's attachments to be deleted.
+ * You can work around that by keeping the original message's data ({@link net.dv8tion.jda.api.utils.messages.MessageCreateData MessageCreateData} / {@link net.dv8tion.jda.api.utils.messages.MessageEditData MessageEditData}),
+ * and edit the message with this data, plus the new content.
+ *
*
Example
*
* MessageChannel channel; // = reference of a MessageChannel