Class YReplyCallback
- Direct Known Subclasses:
YCommandInteractionPayload
-
Constructor Summary
ConstructorsConstructorDescriptionYReplyCallback(net.dv8tion.jda.api.interactions.callbacks.IReplyCallback callback) -
Method Summary
Modifier and TypeMethodDescription@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionAcknowledge this interaction and defer the reply to a later time.@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActiondeferReply(boolean ephemeral) Acknowledge this interaction and defer the reply to a later time.net.dv8tion.jda.api.interactions.callbacks.IReplyCallback@NotNull net.dv8tion.jda.api.interactions.InteractionHookgetHook()@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionReply to this interaction and acknowledge it.@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionreply(@NotNull net.dv8tion.jda.api.entities.Message message) Reply to this interaction and acknowledge it.@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionreplyEmbeds(@NotNull Collection<? extends net.dv8tion.jda.api.entities.MessageEmbed> embeds) Reply to this interaction and acknowledge it.@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionreplyEmbeds(@NotNull net.dv8tion.jda.api.entities.MessageEmbed embed, @NotNull net.dv8tion.jda.api.entities.MessageEmbed... embeds) Reply to this interaction and acknowledge it.@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionreplyFile(byte @NotNull [] data, @NotNull String name, @NotNull net.dv8tion.jda.api.utils.AttachmentOption... options) Reply to this interaction and acknowledge it.@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionreplyFile(@NotNull File file, @NotNull String name, @NotNull net.dv8tion.jda.api.utils.AttachmentOption... options) Reply to this interaction and acknowledge it.@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionReply to this interaction and acknowledge it.@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionreplyFile(@NotNull InputStream data, @NotNull String name, @NotNull net.dv8tion.jda.api.utils.AttachmentOption... options) Reply to this interaction and acknowledge it.@NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackActionreplyFormat(@NotNull String format, @NotNull Object... args) Reply to this interaction and acknowledge it.voidreplyQueuedEmbed(net.dv8tion.jda.api.entities.MessageEmbed messageEmbed) replays as an embed message.voidreplyQueuedEphemeral(String message) replays as an ephemeral message.voidreplyQueuedEphemeralEmbed(net.dv8tion.jda.api.entities.MessageEmbed messageEmbed) voidreplyQueuedMessage(String message)
-
Constructor Details
-
YReplyCallback
public YReplyCallback(net.dv8tion.jda.api.interactions.callbacks.IReplyCallback callback)
-
-
Method Details
-
getCallback
public net.dv8tion.jda.api.interactions.callbacks.IReplyCallback getCallback() -
deferReply
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction deferReply()Acknowledge this interaction and defer the reply to a later time.
This will send a<Bot> is thinking...message in chat that will be updated later through eitherInteractionHook.editOriginal(String)orWebhookClient.sendMessage(String).You can use
deferReply(true)to send a deferred ephemeral reply. If your initial deferred message is not ephemeral it cannot be made ephemeral later. Your first message to theInteractionHookwill inherit whether the message is ephemeral or not from this deferred reply.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.Use
reply(String)to reply directly.- Returns:
ReplyCallbackAction
-
deferReply
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction deferReply(boolean ephemeral) Acknowledge this interaction and defer the reply to a later time.
This will send a<Bot> is thinking...message in chat that will be updated later through eitherInteractionHook.editOriginal(String)orWebhookClient.sendMessage(String).You can use
deferReply()ordeferReply(false)to send a non-ephemeral deferred reply. If your initial deferred message is ephemeral it cannot be made non-ephemeral later. Your first message to theInteractionHookwill inherit whether the message is ephemeral or not from this deferred reply.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.Use
reply(String)to reply directly.Ephemeral messages have some limitations and will be removed once the user restarts their client.
When a message is ephemeral, it will only be visible to the user that used the interaction.
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 only be visible to the interaction user- Returns:
ReplyCallbackAction
-
reply
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction reply(@NotNull @NotNull net.dv8tion.jda.api.entities.Message message) Reply to this interaction and acknowledge it.
This will send a reply message for this interaction. You can usesetEphemeral(true)to only let the target user see the message. Replies are non-ephemeral by default.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.If your handling can take longer than 3 seconds, due to various rate limits or other conditions, you should use
deferReply()instead.- Parameters:
message- The message to send- Returns:
ReplyCallbackAction- Throws:
IllegalArgumentException- If null is provided
-
reply
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction reply(@NotNull @NotNull String content) Reply to this interaction and acknowledge it.
This will send a reply message for this interaction. You can usesetEphemeral(true)to only let the target user see the message. Replies are non-ephemeral by default.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.If your handling can take longer than 3 seconds, due to various rate limits or other conditions, you should use
deferReply()instead.- Parameters:
content- The message content to send- Returns:
ReplyCallbackAction- Throws:
IllegalArgumentException- If null is provided or the content is empty or longer thanMessage.MAX_CONTENT_LENGTH
-
replyEmbeds
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction replyEmbeds(@NotNull @NotNull Collection<? extends net.dv8tion.jda.api.entities.MessageEmbed> embeds) Reply to this interaction and acknowledge it.
This will send a reply message for this interaction. You can usesetEphemeral(true)to only let the target user see the message. Replies are non-ephemeral by default.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.If your handling can take longer than 3 seconds, due to various rate limits or other conditions, you should use
deferReply()instead.- Parameters:
embeds- TheMessageEmbedsto send- Returns:
ReplyCallbackAction- Throws:
IllegalArgumentException- If null is provided
-
replyEmbeds
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction replyEmbeds(@NotNull @NotNull net.dv8tion.jda.api.entities.MessageEmbed embed, @NotNull @NotNull net.dv8tion.jda.api.entities.MessageEmbed... embeds) Reply to this interaction and acknowledge it.
This will send a reply message for this interaction. You can usesetEphemeral(true)to only let the target user see the message. Replies are non-ephemeral by default.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.If your handling can take longer than 3 seconds, due to various rate limits or other conditions, you should use
deferReply()instead.- Parameters:
embed- The message embed to sendembeds- Any additional embeds to send- Returns:
ReplyCallbackAction- Throws:
IllegalArgumentException- If null is provided
-
replyFormat
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction replyFormat(@NotNull @NotNull String format, @NotNull @NotNull Object... args) Reply to this interaction and acknowledge it.
This will send a reply message for this interaction. You can usesetEphemeral(true)to only let the target user see the message. Replies are non-ephemeral by default.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.If your handling can take longer than 3 seconds, due to various rate limits or other conditions, you should use
deferReply()instead.- Parameters:
format- Format string for the message contentargs- Format arguments for the content- Returns:
ReplyCallbackAction- Throws:
IllegalArgumentException- If the format string is null or the resulting content is longer thanMessage.MAX_CONTENT_LENGTH
-
replyFile
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction replyFile(@NotNull @NotNull InputStream data, @NotNull @NotNull String name, @NotNull @NotNull net.dv8tion.jda.api.utils.AttachmentOption... options) Reply to this interaction and acknowledge it.
This will send a reply message for this interaction. You can usesetEphemeral(true)to only let the target user see the message. Replies are non-ephemeral by default.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.If your handling can take longer than 3 seconds, due to various rate limits or other conditions, you should use
deferReply()instead.Possible
ErrorResponsesinclude:REQUEST_ENTITY_TOO_LARGE
The file exceeds the maximum upload size ofMessage.MAX_FILE_SIZE
- Parameters:
data- The InputStream data to uploadname- The file name that should be sent to discord
Refer to the documentation forreplyFile(File, String, AttachmentOption...)for information about this parameter.options- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
ReplyCallbackAction- Throws:
IllegalArgumentException- If the provided file or filename isnullorempty.
-
replyFile
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction replyFile(@NotNull @NotNull File file, @NotNull @NotNull net.dv8tion.jda.api.utils.AttachmentOption... options) Reply to this interaction and acknowledge it.
This will send a reply message for this interaction. You can usesetEphemeral(true)to only let the target user see the message. Replies are non-ephemeral by default.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.If your handling can take longer than 3 seconds, due to various rate limits or other conditions, you should use
deferReply()instead.This is a shortcut to
replyFile(File, String, AttachmentOption...)by way of usingFile.getName().sendFile(file, file.getName())
Possible
ErrorResponsesinclude:REQUEST_ENTITY_TOO_LARGE
The file exceeds the maximum upload size ofMessage.MAX_FILE_SIZE
- Parameters:
file- TheFiledata to uploadoptions- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
ReplyCallbackAction- Throws:
IllegalArgumentException- If the provided file isnull.
-
replyFile
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction replyFile(@NotNull @NotNull File file, @NotNull @NotNull String name, @NotNull @NotNull net.dv8tion.jda.api.utils.AttachmentOption... options) Reply to this interaction and acknowledge it.
This will send a reply message for this interaction. You can usesetEphemeral(true)to only let the target user see the message. Replies are non-ephemeral by default.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.If your handling can take longer than 3 seconds, due to various rate limits or other conditions, you should use
deferReply()instead.The
nameparameter 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.
Possible
ErrorResponsesinclude:REQUEST_ENTITY_TOO_LARGE
The file exceeds the maximum upload size ofMessage.MAX_FILE_SIZE
- Parameters:
file- TheFiledata to uploadname- The file name that should be sent to discordoptions- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
ReplyCallbackAction- Throws:
IllegalArgumentException- If the provided file or filename isnullorempty.
- The file name provided is the name that is found in
-
replyFile
@NotNull @CheckReturnValue public @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction replyFile(byte @NotNull [] data, @NotNull @NotNull String name, @NotNull @NotNull net.dv8tion.jda.api.utils.AttachmentOption... options) Reply to this interaction and acknowledge it.
This will send a reply message for this interaction. You can usesetEphemeral(true)to only let the target user see the message. Replies are non-ephemeral by default.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.If your handling can take longer than 3 seconds, due to various rate limits or other conditions, you should use
deferReply()instead.Possible
ErrorResponsesinclude:REQUEST_ENTITY_TOO_LARGE
The file exceeds the maximum upload size ofMessage.MAX_FILE_SIZE
- Parameters:
data- Thebyte[]data to uploadname- The file name that should be sent to discord
Refer to the documentation forreplyFile(File, String, AttachmentOption...)for information about this parameter.options- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
ReplyCallbackAction- Throws:
IllegalArgumentException- If the provided file or filename isnullorempty.
-
replyQueuedMessage
-
replyQueuedEphemeral
replays as an ephemeral message. -
replyQueuedEmbed
public void replyQueuedEmbed(@Nonnull net.dv8tion.jda.api.entities.MessageEmbed messageEmbed) replays as an embed message. -
replyQueuedEphemeralEmbed
public void replyQueuedEphemeralEmbed(@Nonnull net.dv8tion.jda.api.entities.MessageEmbed messageEmbed) -
getHook
@NotNull public @NotNull net.dv8tion.jda.api.interactions.InteractionHook getHook()
-