Package discord4j.core.spec.legacy
Class LegacyEmbedCreateSpec
- java.lang.Object
-
- discord4j.core.spec.legacy.LegacyEmbedCreateSpec
-
- All Implemented Interfaces:
LegacySpec<discord4j.discordjson.json.EmbedData>
public class LegacyEmbedCreateSpec extends Object implements LegacySpec<discord4j.discordjson.json.EmbedData>
A spec used to configure and send an embed.- See Also:
- Embed Layout
-
-
Constructor Summary
Constructors Constructor Description LegacyEmbedCreateSpec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LegacyEmbedCreateSpec
addField(String name, String value, boolean inline)
Adds a field to the embed.discord4j.discordjson.json.EmbedData
asRequest()
LegacyEmbedCreateSpec
from(discord4j.discordjson.json.EmbedData embedData)
Populate the spec from an existing embed.LegacyEmbedCreateSpec
setAuthor(String name, String url, String iconUrl)
Sets the author section of the embed.LegacyEmbedCreateSpec
setColor(Color color)
Sets the color of the embed.LegacyEmbedCreateSpec
setDescription(String description)
Sets the description of the embed.LegacyEmbedCreateSpec
setFooter(String text, String iconUrl)
Sets the footer of the embed.LegacyEmbedCreateSpec
setImage(String url)
Sets the image of the embed.LegacyEmbedCreateSpec
setThumbnail(String url)
Sets the thumbnail of the embed.LegacyEmbedCreateSpec
setTimestamp(Instant timestamp)
Sets the timestamp to display in the embed.LegacyEmbedCreateSpec
setTitle(String title)
Sets the title of the embed.LegacyEmbedCreateSpec
setUrl(String url)
Sets the URL of the embed.
-
-
-
Method Detail
-
setTitle
public LegacyEmbedCreateSpec setTitle(String title)
Sets the title of the embed.- Parameters:
title
- The title of the embed.- Returns:
- This spec.
-
setDescription
public LegacyEmbedCreateSpec setDescription(String description)
Sets the description of the embed.- Parameters:
description
- The description of the embed.- Returns:
- This spec.
-
setUrl
public LegacyEmbedCreateSpec 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 LegacyEmbedCreateSpec setTimestamp(Instant timestamp)
Sets the timestamp to display in the embed. The timestamp is displayed locally for each user's timezone.- Parameters:
timestamp
- AInstant
to display in the embed footer.- Returns:
- This spec.
-
setColor
public LegacyEmbedCreateSpec setColor(Color color)
Sets the color of the embed.- Parameters:
color
- AColor
to display on the embed.- Returns:
- This spec.
-
setFooter
public LegacyEmbedCreateSpec 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 LegacyEmbedCreateSpec setImage(String url)
Sets the image of the embed.- Parameters:
url
- An image URL.- Returns:
- This spec.
-
setThumbnail
public LegacyEmbedCreateSpec setThumbnail(String url)
Sets the thumbnail of the embed.- Parameters:
url
- An image URL.- Returns:
- This spec.
-
setAuthor
public LegacyEmbedCreateSpec 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 LegacyEmbedCreateSpec 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.
-
from
public LegacyEmbedCreateSpec from(discord4j.discordjson.json.EmbedData embedData)
Populate the spec from an existing embed. This will override all previously set values including fields!- Parameters:
embedData
- The embed to populate this spec from.- Returns:
- This spec.
-
asRequest
public discord4j.discordjson.json.EmbedData asRequest()
- Specified by:
asRequest
in interfaceLegacySpec<discord4j.discordjson.json.EmbedData>
-
-