Skip to content

components v2 #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 19, 2025
Merged

components v2 #426

merged 5 commits into from
Apr 19, 2025

Conversation

topi314
Copy link
Member

@topi314 topi314 commented Feb 28, 2025

No description provided.

@topi314 topi314 self-assigned this Feb 28, 2025
@topi314 topi314 force-pushed the feature/components-v2 branch from 6f3877c to b9dc7f3 Compare March 3, 2025 22:36
@topi314 topi314 changed the base branch from master to patch/go-v1.24 March 3, 2025 22:43
@topi314
Copy link
Member Author

topi314 commented Mar 3, 2025

TODO:

  • add missing With methods on components
  • rethink how modals present components

@topi314 topi314 added this to the v0.19 milestone Mar 3, 2025
@topi314 topi314 changed the base branch from patch/go-v1.24 to v0.19 March 3, 2025 23:36
@topi314 topi314 force-pushed the feature/components-v2 branch from b9dc7f3 to a4c16e4 Compare March 3, 2025 23:46
@topi314 topi314 force-pushed the feature/components-v2 branch from 90a29dd to bac9837 Compare March 4, 2025 20:55
@topi314 topi314 marked this pull request as ready for review March 4, 2025 20:56
@topi314 topi314 requested a review from sebm253 March 4, 2025 20:57
@topi314 topi314 requested a review from Copilot March 11, 2025 19:43
Copy link

@Copilot 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 upgrades the component system to version 2 by replacing the old ContainerComponent types with LayoutComponent types throughout the codebase. Key changes include renaming and updating methods and builders (e.g., SetComponents, AddComponents, etc.), updating JSON unmarshaling for modal interactions, and adjusting tests and examples to align with the new design.

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
_examples/componentsv2/example.go New example demonstrating usage of the v2 component structure
discord/component_iter.go and _test.go New iterator implementation and test for iterating over LayoutComponents
discord/select_menu.go Updated select menu components to use LayoutComponent and new method names
discord/interaction_modal_submit.go Modified JSON unmarshaling for modal submit interactions to use a slice of LayoutComponent
discord/_builder.go / message.go Refactored builder methods and message structures to replace ContainerComponent with LayoutComponent
discord/interaction_component.go Refactored variable declarations for consistency
_examples/test/examplebot.go Updated import order to support component v2 changes
Comments suppressed due to low confidence (1)

discord/interaction_modal_submit.go:101

  • The updated unmarshaling logic now directly appends container components without iterating over subcomponents as before. Please verify that flattening nested components is no longer required for ModalSubmitInteractionData.
components = append(components, containerComponent.Component.(LayoutComponent))

@topi314 topi314 merged commit 934f6b8 into v0.19 Apr 19, 2025
4 checks passed
@topi314 topi314 deleted the feature/components-v2 branch April 19, 2025 10:08
apricotbucket28 pushed a commit to apricotbucket28/disgo that referenced this pull request Apr 19, 2025
topi314 added a commit that referenced this pull request Apr 21, 2025
topi314 added a commit that referenced this pull request Apr 21, 2025
topi314 added a commit that referenced this pull request May 14, 2025
topi314 added a commit that referenced this pull request May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants