kord-extensions icon indicating copy to clipboard operation
kord-extensions copied to clipboard

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

Open russellbanks opened this issue 3 years ago • 2 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

russellbanks avatar Feb 25 '22 00:02 russellbanks

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.

boring-cyborg[bot] avatar Feb 25 '22 00:02 boring-cyborg[bot]

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.

gdude2002 avatar Mar 16 '22 10:03 gdude2002

This has just been pushed to 1.8.1-SNAPSHOT, and should be available in about 15 minutes. Thanks for your patience!

Chat commands should now support choice converters. Users may specify either the keys or values (case-insensitively wherever strings are involved) and an error showing the possible values will be returned if nothing matches.

The new documentation site has been updated to match this change.

gdude2002 avatar Jun 03 '24 10:06 gdude2002