Interface WebhookMessageUpdateAction<T>
-
- Type Parameters:
T
- The type of message that will be returned
- All Superinterfaces:
RestAction<T>
public interface WebhookMessageUpdateAction<T> extends RestAction<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default WebhookMessageUpdateAction<T>
addFile(byte[] data, java.lang.String name, AttachmentOption... options)
Adds the providedbyte[]
as file data.default WebhookMessageUpdateAction<T>
addFile(java.io.File file, java.lang.String name, AttachmentOption... options)
Adds the providedFile
.default WebhookMessageUpdateAction<T>
addFile(java.io.File file, AttachmentOption... options)
Adds the providedFile
.WebhookMessageUpdateAction<T>
addFile(java.io.InputStream data, java.lang.String name, AttachmentOption... options)
Adds the providedInputStream
as file data.WebhookMessageUpdateAction<T>
applyMessage(Message message)
Applies theMessage
to overwrite the existing message.default WebhookMessageUpdateAction<T>
retainFiles(java.util.Collection<? extends Message.Attachment> attachments)
Removes all attachments that are currently attached to the existing message except for the ones provided.default WebhookMessageUpdateAction<T>
retainFilesById(long... ids)
Removes all attachments that are currently attached to the existing message except for the ones provided.default WebhookMessageUpdateAction<T>
retainFilesById(java.lang.String... ids)
Removes all attachments that are currently attached to the existing message except for the ones provided.WebhookMessageUpdateAction<T>
retainFilesById(java.util.Collection<java.lang.String> ids)
Removes all attachments that are currently attached to the existing message except for the ones provided.default WebhookMessageUpdateAction<T>
setActionRow(java.util.Collection<? extends Component> components)
Set only one action row for convenience.default WebhookMessageUpdateAction<T>
setActionRow(Component... components)
Set only one action row for convenience.default WebhookMessageUpdateAction<T>
setActionRows(java.util.Collection<? extends ActionRow> rows)
Set the action rows for the message.WebhookMessageUpdateAction<T>
setActionRows(ActionRow... rows)
Set the action rows for the message.WebhookMessageUpdateAction<T>
setContent(java.lang.String content)
Set the new content for this message.WebhookMessageUpdateAction<T>
setEmbeds(java.util.Collection<? extends MessageEmbed> embeds)
Set theMessageEmbeds
for the messagedefault WebhookMessageUpdateAction<T>
setEmbeds(MessageEmbed... embeds)
Set theMessageEmbeds
for the message-
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, deadline, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, setCheck, submit, submit, submitAfter, submitAfter, timeout, zip
-
-
-
-
Method Detail
-
setContent
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> setContent(@Nullable java.lang.String content)
Set the new content for this message.- Parameters:
content
- The new message content- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided content is longer thanMAX_CONTENT_LENGTH
characters
-
setEmbeds
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> setEmbeds(@Nonnull java.util.Collection<? extends MessageEmbed> embeds)
Set theMessageEmbeds
for the message- Parameters:
embeds
- The message embeds- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If null is provided, or one of the embeds is too big
-
setEmbeds
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> setEmbeds(@Nonnull MessageEmbed... embeds)
Set theMessageEmbeds
for the message- Parameters:
embeds
- The message embeds- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If null is provided, or one of the embeds is too big
-
setActionRow
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> setActionRow(@Nonnull Component... components)
Set only one action row for convenience.- Parameters:
components
- The action row components, such asButtons
- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If null or more than 5 components are provided
-
setActionRow
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> setActionRow(@Nonnull java.util.Collection<? extends Component> components)
Set only one action row for convenience.- Parameters:
components
- The action row components, such asButtons
- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If null or more than 5 components are provided
-
setActionRows
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> setActionRows(@Nonnull java.util.Collection<? extends ActionRow> rows)
Set the action rows for the message.- Parameters:
rows
- The new action rows- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If null is provided or more than 5 actions rows are provided
-
setActionRows
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> setActionRows(@Nonnull ActionRow... rows)
Set the action rows for the message.- Parameters:
rows
- The new action rows- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If null is provided or more than 5 actions rows are provided
-
applyMessage
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> applyMessage(@Nonnull Message message)
Applies theMessage
to overwrite the existing message.- Parameters:
message
- The message to use for updating- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If null is provided
-
addFile
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> addFile(@Nonnull java.io.InputStream data, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Adds the providedInputStream
as file data.
The stream will be closed upon execution!
The provided file will be appended to the message. You can useretainFiles(Collection)
to delete files from the message.- Parameters:
data
- The InputStream data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation foraddFile(java.io.File, String, AttachmentOption...)
for information about this parameter.options
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided data or filename isnull
.
-
addFile
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> addFile(@Nonnull byte[] data, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Adds the providedbyte[]
as file data.
The stream will be closed upon execution!
The provided file will be appended to the message. You can useretainFiles(Collection)
to delete files from the message.- Parameters:
data
- Thebyte[]
data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation foraddFile(java.io.File, String, AttachmentOption...)
for information about this parameter.options
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided data or filename isnull
.
-
addFile
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> addFile(@Nonnull java.io.File file, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Adds the providedFile
.
The stream will be closed upon execution!
The provided file will be appended to the message. You can useretainFiles(Collection)
to delete files from the message.The
name
parameter is used to inform Discord about what the file should be called. This is 2 fold:- The file name provided is the name that is found in
Message.Attachment.getFileName()
after upload and it is the name that will show up in the client when the upload is displayed.
Note: The fileName does not show up on the Desktop client for images. It does on mobile however. - The extension of the provided fileName also determines how Discord will treat the file. Discord currently only has special handling for image file types, but the fileName's extension must indicate that it is an image file. This means it has to end in something like .png, .jpg, .jpeg, .gif, etc. As a note, you can also not provide a full name for the file and instead ONLY provide the extension like "png" or "gif" and Discord will generate a name for the upload and append the fileName as the extension.
- Parameters:
file
- TheFile
data to upload to the webhook.name
- The file name that should be sent to discordoptions
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided file or filename isnull
.
- The file name provided is the name that is found in
-
addFile
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> addFile(@Nonnull java.io.File file, @Nonnull AttachmentOption... options)
Adds the providedFile
.
The stream will be closed upon execution!
The provided file will be appended to the message. You can useretainFiles(Collection)
to delete files from the message.- Parameters:
file
- TheFile
data to upload to the webhook.options
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided file isnull
.
-
retainFilesById
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> retainFilesById(@Nonnull java.util.Collection<java.lang.String> ids)
Removes all attachments that are currently attached to the existing message except for the ones provided.
For exampleretainFilesById(Arrays.asList("123"))
would remove all attachments except for the one with the id 123.To remove all attachments from the message you can pass an empty list.
- Parameters:
ids
- The ids for the attachments which should be retained on the message- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If any of the ids is null or not a valid snowflake
-
retainFilesById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> retainFilesById(@Nonnull java.lang.String... ids)
Removes all attachments that are currently attached to the existing message except for the ones provided.
For exampleretainFilesById(Arrays.asList("123"))
would remove all attachments except for the one with the id 123.To remove all attachments from the message you can pass an empty list.
- Parameters:
ids
- The ids for the attachments which should be retained on the message- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If any of the ids is null or not a valid snowflake
-
retainFilesById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> retainFilesById(long... ids)
Removes all attachments that are currently attached to the existing message except for the ones provided.
For exampleretainFilesById(Arrays.asList("123"))
would remove all attachments except for the one with the id 123.To remove all attachments from the message you can pass an empty list.
- Parameters:
ids
- The ids for the attachments which should be retained on the message- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If any of the ids is null or not a valid snowflake
-
retainFiles
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> retainFiles(@Nonnull java.util.Collection<? extends Message.Attachment> attachments)
Removes all attachments that are currently attached to the existing message except for the ones provided.
For exampleretainFiles(message.getAttachments().subList(1, message.getAttachments().size()))
would only remove the first attachment from the message.To remove all attachments from the message you can pass an empty list.
- Parameters:
attachments
- The attachments which should be retained on the message- Returns:
- The same update action, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If any of the ids is null or not a valid snowflake
-
-