setActions method

Future<void> setActions(
  1. List<ModerationAction> actions
)

Update actions of this

Example :

final channel = guild.channels.cache.get('240561194958716924');

final action = ModerationAction(
  metadata: ModerationActionMetadata(duration: 3000, channel: channel),
  type: ModerationActionType.sendAlertMessage
);

await rule.setActions([action]);

Implementation

Future<void> setActions(List<ModerationAction> actions) async {
  Response response = await ioc.use<HttpService>().patch(url: "/guilds/$guildId/auto-moderation/rules/$id", payload: {
    'actions': actions.map((ModerationAction action) => action.toJson())
  });

  if (response.statusCode == 200) {
    this.actions = actions;
  }
}