Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 23, 2025

Description

CustomId was defined in DiscordComponent base class with a default Guid.NewGuid() value, causing it to be serialized on link buttons (which use URLs) and premium buttons (which use SKU IDs).

Changed CustomId to a virtual property in DiscordComponent without a default value. Override it with Guid.NewGuid() in the 4 component types that require it:

  • DiscordButtonComponent
  • DiscordBaseSelectComponent
  • DiscordTextInputComponent
  • DiscordFileUploadComponent

Link and premium buttons now inherit the base property without default initialization, preventing invalid custom_id serialization.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Existing test suite passes without modifications
  • Build succeeds across all target frameworks (net8.0, net9.0, net10.0)

Test Configuration:

  • SDK: .NET 8.0, 9.0, 10.0

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@Aiko-IT-Systems/discatsharp

Original prompt

This section details on the original issue you should resolve

<issue_title>Custom ID is set on component where it shouldn't</issue_title>
<issue_description>We have the CustomId field at https://github.com/Aiko-IT-Systems/DisCatSharp/blob/main/DisCatSharp%2FEntities%2FComponents%2FDiscordComponent.cs#L28-L32

It should be in the DiscordButtonComponent class tho. Right now it would also set custom id for link and premium buttons, but they can't have a custom ID. This field needs to be completely moved. Additionally it needs to be copied over to DiscordBaseSelectComponent. </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 23, 2025 22:44
Co-Authored-By: copilot-swe-agent[bot] <[email protected]>

Co-authored-by: Lulalaby <[email protected]>
Copilot AI changed the title [WIP] Move CustomId field to DiscordButtonComponent Fix CustomId incorrectly set on link and premium buttons Nov 23, 2025
Copilot AI requested a review from Lulalaby November 23, 2025 22:51
@Lulalaby Lulalaby marked this pull request as ready for review November 23, 2025 22:53
@Lulalaby Lulalaby requested a review from a team as a code owner November 23, 2025 22:53
@Lulalaby Lulalaby merged commit f75bb54 into main Nov 23, 2025
13 of 14 checks passed
@Lulalaby Lulalaby deleted the copilot/move-custom-id-to-button-component branch November 23, 2025 22:56

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Custom ID is set on component where it shouldn't

2 participants