baptiste0928 / twilight-interactions

Macros and utilities to work with Discord Interactions using twilight.
ISC License
37 stars 7 forks source link

Documentation for Choices #33

Closed khionu closed 6 months ago

khionu commented 1 year ago

I noticed that there doesn't appear to be any documentation for how choices can be defined? Would be great if that could be added

khionu commented 1 year ago

I just noticed that you do have them, but you call choices "options". It would be a breaking change, but I would suggest renaming the trait.

baptiste0928 commented 12 months ago

Hello, thanks for your feedback!

The traits are called CommandOption/CreateOption because they are being used to parse and create command option, not just those with choices. Choices are also not a separate type on the Discord API either, it's an option field of a command option.

There is an implementation of this trait for every type that this library can parse from a command option, so it's not limited to the implementations generated by the choices derive macro.

So I think it's more a problem with the overall documentation of the crate that makes this feature hard to discover than with the name, the trait is correctly named based on what it does.

baptiste0928 commented 6 months ago

I added a mention of command choices in the "supported types" section of the module documentation in the latest pre-release version (https://docs.rs/twilight-interactions/0.16.0-rc.1), linking to the CommandOption/CreateOption traits. I will close the issue for now and will consider a larger refactoring of the documentation if I receive more feedback about similar features being hard to discover.