Interface ReplyCallbackAction
- All Superinterfaces:
AllowedMentions<ReplyCallbackAction>
,InteractionCallbackAction<InteractionHook>
,RestAction<InteractionHook>
public interface ReplyCallbackAction
extends InteractionCallbackAction<InteractionHook>, AllowedMentions<ReplyCallbackAction>
A
You can use
InteractionCallbackAction
which can be used to send a message reply for an interaction.
You can use
setEphemeral(boolean)
to hide this message from other users.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.requests.restaction.interactions.InteractionCallbackAction
InteractionCallbackAction.ResponseType
-
Method Summary
Modifier and TypeMethodDescriptiondefault ReplyCallbackAction
addActionRow
(Collection<? extends ItemComponent> components) Add a singleActionRow
to the message.default ReplyCallbackAction
addActionRow
(ItemComponent... components) Add a singleActionRow
to the message.default ReplyCallbackAction
addActionRows
(Collection<? extends ActionRow> rows) AddActionRows
to the message.addActionRows
(ActionRow... rows) AddActionRows
to the message.addEmbeds
(Collection<? extends MessageEmbed> embeds) AddMessageEmbeds
for the messagedefault ReplyCallbackAction
addEmbeds
(MessageEmbed... embeds) AddMessageEmbeds
for the messagedefault ReplyCallbackAction
addFile
(byte[] data, String name, AttachmentOption... options) Adds the providedbyte[]
as file data.default ReplyCallbackAction
addFile
(File file, String name, AttachmentOption... options) Adds the providedFile
.default ReplyCallbackAction
addFile
(File file, AttachmentOption... options) Adds the providedFile
.addFile
(InputStream data, String name, AttachmentOption... options) Adds the providedInputStream
as file data.deadline
(long timestamp) Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.setCheck
(BooleanSupplier checks) Sets the last-second checks before finally executing the http request in the queue.setContent
(String content) Set the content for this message.setEphemeral
(boolean ephemeral) Set whether this message should be visible to other users.setTTS
(boolean isTTS) Enable/Disable Text-To-Speech for the resulting message.Timeout for this RestAction instance.Methods inherited from interface net.dv8tion.jda.api.utils.AllowedMentions
allowedMentions, mention, mention, mentionRepliedUser, mentionRoles, mentionRoles, mentionUsers, mentionUsers
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Method Details
-
setCheck
Description copied from interface:RestAction
Sets the last-second checks before finally executing the http request in the queue.
If the provided supplier evaluates tofalse
or throws an exception this will not be finished. When an exception is thrown from the supplier it will be provided to the failure callback.- Specified by:
setCheck
in interfaceRestAction<InteractionHook>
- Parameters:
checks
- The checks to run before executing the request, ornull
to run no checks- Returns:
- The current RestAction for chaining convenience
- See Also:
-
timeout
Description copied from interface:RestAction
Timeout for this RestAction instance.
If the request doesn't get executed within the timeout it will fail.When a RestAction times out, it will fail with a
TimeoutException
. This is the same asdeadline(System.currentTimeMillis() + unit.toMillis(timeout))
.Example
action.timeout(10, TimeUnit.SECONDS) // 10 seconds from now .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
- Specified by:
timeout
in interfaceRestAction<InteractionHook>
- Parameters:
timeout
- The timeout to useunit
-Unit
for the timeout value- Returns:
- The same RestAction instance with the applied timeout
- See Also:
-
deadline
Description copied from interface:RestAction
Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.
If the deadline is reached, the request will fail with aTimeoutException
.This does not mean that the request will immediately timeout when the deadline is reached. JDA will check the deadline right before executing the request or within intervals in a worker thread. This only means the request will timeout if the deadline has passed.
Example
action.deadline(System.currentTimeMillis() + 10000) // 10 seconds from now .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
- Specified by:
deadline
in interfaceRestAction<InteractionHook>
- Parameters:
timestamp
- Millisecond timestamp at which the request will timeout- Returns:
- The same RestAction with the applied deadline
- See Also:
-
addEmbeds
AddMessageEmbeds
for the message- Parameters:
embeds
- The message embeds to add- Returns:
- The same reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, or one of the embeds is too big
-
addEmbeds
@Nonnull @CheckReturnValue ReplyCallbackAction addEmbeds(@Nonnull Collection<? extends MessageEmbed> embeds) AddMessageEmbeds
for the message- Parameters:
embeds
- The message embeds to add- Returns:
- The same reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, or one of the embeds is too big
-
addActionRow
@Nonnull @CheckReturnValue default ReplyCallbackAction addActionRow(@Nonnull ItemComponent... components) Add a singleActionRow
to the message.- Parameters:
components
- The components for this action row- Returns:
- The same reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, an invalid number of components is provided, or any customid
is duplicated- See Also:
-
addActionRow
@Nonnull @CheckReturnValue default ReplyCallbackAction addActionRow(@Nonnull Collection<? extends ItemComponent> components) Add a singleActionRow
to the message.- Parameters:
components
- The components for this action row- Returns:
- The same reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, an invalid number of components is provided, or any customid
is duplicated- See Also:
-
addActionRows
@Nonnull @CheckReturnValue default ReplyCallbackAction addActionRows(@Nonnull Collection<? extends ActionRow> rows) AddActionRows
to the message.- Parameters:
rows
- The action rows to add- Returns:
- The same reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, more than 5 action rows are provided, or any customid
is duplicated
-
addActionRows
AddActionRows
to the message.- Parameters:
rows
- The action rows to add- Returns:
- The same reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, more than 5 action rows are provided, or any customid
is duplicated
-
setContent
Set the content for this message.- Parameters:
content
- The new message content or null to unset- Returns:
- The same reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If the provided content is longer thanMAX_CONTENT_LENGTH
characters
-
setTTS
Enable/Disable Text-To-Speech for the resulting message.- Parameters:
isTTS
- True, if this should cause a Text-To-Speech effect when sent to the channel- Returns:
- The same reply action, for chaining convenience
-
setEphemeral
Set whether this message should be visible to other users.
When a message is ephemeral, it will only be visible to the user that used the interaction.Ephemeral messages have some limitations and will be removed once the user restarts their client.
Limitations:- Cannot be deleted by the bot
- Cannot contain any files/attachments
- Cannot be reacted to
- Cannot be retrieved
- Parameters:
ephemeral
- True, if this message should be invisible for other users- Returns:
- The same reply action, for chaining convenience
-
addFile
@Nonnull @CheckReturnValue default ReplyCallbackAction addFile(@Nonnull File file, @Nonnull AttachmentOption... options) Adds the providedFile
.
The stream will be closed upon execution!
The provided file will be appended to the message.- Parameters:
file
- TheFile
data to upload in response to the interaction.options
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
- The same reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If the provided file isnull
.
-
addFile
@Nonnull @CheckReturnValue default ReplyCallbackAction addFile(@Nonnull File file, @Nonnull String name, @Nonnull AttachmentOption... options) Adds the providedFile
.
The stream will be closed upon execution!
The provided file will be appended to 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 in response to the interaction.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 reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If the provided file or filename isnull
.
- The file name provided is the name that is found in
-
addFile
@Nonnull @CheckReturnValue default ReplyCallbackAction addFile(@Nonnull byte[] data, @Nonnull 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.- Parameters:
data
- Thebyte[]
data to upload in response to the interaction.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 reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If the provided data or filename isnull
.
-
addFile
@Nonnull @CheckReturnValue ReplyCallbackAction addFile(@Nonnull InputStream data, @Nonnull 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.- Parameters:
data
- The InputStream data to upload in response to the interaction.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 reply action, for chaining convenience
- Throws:
IllegalArgumentException
- If the provided data or filename isnull
.
-