Class Embed
java.lang.Object
net.dv8tion.jda.api.EmbedBuilder
com.github.kaktushose.jda.commands.embeds.Embed
Subclass of
EmbedBuilder
that supports placeholders and easier manipulation of fields.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Methods for manipulating the fields of anEmbed
. -
Field Summary
Fields inherited from class net.dv8tion.jda.api.EmbedBuilder
URL_PATTERN, ZERO_WIDTH_SPACE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a Field to the embed that isn't inlined.Sets the Author of the embed.Sets the Author of the embed.Sets the Author of the embed.build()
Returns aMessageEmbed
just likeEmbedBuilder.build()
, but will also localize this embed based on thelocale(Locale)
andplaceholders
provided.color
(int color) Sets the Color of the embed.Sets the Color of the embed.description
(@Nullable CharSequence description) Sets the Description of the embed.fields()
Used to modify the fields of this embed.Sets the Footer of the embed.Sets the Footer of the embed.Sets the Image of the embed.name()
Gets the name of this embed.placeholders
(I18n.Entry... placeholders) Adds all the providedplaceholders
to this embed instance.placeholders
(Map<String, Object> placeholders) Adds all the provided placeholders to this embed instance.Sets the Thumbnail of the embed.timestamp
(@Nullable TemporalAccessor accessor) Sets the Timestamp of the embed.Sets the Title of the embed.Sets the Title of the embed.Transforms this embed intoMessageCreateData
.Transforms this embed intoMessageEditData
.Methods inherited from class net.dv8tion.jda.api.EmbedBuilder
addBlankField, addField, addField, appendDescription, clear, clearFields, copyFrom, copyFrom, fromData, getDescriptionBuilder, getFields, isEmpty, isValidLength, length, setAuthor, setAuthor, setAuthor, setColor, setColor, setDescription, setFooter, setFooter, setImage, setThumbnail, setTimestamp, setTitle, setTitle, setUrl
-
Constructor Details
-
Embed
Constructs a newEmbed
.- Parameters:
embedBuilder
- the underlyingEmbedBuilder
to usename
- the name of this embed used to identify it inEmbedDataSource
splaceholders
- the global placeholders as defined inEmbeds
-
Embed
Constructs a newEmbed
.- Parameters:
object
- theDataObject
to construct the underlyingEmbedBuilder
fromname
- the name of this embed used to identify it inEmbedDataSource
splaceholders
- the global placeholders as defined inEmbeds
-
-
Method Details
-
locale
-
name
Gets the name of this embed. This isn't a field that get displayed but only the name this embed is referenced by in theEmbedDataSource
.- Returns:
- the name of this embed
-
title
-
title
-
description
Sets the Description of the embed.- Parameters:
description
- the description of the embed,null
to reset- Returns:
- this instance for fluent interface
- See Also:
-
color
Sets the Color of the embed.- Parameters:
color
- The raw rgb value, orRole.DEFAULT_COLOR_RAW
to use no color- Returns:
- this instance for fluent interface
- See Also:
-
color
-
timestamp
Sets the Timestamp of the embed.- Parameters:
accessor
- the temporal accessor of the timestamp- Returns:
- this instance for fluent interface
- See Also:
-
thumbnail
-
image
-
author
-
author
Sets the Author of the embed.- Parameters:
name
- the name of the author of the embed. If this is not set, the author will not appear in the embedurl
- the url of the author of the embed- Returns:
- this instance for fluent interface
- See Also:
-
author
Sets the Author of the embed.- Parameters:
name
- the name of the author of the embed. If this is not set, the author will not appear in the embedurl
- the url of the author of the embediconUrl
- the url of the icon of the embed- Returns:
- this instance for fluent interface
- See Also:
-
fields
Used to modify the fields of this embed.- Returns:
- this instance for fluent interface
-
addField
-
placeholders
Adds all the provided placeholders to this embed instance. The values will be replaced when
build()
is called.Existing entries with the same keys will be overwritten.
Internally this uses the localization system, thus placeholders are limited by the used
Localizer
implementation- Parameters:
placeholders
- a map of placeholder names to their corresponding values- Returns:
- this instance for fluent interface
-
placeholders
Adds all the provided
placeholders
to this embed instance. The values will be replaced whenbuild()
is called.Existing entries with the same keys will be overwritten.
Internally this uses the localization system, thus placeholders are limited by the used
Localizer
implementation- Parameters:
placeholders
- theentries
to add- Returns:
- this instance for fluent interface
-
build
Returns aMessageEmbed
just likeEmbedBuilder.build()
, but will also localize this embed based on thelocale(Locale)
andplaceholders
provided.- Overrides:
build
in classEmbedBuilder
- Returns:
- the built, sendable
MessageEmbed
-
toMessageCreateData
Transforms this embed intoMessageCreateData
.- Returns:
- the transformed
MessageCreateData
-
toMessageEditData
Transforms this embed intoMessageEditData
.- Returns:
- the transformed
MessageEditData
-