Closed archer-321 closed 11 months ago
Interestingly enough, the test passed with the (outdated) version I had in my Cargo.lock
file.
After a quick cargo update
, I could reproduce the failure and push a fix.
@laralove143, I could reproduce the CI failure locally (after setting the necessary environment variables). However, I believe this failure is unrelated to this PR, as the main branch seems to be failing with the same error. Maybe this was introduced by better/worse detection of unused exports in a nightly toolchain update? :thinking:
I believe the CI error this PR is experiencing will be fixed by #2295. I'll rebase the source branch of this PR once 2295 is merged :slightly_smiling_face:
I rebased the PR, and this fixed the CI. Please let me know if there are any other changes you'd like to see c:
This pull request adds the
default_values
field Discord recently introduced for select menus. This field allows selecting default values for auto-populated select menu types (currently,user
,role
,mentionable
, andchannel
).Setting this field to
Some(...)
for any other select menu type is an error at runtime. However, I've changed the twilight-verify implementation to detect mistakes like this before sending the data to Discord.Given the previous decision to implement select menu types as entirely flattened structs, I added the
default_values
field as an option toSelectMenu
. While this doesn't statically enforce the type requirement explained above, this matches the behaviour of other type-specific fields.Testing
I've updated my simple test project to use the feature introduced by this PR. As with my last PR, you can use it to get a quick overview of how the new API works.
Breaking changes
I'm aware of the following breaking change that this PR introduces:
SelectMenu
(exhaustive) received a newdefault_values
field.I've updated the documentation and tests wherever necessary, but if I missed something or you want me to rephrase a comment, please request changes.
I believe you should add the
d-api
andd-breaking
labels to this PR.