create method
Future<AutoModerationRule>
create(
- covariant AutoModerationRuleBuilder builder, {
- String? auditLogReason,
override
Create a new instance of the type of this manager.
Implementers should ensure this method updates the cache.
Implementation
@override
Future<AutoModerationRule> create(AutoModerationRuleBuilder builder, {String? auditLogReason}) async {
final route = HttpRoute()
..guilds(id: guildId.toString())
..autoModeration()
..rules();
final request = BasicRequest(route, method: 'POST', body: jsonEncode(builder.build()), auditLogReason: auditLogReason);
final response = await client.httpHandler.executeSafe(request);
final rule = parse(response.jsonBody as Map<String, Object?>);
client.updateCacheWith(rule);
return rule;
}