From 769db6039a695186c67fd25fe597dbbf0355b163 Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 7 Sep 2022 16:45:47 +0100 Subject: [PATCH] Update SlashCommandBuilder.cs * Fixed `SlashCommandOptionBuilder.AddChoiceInternal` to not pass null `NameLocalizations` --- .../SlashCommands/SlashCommandBuilder.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs index 70a803dba..a4fbb14a8 100644 --- a/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs @@ -741,13 +741,16 @@ namespace Discord Preconditions.AtLeast(str.Length, 1, nameof(value)); Preconditions.AtMost(str.Length, 100, nameof(value)); } - - Choices.Add(new ApplicationCommandOptionChoiceProperties + + var props = new ApplicationCommandOptionChoiceProperties { Name = name, - Value = value, - NameLocalizations = nameLocalizations - }); + Value = value + }; + if (nameLocalizations is not null) + props.NameLocalizations = nameLocalizations + + Choices.Add(props); return this; }