/
ModalTextInputAttribute.cs
55 lines (49 loc) · 2.04 KB
/
ModalTextInputAttribute.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
namespace Discord.Interactions
{
/// <summary>
/// Marks a <see cref="IModal"/> property as a text input.
/// </summary>
public sealed class ModalTextInputAttribute : ModalInputAttribute
{
/// <inheritdoc/>
public override ComponentType ComponentType => ComponentType.TextInput;
/// <summary>
/// Gets the style of the text input.
/// </summary>
public TextInputStyle Style { get; }
/// <summary>
/// Gets the placeholder of the text input.
/// </summary>
public string Placeholder { get; }
/// <summary>
/// Gets the minimum length of the text input.
/// </summary>
public int MinLength { get; }
/// <summary>
/// Gets the maximum length of the text input.
/// </summary>
public int MaxLength { get; }
/// <summary>
/// Gets the initial value to be displayed by this input.
/// </summary>
public string InitialValue { get; }
/// <summary>
/// Create a new <see cref="ModalTextInputAttribute"/>.
/// </summary>
/// <param name="customId">The custom id of the text input.></param>
/// <param name="style">The style of the text input.</param>
/// <param name="placeholder">The placeholder of the text input.</param>
/// <param name="minLength">The minimum length of the text input's content.</param>
/// <param name="maxLength">The maximum length of the text input's content.</param>
/// <param name="initValue">The initial value to be displayed by this input.</param>
public ModalTextInputAttribute(string customId, TextInputStyle style = TextInputStyle.Short, string placeholder = null, int minLength = 1, int maxLength = 4000, string initValue = null)
: base(customId)
{
Style = style;
Placeholder = placeholder;
MinLength = minLength;
MaxLength = maxLength;
InitialValue = initValue;
}
}
}