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

# Warnings and moderation

> A staff-only /warn that counts warnings and times people out at 3.

> **What you'll build**
>
> * `/warn @member reason`: staff warn someone. The bot counts it and DMs them.
> * At **3 warnings**, the bot gives a **timeout** and starts the count again.
> * `/warnings @member`: see how many warnings someone has.
> * `/clear-warnings @member`: wipe someone's warnings.

## The variables to make

Or add **Warnings** from **What do you want to make?** on the Database page.

| Name | Type | Where it's kept | Starting value | What it's for |
| - | - | - | - | - |
| `warnings` | **User**, each member stores a **Number** | Server Specific | `0` | How many warnings each member has |

## /warn

**1. Make the command and inputs**

A **Slash command** called `warn`. Add a **User** input `member` and a **Text** input `reason`. Make both required.

They give you `{option_member}` and `{option_reason}`.

**2. Staff only**

Add the check that looks at **permissions** (search `permission`): **Moderate Members**. Under its **Else** block: **Reply** `Only moderators can warn people.`

**3. Count the warning: straight under the check**

**Do the maths** on `warnings`, Whose variable the **member input** `member`, Equation `var + 1`.

**4. Tell them**

A block that sends a **direct message** (search `direct`) to that member:

```text theme={null}
You were warned in {server}: {option_reason}
You have {DBVAR_warnings[option_member]} warnings.
```

**5. Tell the moderator**

**Reply**: `Warning given. {user_name[option_member]} now has {DBVAR_warnings[option_member]} warnings.`

**6. Three strikes**

Add **Compare**: Base Value `{DBVAR_warnings[option_member]}`, `Less Than`, Comparison Value `3`. Leave the path straight under it **empty**.

**7. Time out: under the Else block**

1. The **timeout** block (search `timeout`) for the input member, for 1 hour.
2. **Save a value** on `warnings`, Whose variable the **member input** `member`, Value `0`.

**8. Save**

Press **Save**.

## When a block fails

Some blocks can fail. For example, the bot cannot time out someone with a higher role, and a DM fails if the member has DMs closed.

Many blocks have two extra paths:

* the **green** path: "it worked"
* the **red** path: "it failed"

Press the **+** on the red path of the timeout block and add a **Reply**:

```text theme={null}
I couldn't do that: {error_reason}. Is my role high enough?
```

`{error_reason}` says why it failed, in plain words. See [Built-in variables](/variables/built-in-variables#when-a-block-fails).

You can also choose what happens for the whole command in **If something breaks** on the first block: **Explain the problem**, **My own message**, **Stay silent**, **Alert a staff channel**, or **Skip the broken block and continue**.

## /warnings

**1. Make the command**

A **Slash command** called `warnings` with a **User** input `member`.

**2. Add a Reply**

```text theme={null}
{user_name[option_member]} has {DBVAR_warnings[option_member]} warnings.
```

## /clear-warnings

**1. Make the command**

A **Slash command** called `clear-warnings` with a **User** input `member`.

**2. Staff only**

The **permissions** check: **Moderate Members**, with a Reply under **Else**.

**3. Wipe them: straight under the check**

**Clear a value** on `warnings` for the input member. Then **Reply**: `Warnings cleared.`

## Try it

> [!TIP]
>
> 1. Use `/warn` on a test account with a reason. It gets a DM.
> 2. Type `/warnings` for that account. You see `1`.
> 3. Warn it two more times. It gets a timeout and the count goes back to `0`.
> 4. Try `/warn` from an account without **Moderate Members**. The bot says no.

## More moderation blocks

Search the block list for these words: `kick`, `ban`, `timeout`, `nickname`, `delete` (messages), `bulk` (many messages at once).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.