Skip to content

Commit

Permalink
Bump embed max description length to 4096 (#1703)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre601 committed Jul 7, 2021
1 parent 3cfc750 commit d64de79
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/main/java/net/dv8tion/jda/api/EmbedBuilder.java
Expand Up @@ -117,8 +117,8 @@ public MessageEmbed build()
{
if (isEmpty())
throw new IllegalStateException("Cannot build an empty embed!");
if (description.length() > MessageEmbed.TEXT_MAX_LENGTH)
throw new IllegalStateException(Helpers.format("Description is longer than %d! Please limit your input!", MessageEmbed.TEXT_MAX_LENGTH));
if (description.length() > MessageEmbed.DESCRIPTION_MAX_LENGTH)
throw new IllegalStateException(Helpers.format("Description is longer than %d! Please limit your input!", MessageEmbed.DESCRIPTION_MAX_LENGTH));
if (length() > MessageEmbed.EMBED_MAX_LENGTH_BOT)
throw new IllegalStateException("Cannot build an embed with more than " + MessageEmbed.EMBED_MAX_LENGTH_BOT + " characters!");
final String description = this.description.length() < 1 ? null : this.description.toString();
Expand Down Expand Up @@ -291,7 +291,7 @@ public StringBuilder getDescriptionBuilder()
* the description of the embed, {@code null} to reset
*
* @throws java.lang.IllegalArgumentException
* If the length of {@code description} is greater than {@link net.dv8tion.jda.api.entities.MessageEmbed#TEXT_MAX_LENGTH}
* If the length of {@code description} is greater than {@link net.dv8tion.jda.api.entities.MessageEmbed#DESCRIPTION_MAX_LENGTH}
*
* @return the builder after the description has been set
*/
Expand All @@ -315,7 +315,7 @@ public final EmbedBuilder setDescription(@Nullable CharSequence description)
* @throws java.lang.IllegalArgumentException
* <ul>
* <li>If the provided {@code description} String is null</li>
* <li>If the length of {@code description} is greater than {@link net.dv8tion.jda.api.entities.MessageEmbed#TEXT_MAX_LENGTH}.</li>
* <li>If the length of {@code description} is greater than {@link net.dv8tion.jda.api.entities.MessageEmbed#DESCRIPTION_MAX_LENGTH}.</li>
* </ul>
*
* @return the builder after the description has been set
Expand All @@ -324,8 +324,8 @@ public final EmbedBuilder setDescription(@Nullable CharSequence description)
public EmbedBuilder appendDescription(@Nonnull CharSequence description)
{
Checks.notNull(description, "description");
Checks.check(this.description.length() + description.length() <= MessageEmbed.TEXT_MAX_LENGTH,
"Description cannot be longer than %d characters.", MessageEmbed.TEXT_MAX_LENGTH);
Checks.check(this.description.length() + description.length() <= MessageEmbed.DESCRIPTION_MAX_LENGTH,
"Description cannot be longer than %d characters.", MessageEmbed.DESCRIPTION_MAX_LENGTH);
this.description.append(description);
return this;
}
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java
Expand Up @@ -66,11 +66,17 @@ public class MessageEmbed implements SerializableData
public static final int VALUE_MAX_LENGTH = 1024;

/**
* The maximum length the description and footer of an embed can have
* The maximum length the description of an embed can have
*
* @see net.dv8tion.jda.api.EmbedBuilder#setFooter(String, String) EmbedBuilder.setFooter(text, iconUrl)
* @see net.dv8tion.jda.api.EmbedBuilder#setDescription(CharSequence) EmbedBuilder.setDescription(text)
*/
public static final int DESCRIPTION_MAX_LENGTH = 4096;

/**
* The maximum length the footer of an embed can have
*
* @see net.dv8tion.jda.api.EmbedBuilder#setFooter(String, String) EmbedBuilder.setFooter(text, iconUrl)
*/
public static final int TEXT_MAX_LENGTH = 2048;

/**
Expand Down

0 comments on commit d64de79

Please sign in to comment.