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

# Purging messages

> Delete messages by author, content, type or position — and schedule it to happen automatically.

`purge` deletes recent messages. On its own it takes an amount; with a subcommand it filters by almost anything you'd want.

Requires **Manage Messages**. Aliases: `clear`, `rm`, `c`.

<CodeGroup>
  ```javascript Last 100 messages theme={null}
  !purge 100
  ```

  ```javascript From one person theme={null}
  !purge @someone 50
  ```

  ```javascript Everything but one person theme={null}
  !purge except @someone 100
  ```
</CodeGroup>

<Info>
  Discord will not let any bot bulk-delete messages older than **14 days**. Purge skips those rather than failing, so a purge of 100 in a quiet channel may delete fewer than 100 messages.
</Info>

## By author type

| Command                          | Aliases             | Deletes                             |
| -------------------------------- | ------------------- | ----------------------------------- |
| `purge bots [amount]`            | `bot`, `b`          | Messages from bots                  |
| `purge humans [amount]`          | `human`, `h`        | Messages from people                |
| `purge webhooks [amount]`        | `webhook`, `wh`     | Messages from webhooks              |
| `purge system [amount]`          | `sys`, `sm`         | Join messages, boost messages, pins |
| `purge except <member> [amount]` | `besides`, `schizo` | Everything **not** from that member |

```javascript theme={null}
!purge bots 100
!purge system 50
```

`cleanup` (aliases `botclear`, `clean`, `bc`) is the one you want most often — it removes bot messages *and* messages that look like commands to other bots, which clears the aftermath of a bot-spam session in one go.

## By content

| Command                            | Aliases                 | Deletes messages that    |
| ---------------------------------- | ----------------------- | ------------------------ |
| `purge contains <text> [amount]`   | `contain`, `c`          | Contain the text         |
| `purge startswith <text> [amount]` | `prefix`, `start`, `sw` | Start with it            |
| `purge endswith <text> [amount]`   | `suffix`, `end`, `ew`   | End with it              |
| `purge links [user] [amount]`      | `link`, `l`             | Contain a URL            |
| `purge invites [user] [amount]`    | `invite`, `inv`, `i`    | Contain a Discord invite |
| `purge mentions [user] [amount]`   | `mention`, `m`          | Contain user mentions    |
| `purge emojis [user] [amount]`     | `emotes`, `emoji`, `e`  | Contain custom emojis    |
| `purge tos [user] [amount]`        | `terms`, `t`            | Violate Discord's TOS    |

All content matching is case-insensitive.

```javascript theme={null}
!purge contains discord.gg 200
!purge startswith ! 100
```

## By attachment type

| Command                          | Aliases                      | Deletes                   |
| -------------------------------- | ---------------------------- | ------------------------- |
| `purge files [user] [amount]`    | `file`, `f`, `images`, `img` | Messages with attachments |
| `purge gifs [user] [amount]`     | `gif`, `g`, `jif`            | Messages with GIFs        |
| `purge embeds [user] [amount]`   | `embed`, `emb`               | Messages with embeds      |
| `purge stickers [user] [amount]` | `sticker`, `s`               | Messages with stickers    |
| `purge voice [user] [amount]`    | `vm`, `vc`, `v`              | Voice messages            |

## By position

<CodeGroup>
  ```javascript After a message theme={null}
  !purge after 1234567890123
  ```

  ```javascript Before a message theme={null}
  !purge before 1234567890123
  ```

  ```javascript Between two theme={null}
  !purge between 1234567890123 1234567890999
  ```
</CodeGroup>

These take message IDs or links, and cap at **300** messages. `after` aliases: `since`, `upto`, `af`. `before` aliases: `b4`, `bf`. `between` aliases: `range`, `btw`, `rng`.

<Tip>
  Right-click a message → Copy Message Link, and paste that. You don't need the raw ID.
</Tip>

## Reactions

```javascript theme={null}
!purge reactions 100
```

Strips every reaction from the last N messages **without deleting the messages themselves**. Aliases: `reaction`, `reacts`, `react`, `r`.

## Purging your own messages

```javascript theme={null}
!me 50
```

To let a role purge messages generally without giving them Manage Messages:

```javascript theme={null}
!me include @friend
!me include list
!me include remove @friend
```

Requires **Manage Roles** and **Manage Messages** to configure.

## Scheduled purges

Automatically clear a channel on a repeating interval — useful for spam channels, temporary event channels, or anywhere that shouldn't accumulate history.

<CodeGroup>
  ```javascript Every hour theme={null}
  !purge add #spam 1h
  ```

  ```javascript Only bot messages theme={null}
  !purge add #commands 30m --bots
  ```

  ```javascript Check one theme={null}
  !purge view #spam
  ```

  ```javascript List all theme={null}
  !purge list
  ```

  ```javascript Cancel one theme={null}
  !purge remove #spam
  ```

  ```javascript Cancel all theme={null}
  !purge clear
  ```
</CodeGroup>

Requires **Manage Messages** and **Manage Channels**. Aliases for `add`: `schedule`, `create`, `timer`.

<Note>
  For a channel you'd rather wipe completely than trim, `!nuke` clones it and deletes the original — instant, no 14-day limit, but it loses all history and the channel gets a new ID. Scheduled nukes are covered on the [Channels](/moderation/channels#nuking-a-channel) page.
</Note>

## Command reference

Every command requires **Manage Messages** unless noted.

| Command                                  | Description                                        |
| ---------------------------------------- | -------------------------------------------------- |
| `purge [user] [amount]`                  | Delete recent messages, optionally from one member |
| `purge bots [amount]`                    | Bot messages                                       |
| `purge humans [amount]`                  | Human messages                                     |
| `purge webhooks [amount]`                | Webhook messages                                   |
| `purge system [amount]`                  | Discord system messages                            |
| `purge except <member> [amount]`         | Everything except that member's                    |
| `purge contains <text> [amount]`         | Containing a substring                             |
| `purge startswith <text> [amount]`       | Starting with a substring                          |
| `purge endswith <text> [amount]`         | Ending with a substring                            |
| `purge links [user] [amount]`            | Containing URLs                                    |
| `purge invites [user] [amount]`          | Containing Discord invites                         |
| `purge mentions [user] [amount]`         | Containing mentions                                |
| `purge emojis [user] [amount]`           | Containing custom emojis                           |
| `purge tos [user] [amount]`              | Violating Discord TOS                              |
| `purge files [user] [amount]`            | With attachments                                   |
| `purge gifs [user] [amount]`             | With GIFs                                          |
| `purge embeds [user] [amount]`           | With embeds                                        |
| `purge stickers [user] [amount]`         | With stickers                                      |
| `purge voice [user] [amount]`            | Voice messages                                     |
| `purge reactions [amount]`               | Strip reactions, keep messages                     |
| `purge after <message>`                  | Up to 300 messages after one                       |
| `purge before <message>`                 | Up to 300 messages before one                      |
| `purge between <start> <end>`            | Messages between two                               |
| `purge add <channel> <interval> [flags]` | Schedule a recurring purge                         |
| `purge view <channel>`                   | View a channel's schedule                          |
| `purge list`                             | All scheduled purges                               |
| `purge remove <channel>`                 | Cancel one                                         |
| `purge clear`                            | Cancel all                                         |
| `cleanup [amount]`                       | Bot messages and command invocations               |
| `me [amount]`                            | Your own messages — no permission needed           |
| `me include <role>`                      | Allow a role to purge                              |
