public class WebhookEmbedBuilder
extends java.lang.Object
WebhookEmbed instance.| Constructor and Description |
|---|
WebhookEmbedBuilder()
Creates an empty builder
|
WebhookEmbedBuilder(@Nullable WebhookEmbed embed)
Creates a builder with predefined settings from
the provided
WebhookEmbed instance |
| Modifier and Type | Method and Description |
|---|---|
@NotNull WebhookEmbedBuilder |
addField(WebhookEmbed.EmbedField field)
Adds an
WebhookEmbed.EmbedField to this embed. |
@NotNull WebhookEmbed |
build()
Builds a new
WebhookEmbed instance
from the current settings. |
static @NotNull WebhookEmbedBuilder |
fromD4J(@NotNull java.util.function.Consumer<? super discord4j.core.spec.EmbedCreateSpec> callback)
Deprecated.
Replace with
fromD4J(EmbedCreateSpec) |
static @NotNull WebhookEmbedBuilder |
fromD4J(@NotNull discord4j.core.spec.EmbedCreateSpec spec)
Converts a Discord4J
EmbedCreateSpec into a compatible WebhookEmbedBuilder. |
static @NotNull WebhookEmbedBuilder |
fromD4J(@NotNull discord4j.discordjson.json.EmbedData data)
Converts a Discord4J
EmbedData into a compatible WebhookEmbedBuilder. |
static @NotNull WebhookEmbedBuilder |
fromJavacord(org.javacord.api.entity.message.embed.Embed embed)
Converts a Javacord
Embed into a compatible WebhookEmbedBuilder. |
static @NotNull WebhookEmbedBuilder |
fromJDA(net.dv8tion.jda.api.entities.MessageEmbed embed)
Converts a JDA
MessageEmbed into a compatible WebhookEmbedBuilder. |
boolean |
isEmpty()
Whether this embed is currently empty.
|
void |
reset()
Resets the builder to its default state
|
@NotNull WebhookEmbedBuilder |
setAuthor(WebhookEmbed.EmbedAuthor author)
The author for this embed.
|
@NotNull WebhookEmbedBuilder |
setColor(@Nullable java.lang.Integer color)
The rgb color to use for the line left to the resulting embed
|
@NotNull WebhookEmbedBuilder |
setDescription(@Nullable java.lang.String description)
The description of the embed, this is the default
text used in most embeds.
|
@NotNull WebhookEmbedBuilder |
setFooter(WebhookEmbed.EmbedFooter footer)
The footer for this embed.
|
@NotNull WebhookEmbedBuilder |
setImageUrl(@Nullable java.lang.String imageUrl)
The image url for this embed.
|
@NotNull WebhookEmbedBuilder |
setThumbnailUrl(@Nullable java.lang.String thumbnailUrl)
The thumbnail url for this embed.
|
@NotNull WebhookEmbedBuilder |
setTimestamp(@Nullable java.time.temporal.TemporalAccessor timestamp)
The timestamp for the resulting embed.
|
@NotNull WebhookEmbedBuilder |
setTitle(WebhookEmbed.EmbedTitle title)
The title for this embed.
|
public WebhookEmbedBuilder()
public WebhookEmbedBuilder(@Nullable
@Nullable WebhookEmbed embed)
WebhookEmbed instanceembed - The (nullable) embed to copypublic void reset()
@NotNull public @NotNull WebhookEmbedBuilder setTimestamp(@Nullable @Nullable java.time.temporal.TemporalAccessor timestamp)
OffsetDateTime.timestamp - The timestampjava.time.DateTimeException - If unable to convert to an OffsetDateTime@NotNull public @NotNull WebhookEmbedBuilder setColor(@Nullable @Nullable java.lang.Integer color)
color - The (nullable) color to use@NotNull public @NotNull WebhookEmbedBuilder setDescription(@Nullable @Nullable java.lang.String description)
description - The (nullable) description to use@NotNull public @NotNull WebhookEmbedBuilder setThumbnailUrl(@Nullable @Nullable java.lang.String thumbnailUrl)
thumbnailUrl - The (nullable) thumbnail url@NotNull public @NotNull WebhookEmbedBuilder setImageUrl(@Nullable @Nullable java.lang.String imageUrl)
imageUrl - The (nullable) image url@NotNull public @NotNull WebhookEmbedBuilder setFooter(@Nullable WebhookEmbed.EmbedFooter footer)
footer - The (nullable) WebhookEmbed.EmbedFooter@NotNull public @NotNull WebhookEmbedBuilder setTitle(@Nullable WebhookEmbed.EmbedTitle title)
title - The (nullable) WebhookEmbed.EmbedTitle@NotNull public @NotNull WebhookEmbedBuilder setAuthor(@Nullable WebhookEmbed.EmbedAuthor author)
author - The (nullable) WebhookEmbed.EmbedAuthor@NotNull public @NotNull WebhookEmbedBuilder addField(@NotNull WebhookEmbed.EmbedField field)
WebhookEmbed.EmbedField to this embed.
field - The WebhookEmbed.EmbedField to addjava.lang.IllegalStateException - If the maximum amount of fields has already been reachedpublic boolean isEmpty()
@NotNull public @NotNull WebhookEmbed build()
WebhookEmbed instance
from the current settings.WebhookEmbedjava.lang.IllegalStateException - If this embed is currently empty@NotNull public static @NotNull WebhookEmbedBuilder fromJDA(@NotNull net.dv8tion.jda.api.entities.MessageEmbed embed)
MessageEmbed into a compatible WebhookEmbedBuilder.embed - The embedjava.lang.NullPointerException - If null is provided@NotNull public static @NotNull WebhookEmbedBuilder fromJavacord(@NotNull org.javacord.api.entity.message.embed.Embed embed)
Embed into a compatible WebhookEmbedBuilder.embed - The embedjava.lang.NullPointerException - If null is provided@NotNull @Deprecated public static @NotNull WebhookEmbedBuilder fromD4J(@NotNull @NotNull java.util.function.Consumer<? super discord4j.core.spec.EmbedCreateSpec> callback)
fromD4J(EmbedCreateSpec)EmbedCreateSpec into a compatible WebhookEmbedBuilder.callback - The callback which applies the desired settings to the EmbedCreateSpecjava.lang.NullPointerException - If null is provided@NotNull public static @NotNull WebhookEmbedBuilder fromD4J(@NotNull @NotNull discord4j.core.spec.EmbedCreateSpec spec)
EmbedCreateSpec into a compatible WebhookEmbedBuilder.spec - The embed create spec which applies the desired settingsjava.lang.NullPointerException - If null is provided@NotNull public static @NotNull WebhookEmbedBuilder fromD4J(@NotNull @NotNull discord4j.discordjson.json.EmbedData data)
EmbedData into a compatible WebhookEmbedBuilder.data - The embed datajava.lang.NullPointerException - If null is provided