MinnDevelopment/discord-webhooks

cannot enter string in #setTitle

portalthree opened this issue · 3 comments

WebhookEmbed embed = new WebhookEmbedBuilder()
     .setThumbnailUrl(headURL)
     .setColor(0x55e9e9)
     .setTitle("This is a title")
     .setDescription("This is a description")
     .build();

returns the error:

Required type: EmbedTitle
Provided: String

Required type: Embed Title

The error tells you exactly what is wrong. It expects a specific type, in this case EmbedTitle and you provide it with a String.

Setting a embed title in discord-webhooks isn't the same as setting one in JDA. Here you need to create a new instance of EmbedTitle to use.

yep figured it out!

WebhookEmbed embed = new WebhookEmbedBuilder()
                .setThumbnailUrl(headURL)
                .setColor(0x55e9e9)
                .setTitle(new WebhookEmbed.EmbedTitle("This is a title.",""))
                .setDescription("This is a description")
                .build();

id recommend adding documentation for it

There is documentation for it:

/**
* The title for this embed.
* <br>This is displayed below the author and above everything else.
*
* @param title
* The (nullable) {@link club.minnced.discord.webhook.send.WebhookEmbed.EmbedTitle}
*
* @return The current builder for chaining convenience
*/
@NotNull
public WebhookEmbedBuilder setTitle(@Nullable WebhookEmbed.EmbedTitle title) {