Skip to content

Conversation

@Lulalaby
Copy link
Member

Description

Introduces DiscordRadioGroupComponent, DiscordCheckboxGroupComponent, and DiscordCheckboxComponent for modal-only usage, along with their option classes. Updates validation logic to restrict these components to modals, extends serialization and deserialization support, and adds new ComponentType enum values. Also adds builder methods to DiscordLabelComponent for attaching these new components.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

Introduces DiscordRadioGroupComponent, DiscordCheckboxGroupComponent, and DiscordCheckboxComponent for modal-only usage, along with their option classes. Updates validation logic to restrict these components to modals, extends serialization and deserialization support, and adds new ComponentType enum values. Also adds builder methods to DiscordLabelComponent for attaching these new components.
@Lulalaby Lulalaby marked this pull request as ready for review January 21, 2026 02:22
@Lulalaby Lulalaby requested a review from a team as a code owner January 21, 2026 02:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces modal-only radio and checkbox components to DisCatSharp, expanding Discord's component system with new input types. The implementation adds three new component types (RadioGroup, CheckboxGroup, and Checkbox) along with their corresponding option classes, updates serialization/deserialization logic, adds validation to prevent these components from being used outside modals, and provides builder methods on DiscordLabelComponent for attaching these new components.

Changes:

  • Added ComponentType enum values for CheckpointCard (20), RadioGroup (21), CheckboxGroup (22), and Checkbox (23)
  • Implemented DiscordRadioGroupComponent, DiscordCheckboxGroupComponent, and DiscordCheckboxComponent with their respective option classes
  • Extended serialization support in ILabelComponentJsonConverter and DiscordComponentJsonConverter
  • Added modal-only validation logic to DisCatSharpBuilder and DiscordApiClient
  • Added builder methods to DiscordLabelComponent (WithRadioGroupComponent, WithCheckboxGroupComponent, WithCheckboxComponent) and implemented GetChildren() override

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
DisCatSharp/Enums/Interaction/ComponentType.cs Adds four new component type enum values (CheckpointCard, RadioGroup, CheckboxGroup, Checkbox) with XML documentation
DisCatSharp/Entities/Components/V2Components/DiscordRadioGroupComponent.cs Implements radio group component with options list, custom ID, and required field support
DisCatSharp/Entities/Components/V2Components/DiscordRadioGroupComponentOption.cs Defines radio group option class with label, value, description, and default flag
DisCatSharp/Entities/Components/V2Components/DiscordCheckboxGroupComponent.cs Implements checkbox group component with min/max value constraints
DisCatSharp/Entities/Components/V2Components/DiscordCheckboxGroupComponentOption.cs Defines checkbox group option class with label, value, description, and default flag
DisCatSharp/Entities/Components/V2Components/DiscordCheckboxComponent.cs Implements single checkbox component with default state support
DisCatSharp/Entities/Components/DiscordLabelComponent.cs Adds three new builder methods for attaching radio/checkbox components and implements GetChildren() to support component traversal
DisCatSharp/Net/Serialization/ILabelComponentJsonConverter.cs Extends deserialization to handle RadioGroup, CheckboxGroup, and Checkbox component types
DisCatSharp/Net/Serialization/DiscordComponentJsonConverter.cs Extends component instantiation to support the three new component types
DisCatSharp/Entities/Core/DisCatSharpBuilder.cs Adds validation logic to prevent modal-only components from being used in non-modal contexts
DisCatSharp/Net/Rest/DiscordApiClient.cs Updates modal response validation to allow RadioGroup, CheckboxGroup, and Checkbox component types

@Lulalaby
Copy link
Member Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Jan 21, 2026

@Lulalaby I've opened a new pull request, #755, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 6 commits January 21, 2026 03:24
Co-Authored-By: copilot-swe-agent[bot] <[email protected]>

Co-authored-by: Lulalaby <[email protected]>
Co-Authored-By: copilot-swe-agent[bot] <[email protected]>

Co-authored-by: Lulalaby <[email protected]>
Checkboxes can only be children of DiscordLabelComponent, not top-level modal components. This fixes the validation to properly allow checkboxes only when nested in labels.

Co-Authored-By: copilot-swe-agent[bot] <[email protected]>

Co-authored-by: Lulalaby <[email protected]>
Co-Authored-By: copilot-swe-agent[bot] <[email protected]>

Co-authored-by: Lulalaby <[email protected]>
fix: address PR #754 review feedback - validation, grammar, and formatting
@Lulalaby Lulalaby merged commit d10437d into main Jan 21, 2026
6 checks passed
@Lulalaby Lulalaby deleted the feat/checkboxes branch January 21, 2026 03:49
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.

2 participants