K
Docs
API ReferencePiecesDelete Message
🗑️

Delete Message

mod.delete_messageThe Mod SquadModeration

Deletes one specific message from a channel. Use in message-event flows where bad content needs to go immediately. The message ID and channel ID are available as Sparks in message triggers.

When to use this
  • Use in messageCreate trigger flows for automated content removal
  • Always hook up the Error port — messages can vanish before the flow reaches this piece
  • Pair with a DM to let the user know why their message was removed

On the canvas

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

🗑️
Delete Message
mod.delete_message
Moderation
channelIdrequired
{{message.channelId}}
messageIdrequired
{{message.id}}
output
error

Config fields

FieldTypeReqWhat it does
channelId
{{message.channelId}}
textyesChannel ID 📍
messageId
{{message.id}}
textyesMessage ID 🆔

Output ports

outputMessage deleted
errorAlready gone, or bot lacks Manage Messages
📐

In TypeScript, this would be…

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

TypeScript
try {
  const channel = await client.channels.fetch(channelId);
  if (channel?.isTextBased()) {
    const msg = await channel.messages.fetch(messageId);
    await msg.delete();
  }
} catch {
  // Error port — already deleted
}