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;

/// <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>
public ButtonStyle Style { get; }

/// <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>
public string Label { get; }

/// <summary>
/// A <see cref="IEmote"/> that will be displayed with this button.
/// Gets the <see cref="IEmote"/> displayed with this button.
/// </summary>
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; }

/// <summary>
/// A URL for a <see cref="ButtonStyle.Link"/> button.
/// Gets the URL for a <see cref="ButtonStyle.Link"/> button.
/// </summary>
/// <remarks>
/// 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; }

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

/// <summary>
/// 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.
/// </returns>
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;
Label = label;
Emote = emote;
CustomId = customId;
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)
{
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;
case ActionRowComponent actionRow:
foreach (var cmp in actionRow.Components)
@@ -451,7 +451,7 @@ namespace Discord
Style = button.Style;
Url = button.Url;
Label = button.Label;
IsDisabled = button.Disabled;
IsDisabled = button.IsDisabled;
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;
CustomId = c.CustomId;
Url = c.Url;
Disabled = c.Disabled;
Disabled = c.IsDisabled;

if (c.Emote != null)
{


Loading…
Cancel
Save