diff --git a/src/Discord.Net.Core/Entities/Interactions/ApplicationCommandOption.cs b/src/Discord.Net.Core/Entities/Interactions/ApplicationCommandOption.cs index 9a69d9d18..5857bac81 100644 --- a/src/Discord.Net.Core/Entities/Interactions/ApplicationCommandOption.cs +++ b/src/Discord.Net.Core/Entities/Interactions/ApplicationCommandOption.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text.RegularExpressions; namespace Discord @@ -29,6 +30,9 @@ namespace Discord if (!Regex.IsMatch(value, @"^[\w-]{1,32}$")) throw new FormatException($"{nameof(value)} must match the regex ^[\\w-]{{1,32}}$"); + if (value.Any(x => char.IsUpper(x))) + throw new FormatException("Name cannot contain any uppercase characters."); + _name = value; } } diff --git a/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs index b4fc89cc2..074a52f32 100644 --- a/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs @@ -40,6 +40,9 @@ namespace Discord if (!Regex.IsMatch(value, @"^[\w-]{1,32}$")) throw new ArgumentException("Command name cannot contain any special characters or whitespaces!", nameof(value)); + if (value.Any(x => char.IsUpper(x))) + throw new FormatException("Name cannot contain any uppercase characters."); + _name = value; } }