From 484cf1f6545d7922f84afa50ca57b1008d26efc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 7 Aug 2022 23:59:22 +0200 Subject: [PATCH] Fix placeholder length being hardcoded --- .../Interactions/MessageComponents/ComponentBuilder.cs | 7 ++++--- 1 file changed, 4 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..5da6d8678 100644 --- a/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs @@ -1198,6 +1198,7 @@ namespace Discord public class TextInputBuilder { + public const int MaxPlaceholderLength = 100; public const int LargestMaxLength = 4000; /// @@ -1229,13 +1230,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."); } ///