# Purge

> With the `@Nyaru purge` command, you can delete a number of messages from a channel. You can use different filters/options to specify what type of messages you want to remove from the channel.

{% tabs %}
{% tab title="Aliases" %}
`pg`, `bulkdelete`, `clear`
{% endtab %}

{% tab title="Flags" %}

* `-force` - Force [flag](/introduction/usage.md#flags) allows you to force purge the required messages, instead of filtering pinned messages **(This will force to delete pinned messages as well)**. Learn more about flags [here](/introduction/usage.md#flags).
  {% endtab %}

{% tab title="Cooldown" %}
5 seconds
{% endtab %}

{% tab title="Permissions" %}

* `MANAGE_MESSAGES`: The discord user running the command should have at least this permission in the command channel.
  {% endtab %}

{% tab title="Requirements" %}

* `READ_MESSAGES`: Bot should be able to read messages to listen your command!
* `READ_MESSAGE_HISTORY`: Bot should be able to read message history to fetch and purge them.
* `EMBED_LINKS`: Bot will provide command output in the embed.
* `MANAGE_MESSAGES`: Bot should have permissions to manage messages in the command channel to delete messages.
  {% endtab %}
  {% endtabs %}

{% hint style="warning" %}
You can **only** delete upto **100** messages *maximum* per execution, and you **cannot** purge messages **older** than **14 days**. [Learn more](/introduction/faqs.md#purge-isnt-working-as-expected-with-messages-older-than-14-days-what-does-that-mean).
{% endhint %}

## Usage

```
@Nyaru purge (count) (option) (search arguments)
```

### Examples

* Purge last **69** messages, **excluding** channel pins:

> @Nyaru purge 69

* Purge last **100** messages, **including** channel pins:

> @Nyaru purge 100 -force

{% hint style="danger" %}
In above examples, purge count/amount is **required** argument, however the flag is *optional*.
{% endhint %}

## Sub Commands

Purge filters can help you specify and clean **specific** type of messages (to your desire). Some cases where you can use these sub commands:

* You want to clear messages which **includes** text `hell`,&#x20;
* You want to clear all bot messages *(upto last 100 messages)*,
* You want to clear all **attachment** messages,
* You want to clear all messages **not including** text `noob`,

and much more - we have got it covered for you.

| Sub Command                                     | Description                                                |
| ----------------------------------------------- | ---------------------------------------------------------- |
| [bots](/moderation/purge/bots.md)               | Purge messages sent by **bots**.                           |
| [humans](/moderation/purge/humans.md)           | Purge messages sent by **humans**.                         |
| [links (WIP)](/moderation/purge/links.md)       | Purge messages containing any **link(s)**.                 |
| [attachments](/moderation/purge/attachments.md) | Purge messages containing any **attachment(s)**.           |
| [mentions](/moderation/purge/mentions.md)       | Purge messages containing **user** or **role mention(s)**. |
| [embeds (WIP)](/moderation/purge/embeds.md)     | Purge messages containing **embed(s)**.                    |
| [includes](/moderation/purge/includes.md)       | Purge messages **including** the given text.               |
| [not](/moderation/purge/not.md)                 | Purge messages **not including** the given text.           |
| [startswith](/moderation/purge/startswith.md)   | Purge messages **starting with** given text.               |
| [endswith](/moderation/purge/endswith.md)       | Purge messages **ending with** given text.                 |
| [user](/moderation/purge/user.md)               | Purge messages sent by a **specific user/bot account**.    |

{% hint style="info" %}
**You can click on the respective sub-command to jump to detailed documentation with usage and examples of that specific sub-command.**
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nyaru.xyz/moderation/purge.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
