2.1.3. Purge Command

The /purge command allows dashboard administrators to close multiple inactive tickets at once. This is useful for cleaning up old tickets that haven't been active for a while.

Permission Required: This command can only be used by dashboard administrators. If you need access, ask the server owner to run /addadmin @YourUsername.

Command Syntax

/purge [inactive-hours] [dry-run]

Both parameters are optional:

  • inactive-hours - Number of hours of inactivity required (default: 48, minimum: 1, maximum: 720)
  • dry-run - Preview which tickets would be closed without actually closing them (default: false)

How It Works

The purge command finds all open or claimed tickets that haven't had any activity for the specified number of hours. It then closes them in bulk, generating transcripts and sending notifications just like a normal ticket closure.

Inactivity Calculation

The bot checks the lastActivityAt timestamp for each ticket. This timestamp is updated whenever a message is sent in the ticket channel.

For example, if you run /purge inactive-hours:72, it will find all tickets that haven't had a message in the last 72 hours (3 days).

Dry Run Mode

Before actually closing tickets, you can preview which tickets would be affected using dry-run mode:

/purge inactive-hours:48 dry-run:True

This will show you a list of tickets that would be closed without actually closing them. This is recommended before running the actual purge to ensure you're closing the right tickets.

Excluded Tickets

Tickets that have been excluded from auto-close (via /autoclose-exclude add) are automatically excluded from purge operations as well.

This ensures that tickets you've specifically marked to keep open won't be accidentally closed during a purge.

What Happens When Tickets Are Purged?

When tickets are closed via the purge command, the same process occurs as with a normal ticket closure:

1

A closure message is sent to each ticket channel explaining it was closed due to inactivity

2

A transcript is generated for each ticket (if transcript storage is enabled)

3

Ticket openers receive a direct message with a link to view their transcript

4

Notifications are sent to your configured transcripts channel (if one is set)

5

Ticket channels are deleted after a short delay

6

The command reports how many tickets were successfully closed

Usage Examples

Preview Tickets to Close

/purge inactive-hours:48 dry-run:True

Shows all tickets inactive for 48+ hours without closing them.

Close Tickets Inactive for 3 Days

/purge inactive-hours:72

Closes all tickets that haven't had activity in the last 72 hours (3 days).

Close Very Old Tickets

/purge inactive-hours:168

Closes tickets inactive for 168 hours (1 week). Useful for periodic deep cleans.

Best Practices

Always Use Dry-Run First

Before running an actual purge, always use dry-run mode to see which tickets would be affected. This helps prevent accidentally closing tickets that should remain open.

Set Appropriate Timeframes

Consider your support workflow when choosing inactive hours. If your team typically responds within 24-48 hours, setting purge to 72+ hours gives users time to respond.

Exclude Important Tickets

Use /autoclose-exclude addon tickets that need to remain open longer, such as ongoing investigations or tickets waiting on external parties.

Regular Maintenance

Consider running periodic purges (e.g., monthly) to keep your server organized. This is especially useful for servers with high ticket volume.

Related: The purge command works similarly to the Auto-Close feature, but gives you manual control over when to close inactive tickets in bulk.