> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Update Auto Moderation rule

> Update a Discord Auto Moderation rule.

`discord.updateAutomodRule` updates a Discord Auto Moderation rule.

```ts automations/discord-update-automod-rule.automation.ts theme={null}
import { automation, onHttpRequest } from "automate.ax"
import { discord } from "automate.ax/discord"

export default automation("Update Auto Moderation rule", () => {
  onHttpRequest({ scope: "automation" })
  discord.updateAutomodRule({
    guildId: "123456789012345678",
    ruleId: "345678901234567890",
    enabled: false,
  })
})
```

## Inputs

Required server and rule IDs. Provide any matching, action, exemption, name, event, or enabled fields plus optional audit-log `reason`. A rule's `triggerType` cannot change after creation. Optional second argument `{ account }` selects the Discord binding.

## Output

Returns the updated `DiscordAutomodRule`.

## Discord behavior

Requires `MANAGE_GUILD`; fields omitted from the input remain unchanged. A trigger-dependent update first reads the existing rule so Automate.ax can validate its immutable trigger type before sending the change. A supplied `presets` list must contain at least one entry. You can provide up to three actions with unique action types. `sendAlert` actions require `channelId`, `timeoutMember` actions require `durationSeconds`, and `blockMessage` actions accept optional `customMessage`. Timeout also requires `MODERATE_MEMBERS`.
