no whitespace for ya (#2831)

This commit is contained in:
Mihail Gribkov
2024-01-25 14:08:15 +03:00
committed by GitHub
parent 541571c9c7
commit 89efe0f3ad

View File

@@ -753,10 +753,10 @@ namespace Discord
/// <exception cref="InvalidOperationException">A non-link button must contain a custom id</exception> /// <exception cref="InvalidOperationException">A non-link button must contain a custom id</exception>
public ButtonComponent Build() 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!"); 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!"); throw new InvalidOperationException("A button must contain either a URL or a CustomId, but not both!");
if (Style == 0) if (Style == 0)
@@ -764,11 +764,11 @@ namespace Discord
if (Style == ButtonStyle.Link) if (Style == ButtonStyle.Link)
{ {
if (string.IsNullOrEmpty(Url)) if (string.IsNullOrWhiteSpace(Url))
throw new InvalidOperationException("Link buttons must have a link associated with them"); throw new InvalidOperationException("Link buttons must have a link associated with them");
UrlValidation.ValidateButton(Url); 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"); throw new InvalidOperationException("Non-link buttons must have a custom id associated with them");
return new ButtonComponent(Style, Label, Emote, CustomId, Url, IsDisabled); return new ButtonComponent(Style, Label, Emote, CustomId, Url, IsDisabled);