Browse Source

Change the minimum length of slash commands to 1 (#284)

* Change the minimum length of slash commands to 1. This is the correct value according to the docs and it has been changed after user feedback.

* Fix the limit in 3 other places

Co-authored-by: quin lynch <lynchquin@gmail.com>
pull/1923/head
Dennis Fischer GitHub 3 years ago
parent
commit
758175793a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions
  1. +1
    -1
      src/Discord.Net.Core/Entities/Interactions/ContextMenus/MessageCommandBuilder.cs
  2. +1
    -1
      src/Discord.Net.Core/Entities/Interactions/ContextMenus/UserCommandBuilder.cs
  3. +2
    -2
      src/Discord.Net.Rest/DiscordRestApiClient.cs

+ 1
- 1
src/Discord.Net.Core/Entities/Interactions/ContextMenus/MessageCommandBuilder.cs View File

@@ -19,7 +19,7 @@ namespace Discord
set set
{ {
Preconditions.NotNullOrEmpty(value, nameof(Name)); 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)); Preconditions.AtMost(value.Length, MaxNameLength, nameof(Name));


_name = value; _name = value;


+ 1
- 1
src/Discord.Net.Core/Entities/Interactions/ContextMenus/UserCommandBuilder.cs View File

@@ -19,7 +19,7 @@ namespace Discord
set set
{ {
Preconditions.NotNullOrEmpty(value, nameof(Name)); 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)); Preconditions.AtMost(value.Length, MaxNameLength, nameof(Name));


_name = value; _name = value;


+ 2
- 2
src/Discord.Net.Rest/DiscordRestApiClient.cs View File

@@ -1187,7 +1187,7 @@ namespace Discord.API
{ {
Preconditions.NotNull(command, nameof(command)); Preconditions.NotNull(command, nameof(command));
Preconditions.AtMost(command.Name.Length, 32, nameof(command.Name)); Preconditions.AtMost(command.Name.Length, 32, nameof(command.Name));
Preconditions.AtLeast(command.Name.Length, 3, nameof(command.Name));
Preconditions.AtLeast(command.Name.Length, 1, nameof(command.Name));


if (command.Type == ApplicationCommandType.Slash) if (command.Type == ApplicationCommandType.Slash)
{ {
@@ -1258,7 +1258,7 @@ namespace Discord.API
{ {
Preconditions.NotNull(command, nameof(command)); Preconditions.NotNull(command, nameof(command));
Preconditions.AtMost(command.Name.Length, 32, nameof(command.Name)); Preconditions.AtMost(command.Name.Length, 32, nameof(command.Name));
Preconditions.AtLeast(command.Name.Length, 3, nameof(command.Name));
Preconditions.AtLeast(command.Name.Length, 1, nameof(command.Name));


if (command.Type == ApplicationCommandType.Slash) if (command.Type == ApplicationCommandType.Slash)
{ {


Loading…
Cancel
Save