Browse Source

Update ButtonComponent summaries and boolean fields

pull/1923/head
quin lynch 3 years ago
parent
commit
28f8ac85ad
3 changed files with 13 additions and 15 deletions
  1. +10
    -12
      src/Discord.Net.Core/Entities/Interactions/Message Components/ButtonComponent.cs
  2. +2
    -2
      src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs
  3. +1
    -1
      src/Discord.Net.Rest/API/Common/ButtonComponent.cs

+ 10
- 12
src/Discord.Net.Core/Entities/Interactions/Message Components/ButtonComponent.cs View File

@@ -16,27 +16,25 @@ namespace Discord
public ComponentType Type { get; } = ComponentType.Button; public ComponentType Type { get; } = ComponentType.Button;


/// <summary> /// <summary>
/// The <see cref="ButtonStyle"/> of this button, example buttons with each style can be found <see href="https://discord.com/assets/7bb017ce52cfd6575e21c058feb3883b.png">Here</see>.
/// Gets the <see cref="ButtonStyle"/> of this button, example buttons with each style can be found <see href="https://discord.com/assets/7bb017ce52cfd6575e21c058feb3883b.png">Here</see>.
/// </summary> /// </summary>
public ButtonStyle Style { get; } public ButtonStyle Style { get; }


/// <summary> /// <summary>
/// The label of the button, this is the text that is shown.
/// Gets the label of the button, this is the text that is shown.
/// </summary> /// </summary>
public string Label { get; } public string Label { get; }


/// <summary> /// <summary>
/// A <see cref="IEmote"/> that will be displayed with this button.
/// Gets the <see cref="IEmote"/> displayed with this button.
/// </summary> /// </summary>
public IEmote Emote { get; } public IEmote Emote { get; }


/// <summary>
/// A unique id that will be sent with a <see cref="IDiscordInteraction"/>. This is how you know what button was pressed.
/// </summary>
/// <inheritdoc/>
public string CustomId { get; } public string CustomId { get; }


/// <summary> /// <summary>
/// A URL for a <see cref="ButtonStyle.Link"/> button.
/// Gets the URL for a <see cref="ButtonStyle.Link"/> button.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// You cannot have a button with a <b>URL</b> and a <b>CustomId</b>. /// You cannot have a button with a <b>URL</b> and a <b>CustomId</b>.
@@ -44,9 +42,9 @@ namespace Discord
public string Url { get; } public string Url { get; }


/// <summary> /// <summary>
/// Whether this button is disabled or not.
/// Gets whether this button is disabled or not.
/// </summary> /// </summary>
public bool Disabled { get; }
public bool IsDisabled { get; }


/// <summary> /// <summary>
/// Turns this button into a button builder. /// Turns this button into a button builder.
@@ -55,16 +53,16 @@ namespace Discord
/// A newly created button builder with the same properties as this button. /// A newly created button builder with the same properties as this button.
/// </returns> /// </returns>
public ButtonBuilder ToBuilder() public ButtonBuilder ToBuilder()
=> new ButtonBuilder(Label, CustomId, Style, Url, Emote, Disabled);
=> new ButtonBuilder(Label, CustomId, Style, Url, Emote, IsDisabled);


internal ButtonComponent(ButtonStyle style, string label, IEmote emote, string customId, string url, bool disabled)
internal ButtonComponent(ButtonStyle style, string label, IEmote emote, string customId, string url, bool isDisabled)
{ {
Style = style; Style = style;
Label = label; Label = label;
Emote = emote; Emote = emote;
CustomId = customId; CustomId = customId;
Url = url; Url = url;
Disabled = disabled;
IsDisabled = isDisabled;
} }
} }
} }

+ 2
- 2
src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs View File

@@ -69,7 +69,7 @@ namespace Discord
switch (component) switch (component)
{ {
case ButtonComponent button: case ButtonComponent button:
WithButton(button.Label, button.CustomId, button.Style, button.Emote, button.Url, button.Disabled, row);
WithButton(button.Label, button.CustomId, button.Style, button.Emote, button.Url, button.IsDisabled, row);
break; break;
case ActionRowComponent actionRow: case ActionRowComponent actionRow:
foreach (var cmp in actionRow.Components) foreach (var cmp in actionRow.Components)
@@ -451,7 +451,7 @@ namespace Discord
Style = button.Style; Style = button.Style;
Url = button.Url; Url = button.Url;
Label = button.Label; Label = button.Label;
IsDisabled = button.Disabled;
IsDisabled = button.IsDisabled;
Emote = button.Emote; Emote = button.Emote;
} }




+ 1
- 1
src/Discord.Net.Rest/API/Common/ButtonComponent.cs View File

@@ -39,7 +39,7 @@ namespace Discord.API
Label = c.Label; Label = c.Label;
CustomId = c.CustomId; CustomId = c.CustomId;
Url = c.Url; Url = c.Url;
Disabled = c.Disabled;
Disabled = c.IsDisabled;


if (c.Emote != null) if (c.Emote != null)
{ {


Loading…
Cancel
Save