Skip to content

Commit

Permalink
Prevent setting emoji for premium buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Oct 14, 2024
1 parent ba0ff2c commit ebc464f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ default Button withDisabled(boolean disabled)
@CheckReturnValue
default Button withEmoji(@Nullable Emoji emoji)
{
return new ButtonImpl(getId(), getLabel(), getStyle(), getUrl(), getSku(), isDisabled(), emoji);
Checks.check(getStyle() != ButtonStyle.PREMIUM, "Premium components cannot have emojis");
return new ButtonImpl(getId(), getLabel(), getStyle(), getUrl(), null, isDisabled(), emoji);
}

/**
Expand Down Expand Up @@ -258,7 +259,7 @@ default Button withUrl(@Nonnull String url)
default Button withSku(@Nonnull SkuSnowflake sku)
{
Checks.notNull(sku, "SKU");
return new ButtonImpl(null, getLabel(), ButtonStyle.PREMIUM, null, sku, isDisabled(), getEmoji());
return new ButtonImpl(null, getLabel(), ButtonStyle.PREMIUM, null, sku, isDisabled(), null);
}

/**
Expand Down

0 comments on commit ebc464f

Please sign in to comment.