toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  if (name == null) {
    throw MissingPropertyException('Command name is required');
  }

  if (_description == null) {
    throw MissingPropertyException('Command description is required');
  }

  return {
    'name': name,
    'name_localizations': _nameLocalizations,
    'description': _description,
    'description_localizations': _descriptionLocalizations,
    'type': CommandType.subCommandGroup.value,
    'options': commands.map((e) => e.toJson()).toList(),
  };
}