diff --git a/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs
index b0050ee36..975363f58 100644
--- a/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs
+++ b/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs
@@ -596,7 +596,7 @@ namespace Discord
if (string.IsNullOrEmpty(Url))
throw new InvalidOperationException("Link buttons must have a link associated with them");
else
- UrlValidation.Validate(Url);
+ UrlValidation.ValidateButton(Url);
}
else if (string.IsNullOrEmpty(CustomId))
throw new InvalidOperationException("Non-link buttons must have a custom id associated with them");
diff --git a/src/Discord.Net.Core/Utils/UrlValidation.cs b/src/Discord.Net.Core/Utils/UrlValidation.cs
index f5d7d4ce7..fd1642f5c 100644
--- a/src/Discord.Net.Core/Utils/UrlValidation.cs
+++ b/src/Discord.Net.Core/Utils/UrlValidation.cs
@@ -6,6 +6,7 @@ namespace Discord.Utils
{
///
/// Not full URL validation right now. Just ensures protocol is present and that it's either http or https
+ /// should be used for url buttons
///
/// url to validate before sending to Discord.
/// A URL must include a protocol (http or https).
@@ -15,7 +16,25 @@ namespace Discord.Utils
if (string.IsNullOrEmpty(url))
return false;
if(!(url.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || (url.StartsWith("https://", StringComparison.OrdinalIgnoreCase))))
- throw new InvalidOperationException($"Url {url} must be include its protocol (either HTTP or HTTPS)");
+ throw new InvalidOperationException($"The url {url} must include a protocol (either HTTP or HTTPS)");
+ return true;
+ }
+
+ ///
+ /// Not full URL validation right now. Just Ensures the protocol is either http, https, or discord
+ /// should be used everything other than url buttons
+ ///
+ /// the url to validate before sending to discord
+ /// A URL must include a protocol (either http, https, or discord).
+ /// true if the url is valid by our standard, false if null, throws an error upon invalid
+ public static bool ValidateButton(string url)
+ {
+ if (string.IsNullOrEmpty(url))
+ return false;
+ if(!((url.StartsWith("http://", StringComparison.OrdinalIgnoreCase)) ||
+ (url.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) ||
+ (url.StartsWith("discord://", StringComparison.OrdinalIgnoreCase))))
+ throw new InvalidOperationException($"The url {url} must include a protocol (either HTTP, HTTPS, or DISCORD)");
return true;
}
}