setEventType method

Future<void> setEventType(
  1. ModerationEventType event, {
  2. String? reason,
})

Update the event of this

Example :

await rule.setEventType(ModerationEventType.messageSend);

Implementation

Future<void> setEventType(ModerationEventType event, { String? reason }) async {
  Response response = await ioc.use<DiscordApiHttpService>().patch(url: "/guilds/$guildId/auto-moderation/rules/$id")
    .payload({ 'event_type': event.value })
    .auditLog(reason)
    .build();

  if (response.statusCode == 200) {
    eventType = event;
  }
}