Interface UpdateInteractionAction

    • Method Detail

      • setContent

        @Nonnull
        UpdateInteractionAction setContent​(@Nullable
                                           java.lang.String content)
        Set the new content for this message.
        Parameters:
        content - The new message content
        Returns:
        The same update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided content is longer than MAX_CONTENT_LENGTH characters
      • setEmbeds

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction setEmbeds​(@Nonnull
                                                  MessageEmbed... embeds)
        Set the MessageEmbeds for the message
        Parameters:
        embeds - The message embeds
        Returns:
        The same update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If null is provided, or one of the embeds is too big
      • setEmbeds

        @Nonnull
        @CheckReturnValue
        UpdateInteractionAction setEmbeds​(@Nonnull
                                          java.util.Collection<? extends MessageEmbed> embeds)
        Set the MessageEmbeds for the message
        Parameters:
        embeds - The message embeds
        Returns:
        The same update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If null is provided, one of the embeds is too big, or more than 10 embeds are provided
      • setActionRows

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction setActionRows​(@Nonnull
                                                      java.util.Collection<? extends ActionRow> rows)
        Set the action rows for the message.
        Parameters:
        rows - The new action rows
        Returns:
        The same update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If null is provided or more than 5 actions rows are provided
      • setActionRows

        @Nonnull
        @CheckReturnValue
        UpdateInteractionAction setActionRows​(@Nonnull
                                              ActionRow... rows)
        Set the action rows for the message.
        Parameters:
        rows - The new action rows
        Returns:
        The same update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If null is provided or more than 5 actions rows are provided
      • setActionRow

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction setActionRow​(@Nonnull
                                                     Component... components)
        Set only one action row for convenience.
        Parameters:
        components - The action row components, such as Buttons
        Returns:
        The same update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If null or an invalid number of components are provided
        See Also:
        ActionRow.of(Component...)
      • setActionRow

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction setActionRow​(@Nonnull
                                                     java.util.Collection<? extends Component> components)
        Set only one action row for convenience.
        Parameters:
        components - The action row components, such as Buttons
        Returns:
        The same update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If null or an invalid number of components are provided
        See Also:
        ActionRow.of(Collection)
      • addFile

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction addFile​(@Nonnull
                                                java.io.File file,
                                                @Nonnull
                                                AttachmentOption... options)
        Adds the provided File.
        The stream will be closed upon execution!
        The provided file will be appended to the message.
        Parameters:
        file - The File 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 update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided file is null.
      • addFile

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction addFile​(@Nonnull
                                                java.io.File file,
                                                @Nonnull
                                                java.lang.String name,
                                                @Nonnull
                                                AttachmentOption... options)
        Adds the provided File.
        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:

        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.
        Parameters:
        file - The File data to upload in response to the interaction.
        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:
        The same update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided file or filename is null.
      • addFile

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction addFile​(@Nonnull
                                                byte[] data,
                                                @Nonnull
                                                java.lang.String name,
                                                @Nonnull
                                                AttachmentOption... options)
        Adds the provided byte[] as file data.
        The stream will be closed upon execution!
        The provided file will be appended to the message.
        Parameters:
        data - The byte[] data to upload in response to the interaction.
        name - The file name that should be sent to discord
        Refer to the documentation for addFile(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 update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided data or filename is null.
      • addFile

        @Nonnull
        @CheckReturnValue
        UpdateInteractionAction addFile​(@Nonnull
                                        java.io.InputStream data,
                                        @Nonnull
                                        java.lang.String name,
                                        @Nonnull
                                        AttachmentOption... options)
        Adds the provided InputStream 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 for addFile(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 update action, for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided data or filename is null.