Interface WebhookClient<T>
-
- All Known Subinterfaces:
InteractionHook
public interface WebhookClient<T>
Interface which allows sending messages through the webhooks API.
Interactions can use these throughInteraction.getHook()
.- See Also:
Webhook
,InteractionHook
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default RestAction<java.lang.Void>
deleteMessageById(long messageId)
Delete a message from this webhook.RestAction<java.lang.Void>
deleteMessageById(java.lang.String messageId)
Delete a message from this webhook.default WebhookMessageUpdateAction<T>
editMessageById(long messageId, byte[] data, java.lang.String name, AttachmentOption... options)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageById(long messageId, java.io.File file, java.lang.String name, AttachmentOption... options)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageById(long messageId, java.io.File file, AttachmentOption... options)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageById(long messageId, java.io.InputStream data, java.lang.String name, AttachmentOption... options)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageById(long messageId, java.lang.String content)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageById(long messageId, Message message)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageById(java.lang.String messageId, byte[] data, java.lang.String name, AttachmentOption... options)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageById(java.lang.String messageId, java.io.File file, java.lang.String name, AttachmentOption... options)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageById(java.lang.String messageId, java.io.File file, AttachmentOption... options)
Edit an existing message sent by this webhook.WebhookMessageUpdateAction<T>
editMessageById(java.lang.String messageId, java.io.InputStream data, java.lang.String name, AttachmentOption... options)
Edit an existing message sent by this webhook.WebhookMessageUpdateAction<T>
editMessageById(java.lang.String messageId, java.lang.String content)
Edit an existing message sent by this webhook.WebhookMessageUpdateAction<T>
editMessageById(java.lang.String messageId, Message message)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageComponentsById(long messageId, java.util.Collection<? extends ComponentLayout> components)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageComponentsById(long messageId, ComponentLayout... components)
Edit an existing message sent by this webhook.WebhookMessageUpdateAction<T>
editMessageComponentsById(java.lang.String messageId, java.util.Collection<? extends ComponentLayout> components)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageComponentsById(java.lang.String messageId, ComponentLayout... components)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageEmbedsById(long messageId, java.util.Collection<? extends MessageEmbed> embeds)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageEmbedsById(long messageId, MessageEmbed... embeds)
Edit an existing message sent by this webhook.WebhookMessageUpdateAction<T>
editMessageEmbedsById(java.lang.String messageId, java.util.Collection<? extends MessageEmbed> embeds)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageEmbedsById(java.lang.String messageId, MessageEmbed... embeds)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageFormatById(long messageId, java.lang.String format, java.lang.Object... args)
Edit an existing message sent by this webhook.default WebhookMessageUpdateAction<T>
editMessageFormatById(java.lang.String messageId, java.lang.String format, java.lang.Object... args)
Edit an existing message sent by this webhook.default WebhookMessageAction<T>
sendFile(byte[] data, java.lang.String name, AttachmentOption... options)
Send a message to this webhook.default WebhookMessageAction<T>
sendFile(java.io.File file, java.lang.String name, AttachmentOption... options)
Send a message to this webhook.default WebhookMessageAction<T>
sendFile(java.io.File file, AttachmentOption... options)
Send a message to this webhook.WebhookMessageAction<T>
sendFile(java.io.InputStream data, java.lang.String name, AttachmentOption... options)
Send a message to this webhook.WebhookMessageAction<T>
sendMessage(java.lang.String content)
Send a message to this webhook.WebhookMessageAction<T>
sendMessage(Message message)
Send a message to this webhook.WebhookMessageAction<T>
sendMessageEmbeds(java.util.Collection<? extends MessageEmbed> embeds)
Send a message to this webhook.default WebhookMessageAction<T>
sendMessageEmbeds(MessageEmbed embed, MessageEmbed... embeds)
Send a message to this webhook.default WebhookMessageAction<T>
sendMessageFormat(java.lang.String format, java.lang.Object... args)
Send a message to this webhook.
-
-
-
Method Detail
-
sendMessage
@Nonnull @CheckReturnValue WebhookMessageAction<T> sendMessage(@Nonnull java.lang.String content)
Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.
- Parameters:
content
- The message content- Returns:
WebhookMessageAction
- Throws:
java.lang.IllegalArgumentException
- If the content is null, empty, or longer thanMessage.MAX_CONTENT_LENGTH
-
sendMessage
@Nonnull @CheckReturnValue WebhookMessageAction<T> sendMessage(@Nonnull Message message)
Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.
- Parameters:
message
- The message to send- Returns:
WebhookMessageAction
- Throws:
java.lang.IllegalArgumentException
- If the message is null
-
sendMessageFormat
@Nonnull @CheckReturnValue default WebhookMessageAction<T> sendMessageFormat(@Nonnull java.lang.String format, @Nonnull java.lang.Object... args)
Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.
- Parameters:
format
- Format string for the message contentargs
- Format arguments for the content- Returns:
WebhookMessageAction
- Throws:
java.lang.IllegalArgumentException
- If the format string is null or the resulting content is longer thanMessage.MAX_CONTENT_LENGTH
-
sendMessageEmbeds
@Nonnull @CheckReturnValue WebhookMessageAction<T> sendMessageEmbeds(@Nonnull java.util.Collection<? extends MessageEmbed> embeds)
Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.
- Parameters:
embeds
-MessageEmbeds
to use (up to 10 in total)- Returns:
WebhookMessageAction
- Throws:
java.lang.IllegalArgumentException
- If any of the embeds are null, more than 10, or longer thanMessageEmbed.EMBED_MAX_LENGTH_BOT
.
-
sendMessageEmbeds
@Nonnull @CheckReturnValue default WebhookMessageAction<T> sendMessageEmbeds(@Nonnull MessageEmbed embed, @Nonnull MessageEmbed... embeds)
Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.
- Parameters:
embed
-MessageEmbed
to useembeds
- AdditionalMessageEmbeds
to use (up to 10 in total)- Returns:
WebhookMessageAction
- Throws:
java.lang.IllegalArgumentException
- If any of the embeds are null, more than 10, or longer thanMessageEmbed.EMBED_MAX_LENGTH_BOT
.
-
sendFile
@Nonnull @CheckReturnValue WebhookMessageAction<T> sendFile(@Nonnull java.io.InputStream data, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.sendFile(file, "cat.png").addEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.REQUEST_ENTITY_TOO_LARGE
The file exceeds the maximum upload size ofMessage.MAX_FILE_SIZE
- Parameters:
data
- The InputStream data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation forsendFile(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:
WebhookMessageAction
- Throws:
java.lang.IllegalArgumentException
- If the provided file or filename isnull
orempty
.
-
sendFile
@Nonnull @CheckReturnValue default WebhookMessageAction<T> sendFile(@Nonnull java.io.File file, @Nonnull AttachmentOption... options)
Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.This is a shortcut to
sendFile(java.io.File, String, AttachmentOption...)
by way of usingFile.getName()
.sendFile(file, file.getName())
Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); File data = new File("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.sendFile(file, "cat.png").addEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.REQUEST_ENTITY_TOO_LARGE
The file exceeds the maximum upload size ofMessage.MAX_FILE_SIZE
- 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:
WebhookMessageAction
- Throws:
java.lang.IllegalArgumentException
- If the provided file isnull
.
-
sendFile
@Nonnull @CheckReturnValue default WebhookMessageAction<T> sendFile(@Nonnull java.io.File file, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.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.
Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); byte[] data = IOUtils.readAllBytes(new FileInputStream("image.png")); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.sendFile(file, "cat.png").addEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.REQUEST_ENTITY_TOO_LARGE
The file exceeds the maximum upload size ofMessage.MAX_FILE_SIZE
- 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:
WebhookMessageAction
- Throws:
java.lang.IllegalArgumentException
- If the provided file or filename isnull
orempty
.
- The file name provided is the name that is found in
-
sendFile
@Nonnull @CheckReturnValue default WebhookMessageAction<T> sendFile(@Nonnull byte[] data, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); byte[] data = IOUtils.readAllBytes(new FileInputStream("image.png")); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.sendFile(file, "cat.png").addEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.REQUEST_ENTITY_TOO_LARGE
The file exceeds the maximum upload size ofMessage.MAX_FILE_SIZE
- Parameters:
data
- Thebyte[]
data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation forsendFile(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:
WebhookMessageAction
- Throws:
java.lang.IllegalArgumentException
- If the provided file or filename isnull
orempty
.
-
editMessageById
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> editMessageById(@Nonnull java.lang.String messageId, @Nonnull java.lang.String content)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.content
- The new message content to use- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided content is null, empty, or longer thanMessage.MAX_CONTENT_LENGTH
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageById(long messageId, @Nonnull java.lang.String content)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.content
- The new message content to use- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided content is null, empty, or longer thanMessage.MAX_CONTENT_LENGTH
-
editMessageById
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> editMessageById(@Nonnull java.lang.String messageId, @Nonnull Message message)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.message
- The new message to replace the existing message with- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided message is null
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageById(long messageId, Message message)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.message
- The new message to replace the existing message with- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided message is null
-
editMessageFormatById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageFormatById(@Nonnull java.lang.String messageId, @Nonnull java.lang.String format, @Nonnull java.lang.Object... args)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.format
- Format string for the message contentargs
- Format arguments for the content- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the formatted string is null, empty, or longer thanMessage.MAX_CONTENT_LENGTH
-
editMessageFormatById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageFormatById(long messageId, @Nonnull java.lang.String format, @Nonnull java.lang.Object... args)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.format
- Format string for the message contentargs
- Format arguments for the content- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the formatted string is null, empty, or longer thanMessage.MAX_CONTENT_LENGTH
-
editMessageEmbedsById
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> editMessageEmbedsById(@Nonnull java.lang.String messageId, @Nonnull java.util.Collection<? extends MessageEmbed> embeds)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.embeds
-MessageEmbeds
to use (up to 10 in total)- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided embeds are null, or more than 10
-
editMessageEmbedsById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageEmbedsById(long messageId, @Nonnull java.util.Collection<? extends MessageEmbed> embeds)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.embeds
-MessageEmbeds
to use (up to 10 in total)- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided embeds are null, or more than 10
-
editMessageEmbedsById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageEmbedsById(@Nonnull java.lang.String messageId, @Nonnull MessageEmbed... embeds)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.embeds
- The newMessageEmbeds
to use- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided embeds are null, or more than 10
-
editMessageEmbedsById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageEmbedsById(long messageId, @Nonnull MessageEmbed... embeds)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.embeds
- The newMessageEmbeds
to use- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided embeds are null, or more than 10
-
editMessageComponentsById
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> editMessageComponentsById(@Nonnull java.lang.String messageId, @Nonnull java.util.Collection<? extends ComponentLayout> components)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.components
- The new component layouts for this message, such asActionRows
- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided components are null, or more than 5 layouts are provided
-
editMessageComponentsById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageComponentsById(long messageId, @Nonnull java.util.Collection<? extends ComponentLayout> components)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.components
- The new component layouts for this message, such asActionRows
- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided components are null, or more than 5 layouts are provided
-
editMessageComponentsById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageComponentsById(@Nonnull java.lang.String messageId, @Nonnull ComponentLayout... components)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.components
- The new component layouts for this message, such asActionRows
- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided components are null, or more than 5 layouts are provided
-
editMessageComponentsById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageComponentsById(long messageId, @Nonnull ComponentLayout... components)
Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.components
- The new component layouts for this message, such asActionRows
- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided components are null, or more than 5 layouts are provided
-
editMessageById
@Nonnull @CheckReturnValue WebhookMessageUpdateAction<T> editMessageById(@Nonnull java.lang.String messageId, @Nonnull java.io.InputStream data, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Edit an existing message sent by this webhook.
The provided file will be appended to the message. You cannot delete or edit existing files on a message.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.data
- The InputStream data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation forsendFile(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:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided message id, data, or filename isnull
.
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageById(@Nonnull java.lang.String messageId, @Nonnull java.io.File file, @Nonnull AttachmentOption... options)
Edit an existing message sent by this webhook.
The provided file will be appended to the message. You cannot delete or edit existing files on a message.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.This is a shortcut to
editMessageById(java.lang.String, java.io.File, String, AttachmentOption...)
by way of usingFile.getName()
.editMessageById(messageId, file, file.getName())
Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); File file = new File("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.file
- TheFile
data to upload to the webhook.options
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided message id or file isnull
.
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageById(@Nonnull java.lang.String messageId, @Nonnull java.io.File file, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Edit an existing message sent by this webhook.
The provided file will be appended to the message. You cannot delete or edit existing files on a message.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); File file = new File("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.file
- TheFile
data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation forsendFile(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:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided file, message id, or filename isnull
.
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageById(@Nonnull java.lang.String messageId, @Nonnull byte[] data, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Edit an existing message sent by this webhook.
The provided file will be appended to the message. You cannot delete or edit existing files on a message.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.data
- The InputStream data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation forsendFile(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:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided message id, data, or filename isnull
.
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageById(long messageId, @Nonnull java.io.InputStream data, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Edit an existing message sent by this webhook.
The provided file will be appended to the message. You cannot delete or edit existing files on a message.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.data
- The InputStream data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation forsendFile(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:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided data or filename isnull
.
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageById(long messageId, @Nonnull java.io.File file, @Nonnull AttachmentOption... options)
Edit an existing message sent by this webhook.
The provided file will be appended to the message. You cannot delete or edit existing files on a message.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.This is a shortcut to
sendFile(java.io.File, String, AttachmentOption...)
by way of usingFile.getName()
.sendFile(file, file.getName())
Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); File file = new File("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.file
- TheFile
data to upload to the webhook.options
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided file isnull
.
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageById(long messageId, @Nonnull java.io.File file, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Edit an existing message sent by this webhook.
The provided file will be appended to the message. You cannot delete or edit existing files on a message.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); File file = new File("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.file
- TheFile
data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation forsendFile(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:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided file or filename isnull
.
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageUpdateAction<T> editMessageById(long messageId, @Nonnull byte[] data, @Nonnull java.lang.String name, @Nonnull AttachmentOption... options)
Edit an existing message sent by this webhook.
The provided file will be appended to the message. You cannot delete or edit existing files on a message.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Uploading images with Embeds
When uploading an image you can reference said image using the specified filename as URIattachment://filename.ext
.Example
WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook() EmbedBuilder embed = new EmbedBuilder(); InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.data
- The InputStream data to upload to the webhook.name
- The file name that should be sent to discord
Refer to the documentation forsendFile(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:
WebhookMessageUpdateAction
- Throws:
java.lang.IllegalArgumentException
- If the provided data or filename isnull
.
-
deleteMessageById
@Nonnull @CheckReturnValue RestAction<java.lang.Void> deleteMessageById(@Nonnull java.lang.String messageId)
Delete a message from this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The id for the message to delete- Returns:
RestAction
- Throws:
java.lang.IllegalArgumentException
- If the provided message id is null or not a valid snowflake
-
deleteMessageById
@Nonnull @CheckReturnValue default RestAction<java.lang.Void> deleteMessageById(long messageId)
Delete a message from this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.UNKNOWN_MESSAGE
The message for that id does not exist
- Parameters:
messageId
- The id for the message to delete- Returns:
RestAction
-
-