-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
feat(twilight-model)!: Implement additional select menu types #2219
Commits on Jun 12, 2023
-
feat(twilight-model)!: Implement additional select menu types
This patch implements the additional select menu types `user`, `role`, `mentionable`, and `channel`. Moreover, it moves the type-specific data for the existing text select menu implementation into a separate enum variant. The new types are implemented by "semi-flattening" the `SelectMenu` struct: fields common to all select menu types are implemented in the struct itself, and type-specific fields like the available options or channel types are moved into a `SelectMenuData` enum. This enum is also used to select a select menu's type. This approach de-duplicates the common fields while preventing users from accessing fields irrelevant to the current select menu type. Finally, this commit updates the documentation and existing tests to reflect these changes. The tests, however, might require additional attention in case new behaviour introduced by this commit should be tested as well.
Configuration menu - View commit details
-
Copy full SHA for 1c6ec8f - Browse repository at this point
Copy the full SHA 1c6ec8fView commit details
Commits on Jun 13, 2023
-
refactor(twilight-model): Use unreachable! in ComponentVisitor
This patch makes `ComponentVisitor::visit_map` use `unreachable!` instead of `panic!` in case a select menu type was not implemented while being listed in a previous match statement. Moreover, this commit sneaks in a minor formatting fix inside `Components` doc-comment example.
Configuration menu - View commit details
-
Copy full SHA for b545e9e - Browse repository at this point
Copy the full SHA b545e9eView commit details -
feat(twilight-model)!: Implement
resolved
for select menu interactionsThis commit implements the `resolved` field for `MessageComponentInteraction`. This field holds resolved users, roles, channels, or attachments for select menu interactions. Unfortunately, the new field makes it impossible to implement `Eq` and `Hash` for `MessageComponentInteractionData`.
Configuration menu - View commit details
-
Copy full SHA for e8fffb2 - Browse repository at this point
Copy the full SHA e8fffb2View commit details -
test(twilight-model): Fix tests for
InteractionDataResolved
This commit fixes the tests testing the (de-)serialization of `InteractionDataResolved`. Previously, the tests were failing, as the type was renamed from `CommandInteractionDataResolved`. Moreover, this commit fixes the message component interaction tests by adding the missing `resolved` field to the expected fields in `message_component_interaction_data`.
Configuration menu - View commit details
-
Copy full SHA for 52f6e47 - Browse repository at this point
Copy the full SHA 52f6e47View commit details
Commits on Jun 14, 2023
-
refactor(twilight-model)!: Un-
Box
SelectMenuData
variantsThis commit unboxes `SelectMenuData`'s variants. They were boxed in a previous patch to prevent future fields from unnecessarily increasing the enum's memory footprint, but considering that, with the current structures, new fields are a breaking change already, it's OK to leave the variants unboxed for now and re-box as necessary. For the current code, this saves a heap allocation while only marginally increasing the enum's memory footprint. This change is only breaking in the context of PR twilight-rs#2219. When added to the commits in this PR, it doesn't add any breaking changes to the PR's list of breaking changes.
Configuration menu - View commit details
-
Copy full SHA for c9a1a7f - Browse repository at this point
Copy the full SHA c9a1a7fView commit details
Commits on Jun 24, 2023
-
refactor(twilight-model)!: Fully flatten SelectMenu
This commit removes the SelectMenuData type and embeds all variant-specific fields in the base struct. Moreover, it adds documentation indicating which fields are required variant-specific fields. This commit also updates the component validation module in `twilight-validate` by introducing a new error type for text select menus that don't have the necessary `options` field.
Configuration menu - View commit details
-
Copy full SHA for c774adc - Browse repository at this point
Copy the full SHA c774adcView commit details
Commits on Jun 25, 2023
-
docs(twilight-model)!: Streamline select menu documentation
This commit streamlines the language in the `SelectMenu` and `SelectMenuType` documentation. In particular, it removes duplicated sections outlining required and optional fields. Moreover, it makes language describing which menu types use a specific option more in line with the rest of the library.
Configuration menu - View commit details
-
Copy full SHA for ab68bfb - Browse repository at this point
Copy the full SHA ab68bfbView commit details