From 7e36fbc7c1ebf15f8ba6bf7561aa08282ce97021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Hjorth=C3=B8j?= Date: Sun, 12 Sep 2021 08:07:09 +0200 Subject: [PATCH] Whoops missed a few (#142) --- .../Interactions/SlashCommandBuilder.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Discord.Net.Core/Entities/Interactions/SlashCommandBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/SlashCommandBuilder.cs index 8a1bd8314..97d9f7760 100644 --- a/src/Discord.Net.Core/Entities/Interactions/SlashCommandBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/SlashCommandBuilder.cs @@ -37,12 +37,12 @@ namespace Discord set { Preconditions.NotNullOrEmpty(value, nameof(Name)); - Preconditions.AtLeast(value.Length, 3, nameof(Name)); + Preconditions.AtLeast(value.Length, 1, nameof(Name)); Preconditions.AtMost(value.Length, MaxNameLength, nameof(Name)); // Discord updated the docs, this regex prevents special characters like @!$%(... etc, // https://discord.com/developers/docs/interactions/slash-commands#applicationcommand - if (!Regex.IsMatch(value, @"^[\w-]{3,32}$")) + if (!Regex.IsMatch(value, @"^[\w-]{1,32}$")) throw new ArgumentException("Command name cannot contain any special characters or whitespaces!"); _name = value; @@ -169,17 +169,17 @@ namespace Discord { // Make sure the name matches the requirements from discord Preconditions.NotNullOrEmpty(name, nameof(name)); - Preconditions.AtLeast(name.Length, 3, nameof(name)); + Preconditions.AtLeast(name.Length, 1, nameof(name)); Preconditions.AtMost(name.Length, MaxNameLength, nameof(name)); // Discord updated the docs, this regex prevents special characters like @!$%( and s p a c e s.. etc, // https://discord.com/developers/docs/interactions/slash-commands#applicationcommand - if (!Regex.IsMatch(name, @"^[\w-]{3,32}$")) + if (!Regex.IsMatch(name, @"^[\w-]{1,32}$")) throw new ArgumentException("Command name cannot contian any special characters or whitespaces!", nameof(name)); // same with description Preconditions.NotNullOrEmpty(description, nameof(description)); - Preconditions.AtLeast(description.Length, 3, nameof(description)); + Preconditions.AtLeast(description.Length, 1, nameof(description)); Preconditions.AtMost(description.Length, MaxDescriptionLength, nameof(description)); // make sure theres only one option with default set to true @@ -301,7 +301,7 @@ namespace Discord throw new ArgumentException("Name length must at least 1 characters in length"); if (value != null) - if (!Regex.IsMatch(value, @"^[\w-]{3,32}$")) + if (!Regex.IsMatch(value, @"^[\w-]{1,32}$")) throw new ArgumentException("Option name cannot contian any special characters or whitespaces!"); _name = value; @@ -392,17 +392,17 @@ namespace Discord { // Make sure the name matches the requirements from discord Preconditions.NotNullOrEmpty(name, nameof(name)); - Preconditions.AtLeast(name.Length, 3, nameof(name)); + Preconditions.AtLeast(name.Length, 1, nameof(name)); Preconditions.AtMost(name.Length, SlashCommandBuilder.MaxNameLength, nameof(name)); // Discord updated the docs, this regex prevents special characters like @!$%( and s p a c e s.. etc, // https://discord.com/developers/docs/interactions/slash-commands#applicationcommand - if (!Regex.IsMatch(name, @"^[\w-]{3,32}$")) + if (!Regex.IsMatch(name, @"^[\w-]{1,32}$")) throw new ArgumentException("Command name cannot contian any special characters or whitespaces!", nameof(name)); // same with description Preconditions.NotNullOrEmpty(description, nameof(description)); - Preconditions.AtLeast(description.Length, 3, nameof(description)); + Preconditions.AtLeast(description.Length, 1, nameof(description)); Preconditions.AtMost(description.Length, SlashCommandBuilder.MaxDescriptionLength, nameof(description)); // make sure theres only one option with default set to true