java.lang.Object
io.github.yusufsdiscordbot.yusufsdiscordcore.bot.interaction.YReplyCallback
Direct Known Subclasses:
YCommandInteractionPayload

public class YReplyCallback extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    YReplyCallback(net.dv8tion.jda.api.interactions.callbacks.IReplyCallback callback)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction
    Acknowledge this interaction and defer the reply to a later time.
    @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction
    deferReply(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.InteractionHook
     
    @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction
    reply(@NotNull String content)
    Reply to this interaction and acknowledge it.
    @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction
    reply(@NotNull net.dv8tion.jda.api.entities.Message message)
    Reply to this interaction and acknowledge it.
    @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction
    replyEmbeds(@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.ReplyCallbackAction
    replyEmbeds(@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.ReplyCallbackAction
    replyFile(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.ReplyCallbackAction
    replyFile(@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.ReplyCallbackAction
    replyFile(@NotNull File file, @NotNull net.dv8tion.jda.api.utils.AttachmentOption... options)
    Reply to this interaction and acknowledge it.
    @NotNull net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction
    replyFile(@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.ReplyCallbackAction
    replyFormat(@NotNull String format, @NotNull Object... args)
    Reply to this interaction and acknowledge it.
    void
    replyQueuedEmbed(net.dv8tion.jda.api.entities.MessageEmbed messageEmbed)
    replays as an embed message.
    void
    replays as an ephemeral message.
    void
    replyQueuedEphemeralEmbed(net.dv8tion.jda.api.entities.MessageEmbed messageEmbed)
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 either InteractionHook.editOriginal(String) or WebhookClient.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 the InteractionHook will 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 receive ErrorResponse.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 either InteractionHook.editOriginal(String) or WebhookClient.sendMessage(String).

      You can use deferReply() or deferReply(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 the InteractionHook will 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 receive ErrorResponse.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 use setEphemeral(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 receive ErrorResponse.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 use setEphemeral(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 receive ErrorResponse.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 than Message.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 use setEphemeral(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 receive ErrorResponse.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 - The MessageEmbeds to 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 use setEphemeral(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 receive ErrorResponse.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 send
      embeds - 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 use setEphemeral(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 receive ErrorResponse.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 content
      args - Format arguments for the content
      Returns:
      ReplyCallbackAction
      Throws:
      IllegalArgumentException - If the format string is null or the resulting content is longer than Message.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 use setEphemeral(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 receive ErrorResponse.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 ErrorResponses include:

      • REQUEST_ENTITY_TOO_LARGE
        The file exceeds the maximum upload size of Message.MAX_FILE_SIZE
      Parameters:
      data - The InputStream data to upload
      name - The file name that should be sent to discord
      Refer to the documentation for replyFile(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 is null or empty.
    • 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 use setEphemeral(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 receive ErrorResponse.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 using File.getName().

       sendFile(file, file.getName())
       

      Possible ErrorResponses include:

      • REQUEST_ENTITY_TOO_LARGE
        The file exceeds the maximum upload size of Message.MAX_FILE_SIZE
      Parameters:
      file - The File data to upload
      options - Possible options to apply to this attachment, such as marking it as spoiler image
      Returns:
      ReplyCallbackAction
      Throws:
      IllegalArgumentException - If the provided file is null.
    • 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 use setEphemeral(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 receive ErrorResponse.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 name parameter is used to inform Discord about what the file should be called. This is 2 fold:

      1. 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.
      2. 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 ErrorResponses include:

      • REQUEST_ENTITY_TOO_LARGE
        The file exceeds the maximum upload size of Message.MAX_FILE_SIZE
      Parameters:
      file - The File data to upload
      name - The file name that should be sent to discord
      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 is null or empty.
    • 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 use setEphemeral(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 receive ErrorResponse.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 ErrorResponses include:

      • REQUEST_ENTITY_TOO_LARGE
        The file exceeds the maximum upload size of Message.MAX_FILE_SIZE
      Parameters:
      data - The byte[] data to upload
      name - The file name that should be sent to discord
      Refer to the documentation for replyFile(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 is null or empty.
    • replyQueuedMessage

      public void replyQueuedMessage(@Nonnull String message)
    • replyQueuedEphemeral

      public void replyQueuedEphemeral(@Nonnull String message)
      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()