Skip to content

Commit

Permalink
no whitespace for ya (#2831)
Browse files Browse the repository at this point in the history
  • Loading branch information
Misha-133 authored Jan 25, 2024
1 parent 541571c commit 89efe0f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -753,22 +753,22 @@ public ButtonBuilder WithDisabled(bool isDisabled)
/// <exception cref="InvalidOperationException">A non-link button must contain a custom id</exception>
public ButtonComponent Build()
{
if (string.IsNullOrEmpty(Label) && Emote == null)
if (string.IsNullOrWhiteSpace(Label) && Emote == null)
throw new InvalidOperationException("A button must have an Emote or a label!");

if (!(string.IsNullOrEmpty(Url) ^ string.IsNullOrEmpty(CustomId)))
if (!(string.IsNullOrWhiteSpace(Url) ^ string.IsNullOrWhiteSpace(CustomId)))
throw new InvalidOperationException("A button must contain either a URL or a CustomId, but not both!");

if (Style == 0)
throw new ArgumentException("A button must have a style.", nameof(Style));

if (Style == ButtonStyle.Link)
{
if (string.IsNullOrEmpty(Url))
if (string.IsNullOrWhiteSpace(Url))
throw new InvalidOperationException("Link buttons must have a link associated with them");
UrlValidation.ValidateButton(Url);
}
else if (string.IsNullOrEmpty(CustomId))
else if (string.IsNullOrWhiteSpace(CustomId))
throw new InvalidOperationException("Non-link buttons must have a custom id associated with them");

return new ButtonComponent(Style, Label, Emote, CustomId, Url, IsDisabled);
Expand Down

0 comments on commit 89efe0f

Please sign in to comment.