Skip to content

Commit 751a71d

Browse files
committed
add modal select menu option attribute
1 parent 3e5e196 commit 751a71d

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System;
2+
3+
namespace Discord.Interactions.Attributes.Modals;
4+
5+
/// <summary>
6+
/// Adds a select menu option to the marked field.
7+
/// </summary>
8+
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
9+
public class ModalSelectMenuOptionAttribute : Attribute
10+
{
11+
/// <summary>
12+
/// Gets the label of the option.
13+
/// </summary>
14+
public string Label { get; }
15+
16+
/// <summary>
17+
/// Gets or sets the description of the option.
18+
/// </summary>
19+
public string Description { get; set; }
20+
21+
/// <summary>
22+
/// Gets the value of the option.
23+
/// </summary>
24+
public string Value { get; }
25+
26+
/// <summary>
27+
/// Gets or sets the emote of the option.
28+
/// </summary>
29+
public string Emote { get; set; }
30+
31+
/// <summary>
32+
/// Gets or sets whether the option is selected by default.
33+
/// </summary>
34+
public bool IsDefault { get; set; }
35+
36+
/// <summary>
37+
/// Create a new <see cref="ModalSelectInputAttribute"/>.
38+
/// </summary>
39+
/// <param name="label">Label of the option.</param>
40+
/// <param name="value">Value of the option.</param>
41+
/// <param name="description">Description of the option.</param>
42+
/// <param name="emote">Emote of the option.</param>
43+
/// <param name="isDefault">Whether the option is selected by default</param>
44+
public ModalSelectMenuOptionAttribute(string label, string value, string description = null, string emote = null, bool isDefault = false)
45+
{
46+
Label = label;
47+
Value = value;
48+
Description = description;
49+
Emote = emote;
50+
IsDefault = isDefault;
51+
}
52+
}

0 commit comments

Comments
 (0)