diff --git a/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs index 5c4738ac..1637bb17 100644 --- a/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs @@ -753,10 +753,10 @@ namespace Discord /// A non-link button must contain a custom id 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) @@ -764,11 +764,11 @@ namespace Discord 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);