create method

  1. @override
Future<GuildEmoji> create(
  1. covariant EmojiBuilder builder,
  2. {String? auditLogReason}
)
override

Create a new instance of the type of this manager.

Implementers should ensure this method updates the cache.

Implementation

@override
Future<GuildEmoji> create(EmojiBuilder builder, {String? auditLogReason}) async {
  _checkIsConcrete();

  final route = HttpRoute()
    ..guilds(id: guildId.toString())
    ..emojis();
  final request = BasicRequest(route, method: 'POST', body: jsonEncode(builder.build()), auditLogReason: auditLogReason);

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

  client.updateCacheWith(emoji);
  return emoji;
}