Interface MessageEditCallbackAction

    • Method Detail

      • addFile

        @Nonnull
        @CheckReturnValue
        default MessageEditCallbackAction addFile​(@Nonnull
                                                  File file,
                                                  @Nonnull
                                                  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:
        IllegalArgumentException - If the provided file or filename is null.
      • retainFilesById

        @Nonnull
        @CheckReturnValue
        MessageEditCallbackAction retainFilesById​(@Nonnull
                                                  Collection<String> ids)
        Removes all attachments that are currently attached to the existing message except for the ones provided.
        For example retainFilesById(Arrays.asList("123")) would remove all attachments except for the one with the id 123.

        To remove all attachments from the message you can pass an empty list.

        Parameters:
        ids - The ids for the attachments which should be retained on the message
        Returns:
        The same update action, for chaining convenience
        Throws:
        IllegalArgumentException - If any of the ids is null or not a valid snowflake
      • retainFilesById

        @Nonnull
        @CheckReturnValue
        default MessageEditCallbackAction retainFilesById​(@Nonnull
                                                          String... ids)
        Removes all attachments that are currently attached to the existing message except for the ones provided.
        For example retainFilesById(Arrays.asList("123")) would remove all attachments except for the one with the id 123.

        To remove all attachments from the message you can pass an empty list.

        Parameters:
        ids - The ids for the attachments which should be retained on the message
        Returns:
        The same update action, for chaining convenience
        Throws:
        IllegalArgumentException - If any of the ids is null or not a valid snowflake
      • retainFilesById

        @Nonnull
        @CheckReturnValue
        default MessageEditCallbackAction retainFilesById​(long... ids)
        Removes all attachments that are currently attached to the existing message except for the ones provided.
        For example retainFilesById(Arrays.asList("123")) would remove all attachments except for the one with the id 123.

        To remove all attachments from the message you can pass an empty list.

        Parameters:
        ids - The ids for the attachments which should be retained on the message
        Returns:
        The same update action, for chaining convenience
        Throws:
        IllegalArgumentException - If any of the ids is null or not a valid snowflake
      • retainFiles

        @Nonnull
        @CheckReturnValue
        default MessageEditCallbackAction retainFiles​(@Nonnull
                                                      Collection<? extends Message.Attachment> attachments)
        Removes all attachments that are currently attached to the existing message except for the ones provided.
        For example retainFiles(message.getAttachments().subList(1, message.getAttachments().size())) would only remove the first attachment from the message.

        To remove all attachments from the message you can pass an empty list.

        Parameters:
        attachments - The attachments which should be retained on the message
        Returns:
        The same update action, for chaining convenience
        Throws:
        IllegalArgumentException - If any of the ids is null or not a valid snowflake
      • retainFiles

        @Nonnull
        @CheckReturnValue
        default MessageEditCallbackAction retainFiles​(@Nonnull
                                                      Message.Attachment... attachments)
        Removes all attachments that are currently attached to the existing message except for the ones provided.
        For example retainFiles(message.getAttachments().subList(1, message.getAttachments().size())) would only remove the first attachment from the message.

        To remove all attachments from the message you can pass an empty list.

        Parameters:
        attachments - The attachments which should be retained on the message
        Returns:
        The same update action, for chaining convenience
        Throws:
        IllegalArgumentException - If any of the ids is null or not a valid snowflake