From 8dfe19f32892e60ae259a507e4596b76b1b5003f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Mon, 15 Aug 2022 19:33:23 +0200 Subject: [PATCH] Fix placeholder length being hardcoded (#2421) * Fix placeholder length being hardcoded * Add docs for TextInputBuilder.MaxPlaceholderLength --- .../Interactions/MessageComponents/ComponentBuilder.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs index 37342b039..fd8798ed3 100644 --- a/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs @@ -1198,6 +1198,10 @@ namespace Discord public class TextInputBuilder { + /// + /// The max length of a . + /// + public const int MaxPlaceholderLength = 100; public const int LargestMaxLength = 4000; /// @@ -1229,13 +1233,13 @@ namespace Discord /// /// Gets or sets the placeholder of the current text input. /// - /// is longer than 100 characters + /// is longer than characters public string Placeholder { get => _placeholder; - set => _placeholder = (value?.Length ?? 0) <= 100 + set => _placeholder = (value?.Length ?? 0) <= MaxPlaceholderLength ? value - : throw new ArgumentException("Placeholder cannot have more than 100 characters."); + : throw new ArgumentException($"Placeholder cannot have more than {MaxPlaceholderLength} characters."); } ///