Class EmbedBuilder
- java.lang.Object
-
- org.javacord.api.entity.message.embed.EmbedBuilder
-
public class EmbedBuilder extends java.lang.ObjectThis class is used to create embeds.
-
-
Constructor Summary
Constructors Constructor Description EmbedBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EmbedBuilderaddField(java.lang.String name, java.lang.String value)Adds a non-inline field to the embed.EmbedBuilderaddField(java.lang.String name, java.lang.String value, boolean inline)Adds a field to the embed.EmbedBuilderaddInlineField(java.lang.String name, java.lang.String value)Adds an inline field to the embed.EmbedBuilderDelegategetDelegate()Gets the delegate used by this embed builder internally.EmbedBuilderremoveAllFields()Removes all fields of the embed.EmbedBuilderremoveFields(java.util.function.Predicate<EmbedField> predicate)Removes all fields of the embed that satisfy the given predicate.booleanrequiresAttachments()Checks if this embed requires any attachments.EmbedBuildersetAuthor(java.lang.String name)Sets the author of the embed.EmbedBuildersetAuthor(java.lang.String name, java.lang.String url, byte[] icon)Sets the author of the embed.EmbedBuildersetAuthor(java.lang.String name, java.lang.String url, byte[] icon, java.lang.String fileType)Sets the author of the embed.EmbedBuildersetAuthor(java.lang.String name, java.lang.String url, java.awt.image.BufferedImage icon)Sets the author of the embed.EmbedBuildersetAuthor(java.lang.String name, java.lang.String url, java.awt.image.BufferedImage icon, java.lang.String fileType)Sets the author of the embed.EmbedBuildersetAuthor(java.lang.String name, java.lang.String url, java.io.File icon)Sets the author of the embed.EmbedBuildersetAuthor(java.lang.String name, java.lang.String url, java.io.InputStream icon)Sets the author of the embed.EmbedBuildersetAuthor(java.lang.String name, java.lang.String url, java.io.InputStream icon, java.lang.String fileType)Sets the author of the embed.EmbedBuildersetAuthor(java.lang.String name, java.lang.String url, java.lang.String iconUrl)Sets the author of the embed.EmbedBuildersetAuthor(java.lang.String name, java.lang.String url, Icon icon)Sets the author of the embed.EmbedBuildersetAuthor(MessageAuthor author)Sets the author of the embed.EmbedBuildersetAuthor(User author)Sets the author of the embed.EmbedBuildersetColor(java.awt.Color color)Sets the color of the embed.EmbedBuildersetDescription(java.lang.String description)Sets the description of the embed.EmbedBuildersetFooter(java.lang.String text)Sets the footer of the embed.EmbedBuildersetFooter(java.lang.String text, byte[] icon)Sets the footer of the embed.EmbedBuildersetFooter(java.lang.String text, byte[] icon, java.lang.String fileType)Sets the footer of the embed.EmbedBuildersetFooter(java.lang.String text, java.awt.image.BufferedImage icon)Sets the footer of the embed.EmbedBuildersetFooter(java.lang.String text, java.awt.image.BufferedImage icon, java.lang.String fileType)Sets the footer of the embed.EmbedBuildersetFooter(java.lang.String text, java.io.File icon)Sets the footer of the embed.EmbedBuildersetFooter(java.lang.String text, java.io.InputStream icon)Sets the footer of the embed.EmbedBuildersetFooter(java.lang.String text, java.io.InputStream icon, java.lang.String fileType)Sets the footer of the embed.EmbedBuildersetFooter(java.lang.String text, java.lang.String iconUrl)Sets the footer of the embed.EmbedBuildersetFooter(java.lang.String text, Icon icon)Sets the footer of the embed.EmbedBuildersetImage(byte[] image)Sets the image of the embed.EmbedBuildersetImage(byte[] image, java.lang.String fileType)Sets the image of the embed.EmbedBuildersetImage(java.awt.image.BufferedImage image)Sets the image of the embed.EmbedBuildersetImage(java.awt.image.BufferedImage image, java.lang.String fileType)Sets the image of the embed.EmbedBuildersetImage(java.io.File image)Sets the image of the embed.EmbedBuildersetImage(java.io.InputStream image)Sets the image of the embed.EmbedBuildersetImage(java.io.InputStream image, java.lang.String fileType)Sets the image of the embed.EmbedBuildersetImage(java.lang.String url)Sets the image of the embed.EmbedBuildersetImage(Icon image)Sets the image of the embed.EmbedBuildersetThumbnail(byte[] thumbnail)Sets the thumbnail of the embed.EmbedBuildersetThumbnail(byte[] thumbnail, java.lang.String fileType)Sets the thumbnail of the embed.EmbedBuildersetThumbnail(java.awt.image.BufferedImage thumbnail)Sets the thumbnail of the embed.EmbedBuildersetThumbnail(java.awt.image.BufferedImage thumbnail, java.lang.String fileType)Sets the thumbnail of the embed.EmbedBuildersetThumbnail(java.io.File thumbnail)Sets the thumbnail of the embed.EmbedBuildersetThumbnail(java.io.InputStream thumbnail)Sets the thumbnail of the embed.EmbedBuildersetThumbnail(java.io.InputStream thumbnail, java.lang.String fileType)Sets the thumbnail of the embed.EmbedBuildersetThumbnail(java.lang.String url)Sets the thumbnail of the embed.EmbedBuildersetThumbnail(Icon thumbnail)Sets the thumbnail of the embed.EmbedBuildersetTimestamp(java.time.Instant timestamp)Sets the timestamp of the embed.EmbedBuildersetTimestampToNow()Sets the current time as timestamp of the embed.EmbedBuildersetTitle(java.lang.String title)Sets the title of the embed.EmbedBuildersetUrl(java.lang.String url)Sets the url of the embed.EmbedBuilderupdateAllFields(java.util.function.Consumer<EditableEmbedField> updater)Updates all fields of the embed using the given updater.EmbedBuilderupdateFields(java.util.function.Predicate<EmbedField> predicate, java.util.function.Consumer<EditableEmbedField> updater)Updates all fields of the embed that satisfy the given predicate using the given updater.
-
-
-
Method Detail
-
getDelegate
public EmbedBuilderDelegate getDelegate()
Gets the delegate used by this embed builder internally.- Returns:
- The delegate used by this embed builder internally.
-
setTitle
public EmbedBuilder setTitle(java.lang.String title)
Sets the title of the embed.- Parameters:
title- The title of the embed.- Returns:
- The current instance in order to chain call methods.
-
setDescription
public EmbedBuilder setDescription(java.lang.String description)
Sets the description of the embed.- Parameters:
description- The description of the embed.- Returns:
- The current instance in order to chain call methods.
-
setUrl
public EmbedBuilder setUrl(java.lang.String url)
Sets the url of the embed.- Parameters:
url- The url of the embed.- Returns:
- The current instance in order to chain call methods.
-
setTimestampToNow
public EmbedBuilder setTimestampToNow()
Sets the current time as timestamp of the embed.- Returns:
- The current instance in order to chain call methods.
-
setTimestamp
public EmbedBuilder setTimestamp(java.time.Instant timestamp)
Sets the timestamp of the embed.- Parameters:
timestamp- The timestamp to set.- Returns:
- The current instance in order to chain call methods.
-
setColor
public EmbedBuilder setColor(java.awt.Color color)
Sets the color of the embed.- Parameters:
color- The color of the embed.- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text)
Sets the footer of the embed.- Parameters:
text- The text of the footer.- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text, java.lang.String iconUrl)
Sets the footer of the embed.- Parameters:
text- The text of the footer.iconUrl- The url of the footer's icon.- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text, Icon icon)
Sets the footer of the embed.- Parameters:
text- The text of the footer.icon- The footer's icon.- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text, java.io.File icon)
Sets the footer of the embed.- Parameters:
text- The text of the footer.icon- The footer's icon.- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text, java.io.InputStream icon)
Sets the footer of the embed. This method assumes the file type is "png"!- Parameters:
text- The text of the footer.icon- The footer's icon.- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text, java.io.InputStream icon, java.lang.String fileType)
Sets the footer of the embed.- Parameters:
text- The text of the footer.icon- The footer's icon.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text, byte[] icon)
Sets the footer of the embed. This method assumes the file type is "png"!- Parameters:
text- The text of the footer.icon- The footer's icon.- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text, byte[] icon, java.lang.String fileType)
Sets the footer of the embed.- Parameters:
text- The text of the footer.icon- The footer's icon.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text, java.awt.image.BufferedImage icon)
Sets the footer of the embed. This method assumes the file type is "png"!- Parameters:
text- The text of the footer.icon- The footer's icon.- Returns:
- The current instance in order to chain call methods.
-
setFooter
public EmbedBuilder setFooter(java.lang.String text, java.awt.image.BufferedImage icon, java.lang.String fileType)
Sets the footer of the embed.- Parameters:
text- The text of the footer.icon- The footer's icon.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setImage
public EmbedBuilder setImage(java.lang.String url)
Sets the image of the embed.- Parameters:
url- The url of the image.- Returns:
- The current instance in order to chain call methods.
-
setImage
public EmbedBuilder setImage(Icon image)
Sets the image of the embed.- Parameters:
image- The image.- Returns:
- The current instance in order to chain call methods.
-
setImage
public EmbedBuilder setImage(java.io.File image)
Sets the image of the embed.- Parameters:
image- The image.- Returns:
- The current instance in order to chain call methods.
-
setImage
public EmbedBuilder setImage(java.io.InputStream image)
Sets the image of the embed. This method assumes the file type is "png"!- Parameters:
image- The image.- Returns:
- The current instance in order to chain call methods.
-
setImage
public EmbedBuilder setImage(java.io.InputStream image, java.lang.String fileType)
Sets the image of the embed.- Parameters:
image- The image.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setImage
public EmbedBuilder setImage(byte[] image)
Sets the image of the embed. This method assumes the file type is "png"!- Parameters:
image- The image.- Returns:
- The current instance in order to chain call methods.
-
setImage
public EmbedBuilder setImage(byte[] image, java.lang.String fileType)
Sets the image of the embed.- Parameters:
image- The image.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setImage
public EmbedBuilder setImage(java.awt.image.BufferedImage image)
Sets the image of the embed. This method assumes the file type is "png"!- Parameters:
image- The image.- Returns:
- The current instance in order to chain call methods.
-
setImage
public EmbedBuilder setImage(java.awt.image.BufferedImage image, java.lang.String fileType)
Sets the image of the embed.- Parameters:
image- The image.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(MessageAuthor author)
Sets the author of the embed.- Parameters:
author- The message author which should be used as author.- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(User author)
Sets the author of the embed.- Parameters:
author- The user which should be used as author.- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name)
Sets the author of the embed.- Parameters:
name- The name of the author.- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name, java.lang.String url, java.lang.String iconUrl)
Sets the author of the embed.- Parameters:
name- The name of the author.url- The url of the author.iconUrl- The url of the author's icon.- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name, java.lang.String url, Icon icon)
Sets the author of the embed.- Parameters:
name- The name of the author.url- The url of the author.icon- The author's icon.- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name, java.lang.String url, java.io.File icon)
Sets the author of the embed.- Parameters:
name- The name of the author.url- The url of the author.icon- The author's icon.- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name, java.lang.String url, java.io.InputStream icon)
Sets the author of the embed. This method assumes the file type is "png"!- Parameters:
name- The name of the author.url- The url of the author.icon- The author's icon.- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name, java.lang.String url, java.io.InputStream icon, java.lang.String fileType)
Sets the author of the embed.- Parameters:
name- The name of the author.url- The url of the author.icon- The author's icon.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name, java.lang.String url, byte[] icon)
Sets the author of the embed. This method assumes the file type is "png"!- Parameters:
name- The name of the author.url- The url of the author.icon- The author's icon.- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name, java.lang.String url, byte[] icon, java.lang.String fileType)
Sets the author of the embed.- Parameters:
name- The name of the author.url- The url of the author.icon- The author's icon.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name, java.lang.String url, java.awt.image.BufferedImage icon)
Sets the author of the embed. This method assumes the file type is "png"!- Parameters:
name- The name of the author.url- The url of the author.icon- The author's icon.- Returns:
- The current instance in order to chain call methods.
-
setAuthor
public EmbedBuilder setAuthor(java.lang.String name, java.lang.String url, java.awt.image.BufferedImage icon, java.lang.String fileType)
Sets the author of the embed.- Parameters:
name- The name of the author.url- The url of the author.icon- The author's icon.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setThumbnail
public EmbedBuilder setThumbnail(java.lang.String url)
Sets the thumbnail of the embed.- Parameters:
url- The url of the thumbnail.- Returns:
- The current instance in order to chain call methods.
-
setThumbnail
public EmbedBuilder setThumbnail(Icon thumbnail)
Sets the thumbnail of the embed.- Parameters:
thumbnail- The thumbnail.- Returns:
- The current instance in order to chain call methods.
-
setThumbnail
public EmbedBuilder setThumbnail(java.io.File thumbnail)
Sets the thumbnail of the embed.- Parameters:
thumbnail- The thumbnail.- Returns:
- The current instance in order to chain call methods.
-
setThumbnail
public EmbedBuilder setThumbnail(java.io.InputStream thumbnail)
Sets the thumbnail of the embed. This method assumes the file type is "png"!- Parameters:
thumbnail- The thumbnail.- Returns:
- The current instance in order to chain call methods.
-
setThumbnail
public EmbedBuilder setThumbnail(java.io.InputStream thumbnail, java.lang.String fileType)
Sets the thumbnail of the embed.- Parameters:
thumbnail- The thumbnail.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setThumbnail
public EmbedBuilder setThumbnail(byte[] thumbnail)
Sets the thumbnail of the embed. This method assumes the file type is "png"!- Parameters:
thumbnail- The thumbnail.- Returns:
- The current instance in order to chain call methods.
-
setThumbnail
public EmbedBuilder setThumbnail(byte[] thumbnail, java.lang.String fileType)
Sets the thumbnail of the embed.- Parameters:
thumbnail- The thumbnail.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
setThumbnail
public EmbedBuilder setThumbnail(java.awt.image.BufferedImage thumbnail)
Sets the thumbnail of the embed. This method assumes the file type is "png"!- Parameters:
thumbnail- The thumbnail.- Returns:
- The current instance in order to chain call methods.
-
setThumbnail
public EmbedBuilder setThumbnail(java.awt.image.BufferedImage thumbnail, java.lang.String fileType)
Sets the thumbnail of the embed.- Parameters:
thumbnail- The thumbnail.fileType- The type of the file, e.g. "png" or "gif".- Returns:
- The current instance in order to chain call methods.
-
addInlineField
public EmbedBuilder addInlineField(java.lang.String name, java.lang.String value)
Adds an inline field to the embed.- Parameters:
name- The name of the field.value- The value of the field.- Returns:
- The current instance in order to chain call methods.
-
addField
public EmbedBuilder addField(java.lang.String name, java.lang.String value)
Adds a non-inline field to the embed.- Parameters:
name- The name of the field.value- The value of the field.- Returns:
- The current instance in order to chain call methods.
-
addField
public EmbedBuilder addField(java.lang.String name, java.lang.String value, boolean inline)
Adds a field to the embed.- Parameters:
name- The name of the field.value- The value of the field.inline- Whether the field should be inline or not.- Returns:
- The current instance in order to chain call methods.
-
updateFields
public EmbedBuilder updateFields(java.util.function.Predicate<EmbedField> predicate, java.util.function.Consumer<EditableEmbedField> updater)
Updates all fields of the embed that satisfy the given predicate using the given updater.- Parameters:
predicate- The predicate that fields have to satisfy to get updated.updater- The updater for the fields; theEditableEmbedFieldis only valid during the run of the updater; any try to save it in a variable and reuse it later after this method call will fail with exceptions.- Returns:
- The current instance in order to chain call methods.
-
updateAllFields
public EmbedBuilder updateAllFields(java.util.function.Consumer<EditableEmbedField> updater)
Updates all fields of the embed using the given updater.- Parameters:
updater- The updater for the fields; theEditableEmbedFieldis only valid during the run of the updater; any try to save it in a variable and reuse it later after this method call will fail with exceptions.- Returns:
- The current instance in order to chain call methods.
-
removeFields
public EmbedBuilder removeFields(java.util.function.Predicate<EmbedField> predicate)
Removes all fields of the embed that satisfy the given predicate.- Parameters:
predicate- The predicate that fields have to satisfy to get removed.- Returns:
- The current instance in order to chain call methods.
-
removeAllFields
public EmbedBuilder removeAllFields()
Removes all fields of the embed.- Returns:
- The current instance in order to chain call methods.
-
requiresAttachments
public boolean requiresAttachments()
Checks if this embed requires any attachments.- Returns:
- Whether the embed requires attachments or not.
-
-