nyxx/nyxx.interactions/lib/src/Models/CommandArgs/ArgChoice.dart
2021-03-29 21:17:34 +02:00

24 lines
719 B
Dart

part of nyxx_interactions;
/// A specified choice for a slash command argument.
class ArgChoice {
/// This options name.
late final String name;
/// This is the options value, must be int or string
late final dynamic value;
/// A Choice for the user to input in int & string args. You can only have an int or string option.
ArgChoice(this.name, dynamic value) {
if (value is String || value is int) {
this.value = value;
}
if (value is! int && value is! String) {
throw "InvalidParamTypeError: Please send a string if its a string arg or an int if its an int arg.";
}
}
Map<String, dynamic> _build() => {"name": this.name, "value": this.value};
}