build method

  1. @override
RawApiMap build()
override

Returns built response for api

Implementation

@override
RawApiMap build() => {
      "type": type.value,
      "name": name,
      "description": description,
      "default": defaultArg,
      "required": required,
      if (choices != null) "choices": choices!.map((e) => e.build()).toList(),
      if (options != null) "options": options!.map((e) => e.build()).toList(),
      if (channelTypes != null && type == CommandOptionType.channel) "channel_types": channelTypes!.map((e) => e.value).toList(),
      if (min != null) "min_value": min,
      if (max != null) "max_value": max,
      if (localizationsName != null) "name_localizations": localizationsName!.map((k, v) => MapEntry<String, String>(k.toString(), v)),
      if (localizationsDescription != null) "description_localizations": localizationsDescription!.map((k, v) => MapEntry<String, String>(k.toString(), v)),
      "autocomplete": autoComplete,
    };