Class Attachment

    • Field Detail

      • SPOILER_PREFIX

        public static final String SPOILER_PREFIX
        The prefix of the name of files which are displayed as spoilers.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Attachment

        public Attachment​(GatewayDiscordClient gateway,
                          discord4j.discordjson.json.AttachmentData data)
        Constructs an Attachment with an associated GatewayDiscordClient and Discord data.
        Parameters:
        gateway - The GatewayDiscordClient associated to this object, must be non-null.
        data - The raw data as represented by Discord, must be non-null.
    • Method Detail

      • getId

        public Snowflake getId()
        Description copied from interface: Entity
        Gets the Snowflake that uniquely identifies this entity.
        Specified by:
        getId in interface Entity
        Returns:
        The Snowflake that uniquely identifies this entity.
      • getData

        public discord4j.discordjson.json.AttachmentData getData()
        Gets the data of the attachment.
        Returns:
        The data of the attachment.
      • getFilename

        public String getFilename()
        Gets the name of the file attached.
        Returns:
        The name of the file attached.
      • getSize

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

        public String getUrl()
        Gets the source URL of the file.
        Returns:
        The source URL of the file.
      • getProxyUrl

        public String getProxyUrl()
        Gets a proxied URL of the file.
        Returns:
        A proxied URL of the file.
      • getHeight

        public OptionalInt getHeight()
        Gets the height of the file, if present.
        Returns:
        The height of the file, if present.
      • getWidth

        public OptionalInt getWidth()
        Gets the width of the file, if present.
        Returns:
        The width of the file, if present.
      • isSpoiler

        public boolean isSpoiler()
        Gets whether the attachment is a spoiler.
        Returns:
        true if the attachment is a spoiler, false otherwise.
      • getContentType

        public Optional<String> getContentType()
        Gets the attachment's media type, if present.
        Returns:
        The attachment's media type, if present.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object