Choices class

An annotation used to restrict input to a set of choices for a given parameter.

Note that this is only a client-side verification for Slash Commands only, input from text commands might not be one of the options.

For example, adding three choices to a command:

ChatCommand test = ChatCommand(
  'test',
  'A test command',
  (
    IChatContext context,
    @Choices({'Foo': 'foo', 'Bar': 'bar', 'Baz': 'baz'}) String message,
  ) async {
    context.respond(MessageBuilder.content(message));
  },
);

commands.addCommand(test);

Constructors

Choices(Map<String, dynamic> choices)
Create a new Choices.
const

Properties

builders Iterable<CommandOptionChoiceBuilder>
Get the builders that this Choices represents.
no setter
choices Map<String, dynamic>
The choices for this command.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited