Kord-Extensions/kord-extensions

Make enum choice converters act the same as regular enum converters in the context of chat commands

russellbanks opened this issue · 3 comments

Summary

When using an enum choice converter on a chat command, it will result in an java.lang.IllegalStateException: Choice converters may only be used with slash commands error. In the use case of hybrid commands, it would beneficial to ensure that a hybrid command, utilising an enum choice, can work with a slash command whilst not failing as a chat command.

Current Behaviour

Using an enum choice on a chat command results in a java.lang.IllegalStateException: Choice converters may only be used with slash commands error.

Preferred Behaviour

An enum choice converter for a chat command should work the same as a normal enum choice converter.

Suggestions

#1 of Kordex hybrid commands documents this better.

Media

Using a command with a choice converter:
image

Using the equivalent chat command:
image

Hello, and thanks for opening an issue! As this is the first time you've created an issue on this repository, we'd just like to offer you a warm welcome to the project, and the following pointers:

  • Most importantly, all issues must adhere to our Code of Conduct. Please give it a quick read if you haven't already.

  • While our team is passionate about the projects we've created here, we're all volunteers. Please don't be offended if it takes time for us to get to your issue - we'll be here as soonas we can be!

  • Please provide as much information as possible when asking a question, reporting a problem, or submitting a feature request. This will help us to address your issue quickly and efficiently. If you forgot to add some information, no worries - feel free to edit the issue and add anything you missed!

    Thanks for contacting us! If you have any further questions, please feel free to join us on Discord in the #dev-kotdis channel (or #kordex-discussion for Kord Extensions projects), or to contact a staff member directly.

I think we could probably fix up converters a bit like this - I agree that supporting both in the same converter is likely to be the best option.

I'm not sure whether I'll get a chance to work on this soon, however, so I'd suggest making use of the latest snapshot (1.5.2-SNAPSHOT) and using a regular enum converter with an autoComplete set up as a workaround temporarily.