Package discord4j.core.object
Class Embed
- java.lang.Object
-
- discord4j.core.object.Embed
-
- All Implemented Interfaces:
DiscordObject
public final class Embed extends Object implements DiscordObject
A Discord embed.- See Also:
- Embed Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Embed.Author
An image for a Discordembed
.class
Embed.Field
A field for a Discordembed
.class
Embed.Footer
A footer for a Discordembed
.class
Embed.Image
An image for a Discordembed
.class
Embed.Provider
A provider for a Discordembed
.class
Embed.Thumbnail
A thumbnail for a Discordembed
.static class
Embed.Type
Represents the various types of embeds.class
Embed.Video
A video for a Discordembed
.
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_CHARACTER_LENGTH
Deprecated.this limit applies across all embeds of a message instead of a single one.static int
MAX_DESCRIPTION_LENGTH
The maximum amount of characters that can be in an embed description.static int
MAX_FIELDS
The maximum amount of fields that can be appended to an embed.static int
MAX_TITLE_LENGTH
The maximum amount of characters that can be in an embed title.
-
Constructor Summary
Constructors Constructor Description Embed(GatewayDiscordClient gateway, discord4j.discordjson.json.EmbedData data)
Constructs anEmbed
with an associatedGatewayDiscordClient
and Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Embed.Author>
getAuthor()
Gets the author information, if present.GatewayDiscordClient
getClient()
Returns theGatewayDiscordClient
that created this object.Optional<Color>
getColor()
Gets the color of the embed, if present.discord4j.discordjson.json.EmbedData
getData()
Gets the data of the embed.Optional<String>
getDescription()
Gets the description of the embed, if present.List<Embed.Field>
getFields()
Gets the field information.Optional<Embed.Footer>
getFooter()
Gets the footer information, if present.Optional<Embed.Image>
getImage()
Gets the image information, if present.Optional<Embed.Provider>
getProvider()
Gets the provider information, if present.Optional<Embed.Thumbnail>
getThumbnail()
Gets the thumbnail information, if present.Optional<Instant>
getTimestamp()
Gets the timestamp of the embed content, if present.Optional<String>
getTitle()
Gets the title of the embed, if present.Embed.Type
getType()
Gets the type of embed, if present.Optional<String>
getUrl()
Gets the URL of the embed, if present.Optional<Embed.Video>
getVideo()
Gets the video information, if present.String
toString()
-
-
-
Field Detail
-
MAX_TITLE_LENGTH
public static final int MAX_TITLE_LENGTH
The maximum amount of characters that can be in an embed title.- See Also:
- Constant Field Values
-
MAX_DESCRIPTION_LENGTH
public static final int MAX_DESCRIPTION_LENGTH
The maximum amount of characters that can be in an embed description.- See Also:
- Constant Field Values
-
MAX_FIELDS
public static final int MAX_FIELDS
The maximum amount of fields that can be appended to an embed.- See Also:
- Constant Field Values
-
MAX_CHARACTER_LENGTH
@Deprecated public static final int MAX_CHARACTER_LENGTH
Deprecated.this limit applies across all embeds of a message instead of a single one. UseMessage.MAX_TOTAL_EMBEDS_CHARACTER_LENGTH
insteadThe maximum amount of total characters that can be present in an embed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Embed
public Embed(GatewayDiscordClient gateway, discord4j.discordjson.json.EmbedData data)
Constructs anEmbed
with an associatedGatewayDiscordClient
and Discord data.- Parameters:
gateway
- TheGatewayDiscordClient
associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.
-
-
Method Detail
-
getClient
public GatewayDiscordClient getClient()
Description copied from interface:DiscordObject
Returns theGatewayDiscordClient
that created this object. Methods in it are exclusively based on the entity cache orStore
in use. Refer to callinggetClient().rest()
to access aDiscordClient
that is capable of requesting entities directly from the REST API.- Specified by:
getClient
in interfaceDiscordObject
- Returns:
- The
GatewayDiscordClient
associated to this object.
-
getData
public discord4j.discordjson.json.EmbedData getData()
Gets the data of the embed.- Returns:
- The data of the embed.
-
getTitle
public Optional<String> getTitle()
Gets the title of the embed, if present.- Returns:
- The title of the embed, if present.
-
getType
public Embed.Type getType()
Gets the type of embed, if present.- Returns:
- The type of embed, if present.
-
getDescription
public Optional<String> getDescription()
Gets the description of the embed, if present.- Returns:
- The description of the embed, if present.
-
getUrl
public Optional<String> getUrl()
Gets the URL of the embed, if present.- Returns:
- The URL of the embed, if present.
-
getTimestamp
public Optional<Instant> getTimestamp()
Gets the timestamp of the embed content, if present.- Returns:
- The timestamp of the embed content, if present.
-
getColor
public Optional<Color> getColor()
Gets the color of the embed, if present.- Returns:
- The color of the embed, if present.
-
getFooter
public Optional<Embed.Footer> getFooter()
Gets the footer information, if present.- Returns:
- The footer information, if present.
-
getImage
public Optional<Embed.Image> getImage()
Gets the image information, if present.- Returns:
- The image information, if present.
-
getThumbnail
public Optional<Embed.Thumbnail> getThumbnail()
Gets the thumbnail information, if present.- Returns:
- The thumbnail information, if present.
-
getVideo
public Optional<Embed.Video> getVideo()
Gets the video information, if present.- Returns:
- The video information, if present.
-
getProvider
public Optional<Embed.Provider> getProvider()
Gets the provider information, if present.- Returns:
- The provider information, if present.
-
getAuthor
public Optional<Embed.Author> getAuthor()
Gets the author information, if present.- Returns:
- The author information, if present.
-
getFields
public List<Embed.Field> getFields()
Gets the field information.- Returns:
- The field information.
-
-