# Message cleanup

> Bulk delete Discord messages with Based: /clear messages from chosen members and /pa to purge attachments, embeds, bot and command messages.

URL: https://www.jalkarna.in/based/docs/message-cleanup/  
Last updated: 2026-11-16

Message cleanup lets moderators delete messages on request. It is off by default and never runs automatically. Based has no automatic retention purging.

- `/clear` deletes recent messages from up to five chosen members.
- `/pa` deletes attachments, embeds, bot messages and command-like messages, which helps after a spam wave or a busy bot session.

Based looks through a limited number of recent messages per request (100 by default) and keeps its own messages unless you change that. Staff can allow `--include-attachments` with `/clear` to also remove other attachments, embeds and commands. Discord only allows bots to bulk delete messages younger than 14 days, so older messages may not be removed. See [how to bulk delete messages](https://www.jalkarna.in/based/learn/how-to-bulk-delete-messages-on-discord/).

## Settings
Change these in the [dashboard](https://www.jalkarna.in/based/dashboard/) or with `/setup` in Discord. They apply to one server at a time.

| Setting | Default | What it does |
|---|---|---|
| Enabled | Off | Turn this feature on for this server. |
| Allowed channels | Not set | Leave empty to let Based work in every channel it can see. |
| Maximum scan | 100 | The most messages Based looks through for each delete request. |
| Keep Based's messages | On | Never delete Based's own messages when clearing attachments. |
| Allow attachment cleanup with member cleanup | Off | Lets moderators add --include-attachments to also delete other attachments, embeds and commands. Without it, only the chosen members' messages are deleted. |

## Permissions Based needs
For this module Based's role needs: **View Channel**, **Read Message History**, **Manage Messages**. See [permissions](https://www.jalkarna.in/based/docs/permissions/) for how to grant them only where they are needed.

## Commands
Every command works as a slash command and with the text prefix (default `.`), so `/pa` and `.pa` do the same thing.

### /pa
Purge attachments, embeds, bots, and command-like messages.

- Usage: `/pa [limit]`
- `limit`: Maximum recent messages to inspect, bounded by server settings
- Who can use it: Members with Manage Messages, in servers only

### /clear
Purge selected users; optionally include attachments when server settings allow.

- Usage: `/clear <user> [user2] [user3] [user4] [user5] [include_attachments]`
- `user` (required): User whose messages to purge
- `user2`: Another user whose messages to purge
- `user3`: Another user whose messages to purge
- `user4`: Another user whose messages to purge
- `user5`: Another user whose messages to purge
- `include_attachments`: Also purge unrelated attachments and commands, if enabled in server settings
- Who can use it: Members with Manage Messages, in servers only

