Browse Source

Update SlashCommandBuilder.cs

* Fixed `SlashCommandOptionBuilder.AddChoiceInternal` to not pass null `NameLocalizations`
pull/2457/head
Proddy GitHub 2 years ago
parent
commit
769db6039a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs

+ 8
- 5
src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs View File

@@ -741,13 +741,16 @@ namespace Discord
Preconditions.AtLeast(str.Length, 1, nameof(value)); Preconditions.AtLeast(str.Length, 1, nameof(value));
Preconditions.AtMost(str.Length, 100, nameof(value)); Preconditions.AtMost(str.Length, 100, nameof(value));
} }
Choices.Add(new ApplicationCommandOptionChoiceProperties
var props = new ApplicationCommandOptionChoiceProperties
{ {
Name = name, Name = name,
Value = value,
NameLocalizations = nameLocalizations
});
Value = value
};
if (nameLocalizations is not null)
props.NameLocalizations = nameLocalizations
Choices.Add(props);


return this; return this;
} }


Loading…
Cancel
Save