# Configuration

URL: https://zerodev.ca/docs/advanced-automod/configuration

> Every option in advancedmod.json5.



Advanced Automod has two files in AthenaBot's `configuration/` folder:

| File                     | What it holds                                                |
| ------------------------ | ------------------------------------------------------------ |
| `advancedmod.json5`      | License, ignored channels and roles, rules and the honeypot. |
| `advancedmod-lang.json5` | The messages rules send to members.                          |

Restart AthenaBot after editing either file.

```json5 title="configuration/advancedmod.json5"
{
  config: {
    LICENSE_KEY: "",
    ignored: {
      categories: [],
      roles: [],
      channels: [],
      users: [],
    },
    rules: {
      excessive_emojis: { ... },
      excessive_pings: { ... },
      blacklisted_words: { ... },
    },
    settings: {
      honeypot_mute_hours: 168,
    },
  },
}
```

| Option                         | What it does                                                                                |
| ------------------------------ | ------------------------------------------------------------------------------------------- |
| `LICENSE_KEY`                  | Your Advanced Automod license key.                                                          |
| `ignored.categories`           | Category IDs whose channels are never checked.                                              |
| `ignored.channels`             | Channel IDs that are never checked.                                                         |
| `ignored.roles`                | Role IDs whose members are never checked.                                                   |
| `ignored.users`                | User IDs that are never checked.                                                            |
| `rules`                        | Your rules. See below.                                                                      |
| `settings.honeypot_mute_hours` | How long the honeypot mutes someone, in hours. `null` mutes until a moderator unmutes them. |

Members on the `moderation` plugin's whitelist are also skipped. Bots are always skipped.

## Rules

Each key under `rules` is one rule. The key is just a name for you.

```json5
excessive_emojis: {
  name: "Excessive Emojis",
  description: "Too many emojis in one message.",
  enabled: true,
  management: {
    type: "emoji",
    action: [
      { type: "delete" },
      { type: "mute", duration: "1m" },
    ],
    guide: {
      emoji_limit: 5,
      ignored_emojis: [],
    },
  },
  response: {
    type: "DM",
    message: { id: "excessive_emojis" },
  },
},
```

| Option              | What it does                                                           |
| ------------------- | ---------------------------------------------------------------------- |
| `name`              | Shown in moderation logs as the reason, unless an action sets its own. |
| `description`       | A note for you. Not shown anywhere.                                    |
| `enabled`           | `false` turns the rule off.                                            |
| `management.type`   | What the rule checks: `emoji`, `ping` or `message`.                    |
| `management.action` | What happens when it triggers, in order.                               |
| `management.guide`  | The rule's limits. Depends on the type.                                |
| `response`          | Optional. A message sent to the member.                                |

### Guide by Type

| Type      | Option           | What it does                                                                              |
| --------- | ---------------- | ----------------------------------------------------------------------------------------- |
| `emoji`   | `emoji_limit`    | Triggers when a message has more emojis than this. Counts both Unicode and custom emojis. |
|           | `ignored_emojis` | Emojis that are not counted, such as `"👍"` or `"<:pepe:123456789012345678>"`.            |
| `ping`    | `ping_limit`     | Triggers when a member pings more users and roles than this within the window.            |
|           | `window_ms`      | The window in milliseconds. Defaults to `30000`.                                          |
|           | `ignored_pings`  | User or role IDs that are not counted.                                                    |
| `message` | `messages`       | Words or phrases. Matches anywhere in the message, ignoring case.                         |
|           | `regex`          | A regular expression, tested ignoring case. Leave `""` to skip.                           |

### Actions

| Type     | Options              | What it does                                                                             |
| -------- | -------------------- | ---------------------------------------------------------------------------------------- |
| `delete` |                      | Deletes the message.                                                                     |
| `warn`   | `reason`             | Gives a warning through the `moderation` plugin.                                         |
| `mute`   | `duration`, `reason` | Times the member out. `duration` such as `"10m"`, `"1h"` or `"7d"`. `null` is permanent. |
| `kick`   | `reason`             | Kicks the member.                                                                        |
| `ban`    | `duration`, `reason` | Bans the member. `null` is permanent.                                                    |

Warns, mutes, kicks and bans go through the `moderation` plugin, so they show up in its logs and history like any other punishment.

### Responses

| Option            | What it does                                               |
| ----------------- | ---------------------------------------------------------- |
| `type`            | `DM` sends it privately. `REPLY` replies in the channel.   |
| `message.id`      | A response under `responses` in `advancedmod-lang.json5`.  |
| `message.buttons` | Optional. A button that swaps the message for another one. |

A button has a `name`, a `style` (`BLUE`, `GRAY`, `GREEN` or `RED`) and its own `message` with an `id`. Inside that message, a button with `backbutton: true` goes back to the first message. See [Responses](/docs/advanced-automod/usage#responses).

## advancedmod-lang.json5

Each entry under `responses` is a message in AthenaBot's components format. Buttons from the rule are added to the bottom of the message.

```json5 title="configuration/advancedmod-lang.json5"
{
  lang: {
    responses: {
      excessive_emojis: {
        components: [
          {
            type: "container",
            accentColor: "#FFA500",
            components: [
              { type: "text", content: "# Message Removed\n\nYour message in %channel% had too many emojis." },
            ],
          },
        ],
      },
    },
  },
}
```

| Placeholder           | Value                                |
| --------------------- | ------------------------------------ |
| `%user_mention%`      | The member, as a mention.            |
| `%user_id%`           | The member's ID.                     |
| `%username%`          | The member's username.               |
| `%rule%`              | The rule's `name`.                   |
| `%server%`            | Your server's name.                  |
| `%channel%`           | The channel the message was sent in. |
| `%primary_color%`     | Your AthenaBot accent colour.        |
| `%custom_emoji_<id>%` | Any AthenaBot emoji.                 |

The plugin ships responses for every default rule: `excessive_emojis`, `excessive_emojis_details`, `excessive_pings` and `blacklisted_words`.
