Max/Min length fields for ApplicationCommandOption (#2379)
* implement max/min length fields for ApplicationCommandOption * fix badly formed xml comments
This commit is contained in:
@@ -463,6 +463,12 @@ namespace Discord.Interactions.Builders
|
||||
case MinValueAttribute minValue:
|
||||
builder.MinValue = minValue.Value;
|
||||
break;
|
||||
case MinLengthAttribute minLength:
|
||||
builder.MinLength = minLength.Length;
|
||||
break;
|
||||
case MaxLengthAttribute maxLength:
|
||||
builder.MaxLength = maxLength.Length;
|
||||
break;
|
||||
case ComplexParameterAttribute complexParameter:
|
||||
{
|
||||
builder.IsComplexParameter = true;
|
||||
|
||||
@@ -28,6 +28,16 @@ namespace Discord.Interactions.Builders
|
||||
/// </summary>
|
||||
public double? MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum length allowed for a string type parameter.
|
||||
/// </summary>
|
||||
public int? MinLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum length allowed for a string type parameter.
|
||||
/// </summary>
|
||||
public int? MaxLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of the choices of this command.
|
||||
/// </summary>
|
||||
@@ -125,6 +135,32 @@ namespace Discord.Interactions.Builders
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets <see cref="MinLength"/>.
|
||||
/// </summary>
|
||||
/// <param name="length">New value of the <see cref="MinLength"/>.</param>
|
||||
/// <returns>
|
||||
/// The builder instance.
|
||||
/// </returns>
|
||||
public SlashCommandParameterBuilder WithMinLength(int length)
|
||||
{
|
||||
MinLength = length;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets <see cref="MaxLength"/>.
|
||||
/// </summary>
|
||||
/// <param name="length">New value of the <see cref="MaxLength"/>.</param>
|
||||
/// <returns>
|
||||
/// The builder instance.
|
||||
/// </returns>
|
||||
public SlashCommandParameterBuilder WithMaxLength(int length)
|
||||
{
|
||||
MaxLength = length;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds parameter choices to <see cref="Choices"/>.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user