getButtonSelection<T> abstract method

Future<T> getButtonSelection<T>(
  1. List<T> values,
  2. MessageBuilder builder,
  3. {Map<T, ButtonStyle>? styles,
  4. bool authorOnly = true,
  5. ResponseLevel? level,
  6. Duration? timeout,
  7. FutureOr<ButtonBuilder> toButton(
    1. T
    )?,
  8. Converter<T>? converterOverride}
)

Get a selection from a user, presenting the options as an array of buttons.

If styles is set, the style of a button presenting a given option will depend on the value set in the map.

If timeout is set, this method will complete with an error after timeout has passed.

If authorOnly is set, only the author of this interaction will be able to interact with a button.

level will change the level at which the message is sent, similarly to respond.

toButton and converterOverride can be set to change how each value is converted to a button. At most one of them may be set, and the default is to use Converter.toButton on the default conversion for T.

You might also be interested in:

  • getButtonPress, for getting a button press from any button on a message;
  • getSelection, for getting a selection from a multi-select menu;
  • getConfirmation, for getting a basic true/false selection from the user.

Implementation

Future<T> getButtonSelection<T>(
  List<T> values,
  MessageBuilder builder, {
  Map<T, ButtonStyle>? styles,
  bool authorOnly = true,
  ResponseLevel? level,
  Duration? timeout,
  FutureOr<ButtonBuilder> Function(T)? toButton,
  Converter<T>? converterOverride,
});