K
Docs
API ReferencePiecesPurge Messages
🧹

Purge Messages

mod.purgeThe Mod SquadModeration

Deletes up to 100 messages from a channel in one sweep. Discord only allows bulk-deleting messages under 14 days old. Perfect for cleaning up spam raids, accidental leaks, or bot noise.

When to use this
  • Max is 100 messages per purge — chain multiple for bigger cleans
  • Discord won't bulk-delete messages older than 14 days
  • The bot needs Manage Messages in the target channel

On the canvas

This is what Purge Messages looks like when you place it on your flow. Each field below is something you configure in the inspector panel.

🧹
Purge Messages
mod.purge
Moderation
channelIdrequired
{{channel.id}}
countrequired
10 (max 100)
output
error

Config fields

FieldTypeReqWhat it does
channelId
{{channel.id}}
textyesChannel ID 📍
count
10 (max 100)
numberyesHow many to delete 🔢

Output ports

outputPurge complete
errorFailed — Manage Messages missing, or messages too old
📐

In TypeScript, this would be…

Not something you need to write — just a look at what Kitcord does for you.

TypeScript
const channel = await guild.channels.fetch(channelId);
if (channel?.isTextBased()) {
  const deleted = await channel.bulkDelete(count, true);
  // Max 100; messages must be < 14 days old
}