Interface ResolvedMedia

All Known Implementing Classes:
ResolvedMediaImpl

public interface ResolvedMedia
A media resolved by Discord including some metadata, typically comes from V2 Components.
  • Method Summary

    Modifier and Type
    Method
    Description
    The ID of the attachment represented by this resolved media, may return null if this media was created from an external link.
    default Long
    The ID of the attachment represented by this resolved media, may return null if this media was created from an external link.
    The media type, if available, or null.
    int
    The height of this media, if available, or 0.
    An AttachmentProxy for this media.
    The URL of this media, proxied by Discord's CDN.
    The URL of this media, for locally-uploaded files, this will always be a URL from Discord's CDN, in other cases it may be an external URL.
    int
    The width of this media, if available, or 0.
  • Method Details

    • getAttachmentId

      @Nullable String getAttachmentId()
      The ID of the attachment represented by this resolved media, may return null if this media was created from an external link.
      Returns:
      The ID of the attachment, or null
    • getAttachmentIdLong

      @Nullable default Long getAttachmentIdLong()
      The ID of the attachment represented by this resolved media, may return null if this media was created from an external link.
      Returns:
      The ID of the attachment, or null
    • getUrl

      @Nonnull String getUrl()
      The URL of this media, for locally-uploaded files, this will always be a URL from Discord's CDN, in other cases it may be an external URL.

      If you want to download the file, you should use getProxy().

      Returns:
      The URL of this media
    • getProxyUrl

      @Nonnull String getProxyUrl()
      The URL of this media, proxied by Discord's CDN.

      This URL may be invalid if the media failed to load.

      If you want to download the file, you should use getProxy().

      Returns:
      The proxy URL of this media
    • getProxy

      An AttachmentProxy for this media.
      This allows you to easily download the media.

      This proxy may not be usable if the media failed to load.

      Returns:
      The AttachmentProxy of this media
    • getWidth

      int getWidth()
      The width of this media, if available, or 0.

      This may be 0 if the media failed to load.

      Returns:
      Width of this media, or 0
    • getHeight

      int getHeight()
      The height of this media, if available, or 0.

      This may be 0 if the media failed to load.

      Returns:
      Height of this media, or 0
    • getContentType

      @Nullable String getContentType()
      The media type, if available, or null.

      This may be absent if the media failed to load.

      Returns:
      The media type, or null