diff --git a/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs
index 33760ca5cf..549913dc91 100644
--- a/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs
+++ b/src/Discord.Net.Core/Entities/Interactions/MessageComponents/ComponentBuilder.cs
@@ -1406,6 +1406,9 @@ public int? MaxLength
///
/// .Length is greater than or .
///
+ ///
+ /// is and contains a new line character.
+ ///
public string Value
{
get => _value;
@@ -1415,6 +1418,7 @@ public string Value
throw new ArgumentOutOfRangeException(nameof(value), $"Value must not be longer than {MaxLength ?? LargestMaxLength}.");
if (value?.Length < (MinLength ?? 0))
throw new ArgumentOutOfRangeException(nameof(value), $"Value must not be shorter than {MinLength}");
+
_value = value;
}
}
@@ -1550,6 +1554,9 @@ public TextInputComponent Build()
throw new ArgumentException("TextInputComponents must have a custom id.", nameof(CustomId));
if (string.IsNullOrWhiteSpace(Label))
throw new ArgumentException("TextInputComponents must have a label.", nameof(Label));
+ if (Style == TextInputStyle.Short && Value?.Contains('\n') == true)
+ throw new ArgumentException($"Value must not contain new line characters when style is {TextInputStyle.Short}.", nameof(Value));
+
return new TextInputComponent(CustomId, Label, Placeholder, MinLength, MaxLength, Style, Required, Value);
}
}