🗑️
Delete Message
mod.delete_messageThe Mod SquadModerationDeletes 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.
🗑️Moderation
Delete Message
mod.delete_messagechannelIdrequired
{{message.channelId}}
messageIdrequired
{{message.id}}
output
error
Config fields
| Field | Type | Req | What it does |
|---|---|---|---|
channelId{{message.channelId}} | text | yes | Channel ID 📍 |
messageId{{message.id}} | text | yes | Message 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
}More Moderation pieces