Display name support for enum type converter (#2156)
* Display name support for enum type converter * allow display attribute on enum type converter * update docs/examples to include enum Display sample * Revert "allow display attribute on enum type converter" This reverts commit a0eec5b7555d366f9de7421f6fcf6bc71f2a4557. * adds ChoiceDisplay for enum type converters * Update EnumChoiceAttribute.cs * fix renamed folder issue * fix namespace Co-authored-by: Xeno <eliotd@gmail.com>
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
[SlashCommand("blep", "Send a random adorable animal photo")]
|
||||
public async Task Blep([Choice("Dog", "dog"), Choice("Cat", "cat"), Choice("Penguin", "penguin")] string animal)
|
||||
public async Task Blep([Choice("Dog", "dog"), Choice("Cat", "cat"), Choice("Guinea pig", "GuineaPig")] string animal)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
// In most cases, you can use an enum to replace the seperate choice attributes in a command.
|
||||
// In most cases, you can use an enum to replace the separate choice attributes in a command.
|
||||
|
||||
public enum Animal
|
||||
{
|
||||
Cat,
|
||||
Dog,
|
||||
Penguin
|
||||
// You can also use the ChoiceDisplay attribute to change how they appear in the choice menu.
|
||||
[ChoiceDisplay("Guinea pig")]
|
||||
GuineaPig
|
||||
}
|
||||
|
||||
[SlashCommand("blep", "Send a random adorable animal photo")]
|
||||
|
||||
Reference in New Issue
Block a user