Class EmbedCreateSpec

  • All Implemented Interfaces:
    Spec<discord4j.discordjson.json.EmbedData>

    public class EmbedCreateSpec
    extends Object
    implements Spec<discord4j.discordjson.json.EmbedData>
    A spec used to configure and send an embed.
    See Also:
    Embed Layout
    • Constructor Detail

      • EmbedCreateSpec

        public EmbedCreateSpec()
    • Method Detail

      • setTitle

        public EmbedCreateSpec setTitle​(String title)
        Sets the title of the embed.
        Parameters:
        title - The title of the embed.
        Returns:
        This spec.
      • setDescription

        public EmbedCreateSpec setDescription​(String description)
        Sets the description of the embed.
        Parameters:
        description - The description of the embed.
        Returns:
        This spec.
      • setUrl

        public EmbedCreateSpec setUrl​(String url)
        Sets the URL of the embed.
        Parameters:
        url - A URL which can be clicked on through the title of the embed.
        Returns:
        This spec.
      • setTimestamp

        public EmbedCreateSpec setTimestamp​(Instant timestamp)
        Sets the timestamp to display in the embed. The timestamp is displayed locally for each user's timezone.
        Parameters:
        timestamp - A Instant to display in the embed footer.
        Returns:
        This spec.
      • setColor

        public EmbedCreateSpec setColor​(Color color)
        Sets the color of the embed.
        Parameters:
        color - A Color to display on the embed.
        Returns:
        This spec.
      • setFooter

        public EmbedCreateSpec setFooter​(String text,
                                         @Nullable
                                         String iconUrl)
        Sets the footer of the embed.
        Parameters:
        text - The footer text.
        iconUrl - An icon URL to display in the footer.
        Returns:
        This spec.
      • setImage

        public EmbedCreateSpec setImage​(String url)
        Sets the image of the embed.
        Parameters:
        url - An image URL.
        Returns:
        This spec.
      • setThumbnail

        public EmbedCreateSpec setThumbnail​(String url)
        Sets the thumbnail of the embed.
        Parameters:
        url - An image URL.
        Returns:
        This spec.
      • setAuthor

        public EmbedCreateSpec setAuthor​(String name,
                                         @Nullable
                                         String url,
                                         @Nullable
                                         String iconUrl)
        Sets the author section of the embed.
        Parameters:
        name - The author name to display.
        url - A URL which can be clicked on through the author name.
        iconUrl - An icon URL displayed as the avatar next to the author name.
        Returns:
        This spec.
      • addField

        public EmbedCreateSpec addField​(String name,
                                        String value,
                                        boolean inline)
        Adds a field to the embed.
        Parameters:
        name - The name of the field.
        value - The text inside of the field.
        inline - Whether to inline the field or not.
        Returns:
        This spec.
      • asRequest

        public discord4j.discordjson.json.EmbedData asRequest()
        Specified by:
        asRequest in interface Spec<discord4j.discordjson.json.EmbedData>