Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ public DiscordButtonComponent(ButtonStyle style, string customId = null, string
}
}

/// <summary>
/// The custom Id of this button. This is sent back when a user presses it.
/// Applies to buttons with Primary, Secondary, Success, and Danger styles.
/// Link buttons use URLs and Premium buttons use SKU IDs instead of custom IDs.
/// </summary>
[JsonProperty("custom_id", NullValueHandling = NullValueHandling.Ignore)]
public override string? CustomId { get; internal set; } = Guid.NewGuid().ToString();

/// <summary>
/// The style of the button.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions DisCatSharp/Entities/Components/DiscordComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ internal DiscordComponent()
public ComponentType Type { get; internal set; }

/// <summary>
/// The custom Id of this component, if applicable. Not applicable on ActionRow(s) and link buttons.
/// The custom Id of this component, if applicable. Not applicable on ActionRow(s), link buttons, and premium buttons.
/// </summary>
[JsonProperty("custom_id", NullValueHandling = NullValueHandling.Ignore)]
public string? CustomId { get; internal set; } = Guid.NewGuid().ToString();
public virtual string? CustomId { get; internal set; }

/// <summary>
/// Gets the Id of the compenent. Auto populated by discord if not provided.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public DiscordFileUploadComponent(string customId = null, int minOptions = 1, in
this.Required = required;
}

/// <summary>
/// The custom Id of this file upload component. This is sent back when files are uploaded.
/// </summary>
[JsonProperty("custom_id", NullValueHandling = NullValueHandling.Ignore)]
public override string? CustomId { get; internal set; } = Guid.NewGuid().ToString();

/// <summary>
/// Whether this file upload component is required. For modals.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ internal DiscordBaseSelectComponent(ComponentType type, string placeholder, stri
internal DiscordBaseSelectComponent()
{ }

/// <summary>
/// The custom Id of this select component. This is sent back when a user interacts with the select menu.
/// </summary>
[JsonProperty("custom_id", NullValueHandling = NullValueHandling.Ignore)]
public override string? CustomId { get; internal set; } = Guid.NewGuid().ToString();

/// <summary>
/// The text to show when no option is selected.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ public DiscordTextInputComponent(TextComponentStyle style, string? customId = nu
this.Value = defaultValue;
}

/// <summary>
/// The custom Id of this text input component. This is sent back when the form is submitted.
/// </summary>
[JsonProperty("custom_id", NullValueHandling = NullValueHandling.Ignore)]
public override string? CustomId { get; internal set; } = Guid.NewGuid().ToString();

/// <summary>
/// The style of the text input component.
/// </summary>
Expand Down
Loading