setEnabled method

Future<void> setEnabled(
  1. bool value, {
  2. String? reason,
})

Update enabled of this

Example :

await rule.setEnabled(true);

Implementation

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

  if (response.statusCode == 200) {
    enabled = value;
  }
}