Interface WebhookClient<T>
- All Known Subinterfaces:
InteractionHook
Interactions can use these through
IDeferrableCallback.getHook()
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault RestAction<Void>
deleteMessageById
(long messageId) Delete a message from this webhook.deleteMessageById
(String messageId) Delete a message from this webhook.default WebhookMessageEditAction<T>
editMessageAttachmentsById
(long messageId, Collection<? extends AttachedFile> attachments) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageAttachmentsById
(long messageId, AttachedFile... attachments) Edit an existing message sent by this webhook.editMessageAttachmentsById
(String messageId, Collection<? extends AttachedFile> attachments) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageAttachmentsById
(String messageId, AttachedFile... attachments) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageById
(long messageId, String content) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageById
(long messageId, MessageEditData message) Edit an existing message sent by this webhook.editMessageById
(String messageId, String content) Edit an existing message sent by this webhook.editMessageById
(String messageId, MessageEditData message) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageComponentsById
(long messageId, Collection<? extends LayoutComponent> components) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageComponentsById
(long messageId, LayoutComponent... components) Edit an existing message sent by this webhook.editMessageComponentsById
(String messageId, Collection<? extends LayoutComponent> components) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageComponentsById
(String messageId, LayoutComponent... components) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageEmbedsById
(long messageId, Collection<? extends MessageEmbed> embeds) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageEmbedsById
(long messageId, MessageEmbed... embeds) Edit an existing message sent by this webhook.editMessageEmbedsById
(String messageId, Collection<? extends MessageEmbed> embeds) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageEmbedsById
(String messageId, MessageEmbed... embeds) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageFormatById
(long messageId, String format, Object... args) Edit an existing message sent by this webhook.default WebhookMessageEditAction<T>
editMessageFormatById
(String messageId, String format, Object... args) Edit an existing message sent by this webhook.sendFiles
(Collection<? extends FileUpload> files) Send a message to this webhook.default WebhookMessageCreateAction<T>
sendFiles
(FileUpload... files) Send a message to this webhook.sendMessage
(String content) Send a message to this webhook.sendMessage
(MessageCreateData message) Send a message to this webhook.sendMessageComponents
(Collection<? extends LayoutComponent> components) Send a message to this webhook.default WebhookMessageCreateAction<T>
sendMessageComponents
(LayoutComponent component, LayoutComponent... other) Send a message to this webhook.sendMessageEmbeds
(Collection<? extends MessageEmbed> embeds) Send a message to this webhook.default WebhookMessageCreateAction<T>
sendMessageEmbeds
(MessageEmbed embed, MessageEmbed... embeds) Send a message to this webhook.default WebhookMessageCreateAction<T>
sendMessageFormat
(String format, Object... args) Send a message to this webhook.
-
Method Details
-
sendMessage
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.MESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filter
- Parameters:
content
- The message content- Returns:
WebhookMessageCreateAction
- Throws:
IllegalArgumentException
- If the content is null or longer thanMessage.MAX_CONTENT_LENGTH
characters
-
sendMessage
@Nonnull @CheckReturnValue WebhookMessageCreateAction<T> sendMessage(@Nonnull MessageCreateData 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.MESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filter
- Parameters:
message
- TheMessageCreateData
to send- Returns:
WebhookMessageCreateAction
- Throws:
IllegalArgumentException
- If null is provided- See Also:
-
sendMessageFormat
@Nonnull @CheckReturnValue default WebhookMessageCreateAction<T> sendMessageFormat(@Nonnull String format, @Nonnull 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.MESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filter
- Parameters:
format
- Format string for the message contentargs
- Format arguments for the content- Returns:
WebhookMessageCreateAction
- Throws:
IllegalArgumentException
- If the format string is null or the resulting content is longer thanMessage.MAX_CONTENT_LENGTH
characters
-
sendMessageEmbeds
@Nonnull @CheckReturnValue WebhookMessageCreateAction<T> sendMessageEmbeds(@Nonnull 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.MESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filter
Example: Attachment Images
// Make a file upload instance which refers to a local file called "myFile.png" // The second parameter "image.png" is the filename we tell discord to use for the attachment FileUpload file = FileUpload.fromData(new File("myFile.png"), "image.png"); // Build a message embed which refers to this attachment by the given name. // Note that this must be the same name as configured for the attachment, not your local filename. MessageEmbed embed = new EmbedBuilder() .setDescription("This is my cute cat :)") .setImage("attachment://image.png") // refer to the file by using the "attachment://" schema with the filename we gave it above .build(); webhook.sendMessageEmbeds(Collections.singleton(embed)) // send the embeds .addFiles(file) // add the file as attachment .queue();
- Parameters:
embeds
-MessageEmbeds
to use (up to 10)- Returns:
WebhookMessageCreateAction
- Throws:
IllegalArgumentException
- If any of the embeds are null, more than 10, or longer thanMessageEmbed.EMBED_MAX_LENGTH_BOT
.
-
sendMessageEmbeds
@Nonnull @CheckReturnValue default WebhookMessageCreateAction<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.MESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filter
Example: Attachment Images
// Make a file upload instance which refers to a local file called "myFile.png" // The second parameter "image.png" is the filename we tell discord to use for the attachment FileUpload file = FileUpload.fromData(new File("myFile.png"), "image.png"); // Build a message embed which refers to this attachment by the given name. // Note that this must be the same name as configured for the attachment, not your local filename. MessageEmbed embed = new EmbedBuilder() .setDescription("This is my cute cat :)") .setImage("attachment://image.png") // refer to the file by using the "attachment://" schema with the filename we gave it above .build(); webhook.sendMessageEmbeds(embed) // send the embed .addFiles(file) // add the file as attachment .queue();
- Parameters:
embed
-MessageEmbed
to useembeds
- AdditionalMessageEmbeds
to use (up to 10 in total)- Returns:
WebhookMessageCreateAction
- Throws:
IllegalArgumentException
- If any of the embeds are null, more than 10, or longer thanMessageEmbed.EMBED_MAX_LENGTH_BOT
.
-
sendMessageComponents
@Nonnull @CheckReturnValue WebhookMessageCreateAction<T> sendMessageComponents(@Nonnull Collection<? extends LayoutComponent> components) 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.MESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filter
- Parameters:
components
-LayoutComponents
to use (up to 5)- Returns:
WebhookMessageCreateAction
- Throws:
IllegalArgumentException
- If any of the components are null or more than 5 component layouts are provided
-
sendMessageComponents
@Nonnull @CheckReturnValue default WebhookMessageCreateAction<T> sendMessageComponents(@Nonnull LayoutComponent component, @Nonnull LayoutComponent... other) 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.MESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filter
- Parameters:
component
-LayoutComponent
to useother
- AdditionalLayoutComponents
to use (up to 5 in total)- Returns:
WebhookMessageCreateAction
- Throws:
IllegalArgumentException
- If any of the components are null or more than 5 component layouts are provided
-
sendFiles
@Nonnull @CheckReturnValue WebhookMessageCreateAction<T> sendFiles(@Nonnull Collection<? extends FileUpload> files) Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Resource Handling Note: Once the request is handed off to the requester, for example when you call
RestAction.queue()
, the requester will automatically clean up all opened files by itself. You are only responsible to close them yourself if it is never handed off properly. For instance, if an exception occurs after usingFileUpload.fromData(File)
, before callingRestAction.queue()
. You can safely use a try-with-resources to handle this, sinceFileUpload.close()
becomes ineffective once the request is handed off.Example: Attachment Images
// Make a file upload instance which refers to a local file called "myFile.png" // The second parameter "image.png" is the filename we tell discord to use for the attachment FileUpload file = FileUpload.fromData(new File("myFile.png"), "image.png"); // Build a message embed which refers to this attachment by the given name. // Note that this must be the same name as configured for the attachment, not your local filename. MessageEmbed embed = new EmbedBuilder() .setDescription("This is my cute cat :)") .setImage("attachment://image.png") // refer to the file by using the "attachment://" schema with the filename we gave it above .build(); webhook.sendFiles(Collections.singleton(file)) // send the file upload .addEmbeds(embed) // add the embed you want to reference the file with .queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.MESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filterREQUEST_ENTITY_TOO_LARGE
If the total sum of uploaded bytes exceeds the guild'supload limit
- Parameters:
files
- TheFileUploads
to attach to the message- Returns:
WebhookMessageCreateAction
- Throws:
IllegalArgumentException
- If null is provided- See Also:
-
sendFiles
@Nonnull @CheckReturnValue default WebhookMessageCreateAction<T> sendFiles(@Nonnull FileUpload... files) Send a message to this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Resource Handling Note: Once the request is handed off to the requester, for example when you call
RestAction.queue()
, the requester will automatically clean up all opened files by itself. You are only responsible to close them yourself if it is never handed off properly. For instance, if an exception occurs after usingFileUpload.fromData(File)
, before callingRestAction.queue()
. You can safely use a try-with-resources to handle this, sinceFileUpload.close()
becomes ineffective once the request is handed off.Example: Attachment Images
// Make a file upload instance which refers to a local file called "myFile.png" // The second parameter "image.png" is the filename we tell discord to use for the attachment FileUpload file = FileUpload.fromData(new File("myFile.png"), "image.png"); // Build a message embed which refers to this attachment by the given name. // Note that this must be the same name as configured for the attachment, not your local filename. MessageEmbed embed = new EmbedBuilder() .setDescription("This is my cute cat :)") .setImage("attachment://image.png") // refer to the file by using the "attachment://" schema with the filename we gave it above .build(); webhook.sendFiles(file) // send the file upload .addEmbeds(embed) // add the embed you want to reference the file with .queue();
Possible
ErrorResponses
include:UNKNOWN_WEBHOOK
The webhook is no longer available, either it was deleted or in case of interactions it expired.MESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filterREQUEST_ENTITY_TOO_LARGE
If the total sum of uploaded bytes exceeds the guild'supload limit
- Parameters:
files
- TheFileUploads
to attach to the message- Returns:
WebhookMessageCreateAction
- Throws:
IllegalArgumentException
- If null is provided- See Also:
-
editMessageById
@Nonnull @CheckReturnValue WebhookMessageEditAction<T> editMessageById(@Nonnull String messageId, @Nonnull 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If the provided content is null or longer thanMessage.MAX_CONTENT_LENGTH
characters
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageById(long messageId, @Nonnull 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If the provided content is null or longer thanMessage.MAX_CONTENT_LENGTH
characters
-
editMessageById
@Nonnull @CheckReturnValue WebhookMessageEditAction<T> editMessageById(@Nonnull String messageId, @Nonnull MessageEditData 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
- TheMessageEditData
containing the update information- Returns:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If the provided message is null- See Also:
-
editMessageById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageById(long messageId, MessageEditData 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
- TheMessageEditData
containing the update information- Returns:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If the provided message is null- See Also:
-
editMessageFormatById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageFormatById(@Nonnull String messageId, @Nonnull String format, @Nonnull 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If the formatted string is null or longer thanMessage.MAX_CONTENT_LENGTH
characters
-
editMessageFormatById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageFormatById(long messageId, @Nonnull String format, @Nonnull 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If the formatted string is null or longer thanMessage.MAX_CONTENT_LENGTH
characters
-
editMessageEmbedsById
@Nonnull @CheckReturnValue WebhookMessageEditAction<T> editMessageEmbedsById(@Nonnull String messageId, @Nonnull 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If null or more than 10 embeds are provided
-
editMessageEmbedsById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageEmbedsById(long messageId, @Nonnull 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If null or more than 10 embeds are provided
-
editMessageEmbedsById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageEmbedsById(@Nonnull 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If null or more than 10 embeds are provided
-
editMessageEmbedsById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
- If null or more than 10 embeds are provided
-
editMessageComponentsById
@Nonnull @CheckReturnValue WebhookMessageEditAction<T> editMessageComponentsById(@Nonnull String messageId, @Nonnull Collection<? extends LayoutComponent> 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
-- If
null
is provided - If any of the components is not
message compatible
- If more than 5 component layouts are provided
- If
-
editMessageComponentsById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageComponentsById(long messageId, @Nonnull Collection<? extends LayoutComponent> 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
-- If
null
is provided - If any of the components is not
message compatible
- If more than 5 component layouts are provided
- If
-
editMessageComponentsById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageComponentsById(@Nonnull String messageId, @Nonnull LayoutComponent... 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
-- If
null
is provided - If any of the components is not
message compatible
- If more than 5 component layouts are provided
- If
-
editMessageComponentsById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageComponentsById(long messageId, @Nonnull LayoutComponent... 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:
WebhookMessageEditAction
- Throws:
IllegalArgumentException
-- If
null
is provided - If any of the components is not
message compatible
- If more than 5 component layouts are provided
- If
-
editMessageAttachmentsById
@Nonnull @CheckReturnValue WebhookMessageEditAction<T> editMessageAttachmentsById(@Nonnull String messageId, @Nonnull Collection<? extends AttachedFile> attachments) Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Resource Handling Note: Once the request is handed off to the requester, for example when you call
RestAction.queue()
, the requester will automatically clean up all opened files by itself. You are only responsible to close them yourself if it is never handed off properly. For instance, if an exception occurs after usingFileUpload.fromData(File)
, before callingRestAction.queue()
. You can safely use a try-with-resources to handle this, sinceFileUpload.close()
becomes ineffective once the request is handed off.- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.attachments
- The new attachments of the message (Can beFileUploads
orAttachmentUpdates
)- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If null is provided- See Also:
-
editMessageAttachmentsById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageAttachmentsById(@Nonnull String messageId, @Nonnull AttachedFile... attachments) Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Resource Handling Note: Once the request is handed off to the requester, for example when you call
RestAction.queue()
, the requester will automatically clean up all opened files by itself. You are only responsible to close them yourself if it is never handed off properly. For instance, if an exception occurs after usingFileUpload.fromData(File)
, before callingRestAction.queue()
. You can safely use a try-with-resources to handle this, sinceFileUpload.close()
becomes ineffective once the request is handed off.- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.attachments
- The new attachments of the message (Can beFileUploads
orAttachmentUpdates
)- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If null is provided- See Also:
-
editMessageAttachmentsById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageAttachmentsById(long messageId, @Nonnull Collection<? extends AttachedFile> attachments) Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Resource Handling Note: Once the request is handed off to the requester, for example when you call
RestAction.queue()
, the requester will automatically clean up all opened files by itself. You are only responsible to close them yourself if it is never handed off properly. For instance, if an exception occurs after usingFileUpload.fromData(File)
, before callingRestAction.queue()
. You can safely use a try-with-resources to handle this, sinceFileUpload.close()
becomes ineffective once the request is handed off.- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.attachments
- The new attachments of the message (Can beFileUploads
orAttachmentUpdates
)- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If null is provided- See Also:
-
editMessageAttachmentsById
@Nonnull @CheckReturnValue default WebhookMessageEditAction<T> editMessageAttachmentsById(long messageId, @Nonnull AttachedFile... attachments) Edit an existing message sent by this webhook.If this is an
InteractionHook
this method will be delayed until the interaction is acknowledged.Resource Handling Note: Once the request is handed off to the requester, for example when you call
RestAction.queue()
, the requester will automatically clean up all opened files by itself. You are only responsible to close them yourself if it is never handed off properly. For instance, if an exception occurs after usingFileUpload.fromData(File)
, before callingRestAction.queue()
. You can safely use a try-with-resources to handle this, sinceFileUpload.close()
becomes ineffective once the request is handed off.- Parameters:
messageId
- The message id. For interactions this supports"@original"
to edit the source message of the interaction.attachments
- The new attachments of the message (Can beFileUploads
orAttachmentUpdates
)- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If null is provided- See Also:
-
deleteMessageById
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:
IllegalArgumentException
- If the provided message id is null or not a valid snowflake
-
deleteMessageById
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
-