Class ButtonBuilder
Represents a class used to build Discord.ButtonComponent's.
Assembly: Discord.Net.Core.dll​
View Source​
public class ButtonBuilder
Properties​
Label​
Gets or sets the label of the current button.
View Source​
public string Label { get; set; }
CustomId​
Gets or sets the custom id of the current button.
View Source​
public string CustomId { get; set; }
Style​
Gets or sets the Discord.ButtonStyle of the current button.
View Source​
public ButtonStyle Style { get; set; }
Emote​
Gets or sets the Discord.IEmote of the current button.
View Source​
public IEmote Emote { get; set; }
Url​
Gets or sets the url of the current button.
View Source​
public string Url { get; set; }
IsDisabled​
Gets or sets whether the current button is disabled.
View Source​
public bool IsDisabled { get; set; }
Fields​
MaxButtonLabelLength​
The max length of a Discord.ButtonComponent.Label.
View Source​
public const int MaxButtonLabelLength = 80
Methods​
CreateLinkButton(String, String, IEmote)​
Creates a button with the Discord.ButtonStyle.Link style.
View Source​
public static ButtonBuilder CreateLinkButton(string label, string url, IEmote emote = null)
Returns​
Discord.ButtonBuilder: A builder with the newly created button.
Parameters​
Type | Name | Description |
---|---|---|
System.String | label | The label for this link button. |
System.String | url | The url for this link button to go to. |
Discord.IEmote | emote | The emote for this link button. |
CreateDangerButton(String, String, IEmote)​
Creates a button with the Discord.ButtonStyle.Danger style.
View Source​
public static ButtonBuilder CreateDangerButton(string label, string customId, IEmote emote = null)
Returns​
Discord.ButtonBuilder: A builder with the newly created button.
Parameters​
Type | Name | Description |
---|---|---|
System.String | label | The label for this danger button. |
System.String | customId | The custom id for this danger button. |
Discord.IEmote | emote | The emote for this danger button. |
CreatePrimaryButton(String, String, IEmote)​
Creates a button with the Discord.ButtonStyle.Primary style.
View Source​
public static ButtonBuilder CreatePrimaryButton(string label, string customId, IEmote emote = null)
Returns​
Discord.ButtonBuilder: A builder with the newly created button.
Parameters​
Type | Name | Description |
---|---|---|
System.String | label | The label for this primary button. |
System.String | customId | The custom id for this primary button. |
Discord.IEmote | emote | The emote for this primary button. |
CreateSecondaryButton(String, String, IEmote)​
Creates a button with the Discord.ButtonStyle.Secondary style.
View Source​
public static ButtonBuilder CreateSecondaryButton(string label, string customId, IEmote emote = null)
Returns​
Discord.ButtonBuilder: A builder with the newly created button.
Parameters​
Type | Name | Description |
---|---|---|
System.String | label | The label for this secondary button. |
System.String | customId | The custom id for this secondary button. |
Discord.IEmote | emote | The emote for this secondary button. |
CreateSuccessButton(String, String, IEmote)​
Creates a button with the Discord.ButtonStyle.Success style.
View Source​
public static ButtonBuilder CreateSuccessButton(string label, string customId, IEmote emote = null)
Returns​
Discord.ButtonBuilder: A builder with the newly created button.
Parameters​
Type | Name | Description |
---|---|---|
System.String | label | The label for this success button. |
System.String | customId | The custom id for this success button. |
Discord.IEmote | emote | The emote for this success button. |
WithLabel(String)​
Sets the current buttons label to the specified text.
View Source​
public ButtonBuilder WithLabel(string label)
Returns​
Discord.ButtonBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | label | The text for the label. |
WithStyle(ButtonStyle)​
Sets the current buttons style.
View Source​
public ButtonBuilder WithStyle(ButtonStyle style)
Returns​
Discord.ButtonBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
Discord.ButtonStyle | style | The style for this builders button. |
WithEmote(IEmote)​
Sets the current buttons emote.
View Source​
public ButtonBuilder WithEmote(IEmote emote)
Returns​
Discord.ButtonBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
Discord.IEmote | emote | The emote to use for the current button. |
WithUrl(String)​
Sets the current buttons url.
View Source​
public ButtonBuilder WithUrl(string url)
Returns​
Discord.ButtonBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | url | The url to use for the current button. |
WithCustomId(String)​
Sets the custom id of the current button.
View Source​
public ButtonBuilder WithCustomId(string id)
Returns​
Discord.ButtonBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | id | The id to use for the current button. |
WithDisabled(Boolean)​
Sets whether the current button is disabled.
View Source​
public ButtonBuilder WithDisabled(bool isDisabled)
Returns​
Discord.ButtonBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.Boolean | isDisabled | Whether the current button is disabled or not. |
Build()​
Builds this builder into a Discord.ButtonComponent to be used in a Discord.ComponentBuilder.
View Source​
public ButtonComponent Build()
Returns​
Discord.ButtonComponent: A Discord.ButtonComponent to be used in a Discord.ComponentBuilder.