ChatGroup constructor

ChatGroup(
  1. String name,
  2. String description,
  3. {List<String> aliases = const [],
  4. Iterable<ChatCommandComponent> children = const [],
  5. Iterable<AbstractCheck> checks = const [],
  6. CommandOptions options = const CommandOptions(),
  7. Map<Locale, String>? localizedNames,
  8. Map<Locale, String>? localizedDescriptions}
)

Create a new ChatGroup.

Implementation

ChatGroup(
  this.name,
  this.description, {
  this.aliases = const [],
  Iterable<ChatCommandComponent> children = const [],
  Iterable<AbstractCheck> checks = const [],
  this.options = const CommandOptions(),
  this.localizedNames,
  this.localizedDescriptions,
}) {
  if (!commandNameRegexp.hasMatch(name) || name != name.toLowerCase()) {
    throw CommandRegistrationError('Invalid group name "$name"');
  }

  for (final child in children) {
    addCommand(child);
  }

  for (final check in checks) {
    super.check(check);
  }
}