Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Doc94
Copy link
Member

@Doc94 Doc94 commented Feb 19, 2025

Description: Add support for Components V2
Depends on: Discord4J/discord-json#198
Notes:

  • This new flag disable the use of content/embed for create messages.

@Doc94 Doc94 changed the base branch from master to 3.2.x February 19, 2025 15:28
@Doc94 Doc94 added area/core Related to core module: events, entities, clients, specs area/interactions Related to Discord Interactions feature labels Feb 19, 2025
@Doc94 Doc94 marked this pull request as ready for review February 19, 2025 20:32
@Doc94
Copy link
Member Author

Doc94 commented Feb 19, 2025

Example.

MessageCreateSpec messageCreateSpec = MessageCreateSpec.create().withFlags(Message.Flag.IS_COMPONENTS_V2);
        messageCreateSpec = messageCreateSpec.withComponents(Arrays.asList(
            SectionComponent.of(
                ThumbnailComponent.of(UnfurledMediaItem.of("https://raw.githubusercontent" +
                    ".com/EterNityCH/paperchan/refs/heads/main/Paper%20Chan%20Emojis/PadoruPaper%20GIF%20version.gif")),
                Arrays.asList(
                    TextDisplayComponent.of("Get Paper"),
                    TextDisplayComponent.of("https://papermc.io/downloads/paper")
                )),
            SeparatorComponent.of(true, SeparatorComponent.SpacingSize.LARGE),
            ContainerComponent.of(Color.BLUE, false, Arrays.asList(
                TextDisplayComponent.of("RANDOM"),
                MediaGalleryComponent.of(
                    MediaGalleryItem.of(UnfurledMediaItem.of("https://raw.githubusercontent" +
                        ".com/EterNityCH/paperchan/refs/heads/main/Paper%20Chan%20Emojis/Emoji%20paperOhhh.png")),
                    MediaGalleryItem.of(UnfurledMediaItem.of("https://raw.githubusercontent" +
                        ".com/EterNityCH/paperchan/refs/heads/main/Paper%20Chan%20Emojis/Emoji%20paperUwU.png"), "uwu"),
                    MediaGalleryItem.of(UnfurledMediaItem.of("https://raw.githubusercontent" +
                        ".com/EterNityCH/paperchan/refs/heads/main/Paper%20Chan%20Emojis/notlikepaper.gif"), "nl", true)
                )
            ))
        ));

looks like
image

@Doc94 Doc94 self-assigned this Feb 20, 2025
@Azn9
Copy link
Member

Azn9 commented Feb 28, 2025

I think we should rename "ActionComponent" to "InteractiveComponent" to match discord's documentation

@Azn9
Copy link
Member

Azn9 commented Feb 28, 2025

I don't think that TextInput should extends ActionComponent as it does not produces an interaction but it would break action rows 😭

@Doc94
Copy link
Member Author

Doc94 commented Feb 28, 2025

I think we should rename "ActionComponent" to "InteractiveComponent" to match discord's documentation

sounds good currently already make break changes based in the start of the components here xd

@Doc94
Copy link
Member Author

Doc94 commented Feb 28, 2025

I don't think that TextInput should extends ActionComponent as it does not produces an interaction but it would break action rows 😭

hmmm i mean its true but just keep MessageComponent also feels strange for later how handle in rows...

- Reorder hierarchy with IAccessoryComponent, ICanBeUsedInContainerComponent and ICanBeUsedInSectionComponent
- Add component id support
- Add missing load state and proxy url for UnfurledMediaItem
- Fix many javadocs
@Azn9 Azn9 force-pushed the feature/support-components-v2 branch from 0f1a001 to e81fd17 Compare March 1, 2025 19:02
Copy link
Member

@Azn9 Azn9 left a comment

Choose a reason for hiding this comment

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

Looks good for me for a release!

@Doc94
Copy link
Member Author

Doc94 commented Mar 2, 2025

@Azn9 Azn9 merged commit 979c949 into Discord4J:3.2.x Mar 5, 2025
1 check passed
Azn9 added a commit that referenced this pull request Mar 5, 2025
@Doc94 Doc94 deleted the feature/support-components-v2 branch March 6, 2025 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Related to core module: events, entities, clients, specs area/interactions Related to Discord Interactions feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants