From 4d7e384e51c5170292a7050629d449d10d706214 Mon Sep 17 00:00:00 2001 From: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com> Date: Sun, 11 Feb 2024 23:47:43 +0300 Subject: [PATCH] no fun for ya all (#2835) --- .../Interactions/MessageComponents/ComponentBuilder.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs index 1637bb17..ba9e6064 100644 --- a/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs @@ -1363,6 +1363,16 @@ namespace Discord /// The newly built . public SelectMenuOption Build() { + if (string.IsNullOrWhiteSpace(Label)) + throw new ArgumentNullException(nameof(Label), "Option must have a label."); + + Preconditions.AtMost(Label.Length, MaxSelectLabelLength, nameof(Label), $"Label length must be less or equal to {MaxSelectLabelLength}."); + + if (string.IsNullOrWhiteSpace(Value)) + throw new ArgumentNullException(nameof(Value), "Option must have a value."); + + Preconditions.AtMost(Value.Length, MaxSelectValueLength, nameof(Value), $"Value length must be less or equal to {MaxSelectValueLength}."); + return new SelectMenuOption(Label, Value, Description, Emote, IsDefault); } }