Class EmbedDTO
java.lang.Object
com.github.kaktushose.jda.commands.embeds.EmbedDTO
- All Implemented Interfaces:
Serializable
This class is a DTO to serialize and deserialize JDAs embed objects to json. Checkout the discord docs to get
information about what each field does exactly.
The json object can contain {placeholders}
which can then be injected with values at runtime by calling
injectValue(String, Object)
or injectValues(Map)
. Alternatively you can use
injectFields(Object...)
to inject the fields of objects.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
-
Constructor Summary
ConstructorDescriptionEmbedDTO()
EmbedDTO
(String title, String description, String url, String color, String timestamp, EmbedDTO.Footer footer, EmbedDTO.Thumbnail thumbnail, EmbedDTO.Image image, EmbedDTO.Author author, EmbedDTO.Field[] fields) -
Method Summary
Modifier and TypeMethodDescriptiongetColor()
getImage()
getTitle()
getUrl()
injectFields
(Object... objects) Attempts to inject{placeholders}
with the values of the given object fields.injectValue
(String name, Object object) Attempts to inject a{placeholder}
with the given value.injectValues
(Map<String, Object> values) Attempts to inject{placeholders}
with the given values.void
setAuthor
(EmbedDTO.Author author) void
void
setDescription
(String description) void
setFields
(EmbedDTO.Field[] fields) void
setFooter
(EmbedDTO.Footer footer) void
setImage
(EmbedDTO.Image image) void
setThumbnail
(EmbedDTO.Thumbnail thumbnail) void
setTimestamp
(String timestamp) void
void
Transfers this object to aEmbedBuilder
.Transfers this object to aMessageCreateBuilder
.Transfers this object to aMessageEmbed
.toString()
-
Constructor Details
-
EmbedDTO
public EmbedDTO() -
EmbedDTO
-
-
Method Details
-
toString
-
getTitle
-
setTitle
-
getDescription
-
setDescription
-
getUrl
-
setUrl
-
getColor
-
setColor
-
getTimestamp
-
setTimestamp
-
getThumbnail
-
setThumbnail
-
getImage
-
setImage
-
getAuthor
-
setAuthor
-
getFields
-
setFields
-
toEmbedBuilder
Transfers this object to aEmbedBuilder
.- Returns:
- the
EmbedBuilder
-
toMessageEmbed
Transfers this object to aMessageEmbed
.- Returns:
- the
MessageEmbed
-
toMessageCreateData
Transfers this object to aMessageCreateBuilder
.- Returns:
- the
MessageCreateBuilder
-
injectFields
Attempts to inject{placeholders}
with the values of the given object fields. Therefore, the name of the field must match the name of the{placeholder}
.- Parameters:
objects
- the objects to get the fields from- Returns:
- the current instance to use fluent interface
-
injectValues
-
injectValue
-