create method

  1. @override
Future<ApplicationCommand> create(
  1. covariant ApplicationCommandBuilder builder
)
override

Create a new instance of the type of this manager.

Implementers should ensure this method updates the cache.

Implementation

@override
Future<ApplicationCommand> create(ApplicationCommandBuilder builder) async {
  final route = HttpRoute()..applications(id: applicationId.toString());
  if (_guildId != null) route.guilds(id: _guildId!.toString());
  route.commands();

  final request = BasicRequest(route, method: 'POST', body: jsonEncode(builder.build()));

  final response = await client.httpHandler.executeSafe(request);
  final command = parse(response.jsonBody as Map<String, Object?>);

  client.updateCacheWith(command);
  return command;
}