Interface MessageAttachment

  • All Superinterfaces:
    DiscordEntity


    public interface MessageAttachment
    extends DiscordEntity
    This class represents a message attachment.
    • Method Detail

      • getMessage

        Message getMessage​()
        Gets the message of the attachment.
        Returns:
        The message of the attachment.
      • getFileName

        String getFileName​()
        Gets the file name of the attachment.
        Returns:
        The file name of the attachment.
      • getSize

        int getSize​()
        Gets the size of the attachment in bytes.
        Returns:
        The size of the attachment in bytes.
      • getUrl

        URL getUrl​()
        Gets the url of the attachment.
        Returns:
        The url of the attachment.
      • getProxyUrl

        URL getProxyUrl​()
        Gets the proxy url of the attachment.
        Returns:
        The proxy url of the attachment.
      • isImage

        default boolean isImage​()
        Checks if the attachment is an image.
        Returns:
        Whether the attachment is an image or not.
      • getHeight

        Optional<Integer> getHeight​()
        Gets the height of the attachment, if it's an image.
        Returns:
        The height of the attachment.
      • getWidth

        Optional<Integer> getWidth​()
        Gets the width of the attachment, if it's an image.
        Returns:
        The width of the attachment.
      • downloadAsByteArray

        CompletableFuture<byte[]> downloadAsByteArray​()
        Gets the attachment as byte array.
        Returns:
        The attachment as byte array.
      • isSpoiler

        default boolean isSpoiler​()
        Checks whether the attachment is marked as a spoiler.

        Discord encodes the information on whether a file is considered a spoiler in the file name. Any file whose filename starts with SPOILER_ is considered a spoiler.

        Returns:
        The spoiler status.