Purge Messages

NPM Version

The Purge Messages module allows moderators to quickly delete multiple messages from a channel using a single command.

Needed Permissions

  • Manage Messages
  • Read Message History
  • Admin/Mod role recommended

Ensure you have completed the setup steps in the Getting Started guide.

Usage

To enable purge functionality, include the library and call it:

JavaScript
const { discordPurge } = require('./node_modules/bb-dbotbits/discordPurge');

discordPurge();

Command Example

Delete 10 Messages
!purge 10

This will delete the last 10 messages in the channel (excluding pinned/system messages).

Notes

  • Discord does not allow bulk deletion of messages older than 14 days.
  • Always ensure the bot’s role is above the members it needs to moderate.
  • Use responsibly to avoid accidental content removal.

Next up: Tickets